• Home
  • Raw
  • Download

Lines Matching refs:bm

23 	struct comedi_buf_map *bm =  in comedi_buf_map_kref_release()  local
28 if (bm->page_list) { in comedi_buf_map_kref_release()
29 if (bm->dma_dir != DMA_NONE) { in comedi_buf_map_kref_release()
34 buf = &bm->page_list[0]; in comedi_buf_map_kref_release()
35 dma_free_coherent(bm->dma_hw_dev, in comedi_buf_map_kref_release()
36 PAGE_SIZE * bm->n_pages, in comedi_buf_map_kref_release()
39 for (i = 0; i < bm->n_pages; i++) { in comedi_buf_map_kref_release()
40 buf = &bm->page_list[i]; in comedi_buf_map_kref_release()
45 vfree(bm->page_list); in comedi_buf_map_kref_release()
47 if (bm->dma_dir != DMA_NONE) in comedi_buf_map_kref_release()
48 put_device(bm->dma_hw_dev); in comedi_buf_map_kref_release()
49 kfree(bm); in comedi_buf_map_kref_release()
56 struct comedi_buf_map *bm; in __comedi_buf_free() local
67 bm = async->buf_map; in __comedi_buf_free()
70 comedi_buf_map_put(bm); in __comedi_buf_free()
77 struct comedi_buf_map *bm; in comedi_buf_map_alloc() local
81 bm = kzalloc(sizeof(*bm), GFP_KERNEL); in comedi_buf_map_alloc()
82 if (!bm) in comedi_buf_map_alloc()
85 kref_init(&bm->refcount); in comedi_buf_map_alloc()
86 bm->dma_dir = dma_dir; in comedi_buf_map_alloc()
87 if (bm->dma_dir != DMA_NONE) { in comedi_buf_map_alloc()
89 bm->dma_hw_dev = get_device(dev->hw_dev); in comedi_buf_map_alloc()
92 bm->page_list = vzalloc(sizeof(*buf) * n_pages); in comedi_buf_map_alloc()
93 if (!bm->page_list) in comedi_buf_map_alloc()
96 if (bm->dma_dir != DMA_NONE) { in comedi_buf_map_alloc()
104 virt_addr = dma_alloc_coherent(bm->dma_hw_dev, in comedi_buf_map_alloc()
111 buf = &bm->page_list[i]; in comedi_buf_map_alloc()
116 bm->n_pages = i; in comedi_buf_map_alloc()
119 buf = &bm->page_list[i]; in comedi_buf_map_alloc()
127 bm->n_pages = i; in comedi_buf_map_alloc()
132 return bm; in comedi_buf_map_alloc()
135 comedi_buf_map_put(bm); in comedi_buf_map_alloc()
145 struct comedi_buf_map *bm; in __comedi_buf_alloc() local
156 bm = comedi_buf_map_alloc(dev, s->async_dma_dir, n_pages); in __comedi_buf_alloc()
157 if (!bm) in __comedi_buf_alloc()
161 async->buf_map = bm; in __comedi_buf_alloc()
164 if (bm->dma_dir != DMA_NONE) { in __comedi_buf_alloc()
169 buf = &bm->page_list[0]; in __comedi_buf_alloc()
177 buf = &bm->page_list[i]; in __comedi_buf_alloc()
189 void comedi_buf_map_get(struct comedi_buf_map *bm) in comedi_buf_map_get() argument
191 if (bm) in comedi_buf_map_get()
192 kref_get(&bm->refcount); in comedi_buf_map_get()
195 int comedi_buf_map_put(struct comedi_buf_map *bm) in comedi_buf_map_put() argument
197 if (bm) in comedi_buf_map_put()
198 return kref_put(&bm->refcount, comedi_buf_map_kref_release); in comedi_buf_map_put()
203 int comedi_buf_map_access(struct comedi_buf_map *bm, unsigned long offset, in comedi_buf_map_access() argument
210 while (done < len && pg < bm->n_pages) { in comedi_buf_map_access()
212 void *b = bm->page_list[pg].virt_addr + pgoff; in comedi_buf_map_access()
231 struct comedi_buf_map *bm = NULL; in comedi_buf_map_from_subdev_get() local
238 bm = async->buf_map; in comedi_buf_map_from_subdev_get()
240 if (bm && bm->n_pages) in comedi_buf_map_from_subdev_get()
241 comedi_buf_map_get(bm); in comedi_buf_map_from_subdev_get()
243 bm = NULL; in comedi_buf_map_from_subdev_get()
246 return bm; in comedi_buf_map_from_subdev_get()
251 struct comedi_buf_map *bm = s->async->buf_map; in comedi_buf_is_mmapped() local
253 return bm && (kref_read(&bm->refcount) > 1); in comedi_buf_is_mmapped()