• Home
  • Raw
  • Download

Lines Matching refs:bm

24 	struct comedi_buf_map *bm =  in comedi_buf_map_kref_release()  local
29 if (bm->page_list) { in comedi_buf_map_kref_release()
30 if (bm->dma_dir != DMA_NONE) { in comedi_buf_map_kref_release()
35 buf = &bm->page_list[0]; in comedi_buf_map_kref_release()
36 dma_free_coherent(bm->dma_hw_dev, in comedi_buf_map_kref_release()
37 PAGE_SIZE * bm->n_pages, in comedi_buf_map_kref_release()
40 for (i = 0; i < bm->n_pages; i++) { in comedi_buf_map_kref_release()
41 buf = &bm->page_list[i]; in comedi_buf_map_kref_release()
46 vfree(bm->page_list); in comedi_buf_map_kref_release()
48 if (bm->dma_dir != DMA_NONE) in comedi_buf_map_kref_release()
49 put_device(bm->dma_hw_dev); in comedi_buf_map_kref_release()
50 kfree(bm); in comedi_buf_map_kref_release()
57 struct comedi_buf_map *bm; in __comedi_buf_free() local
68 bm = async->buf_map; in __comedi_buf_free()
71 comedi_buf_map_put(bm); in __comedi_buf_free()
78 struct comedi_buf_map *bm; in comedi_buf_map_alloc() local
82 bm = kzalloc(sizeof(*bm), GFP_KERNEL); in comedi_buf_map_alloc()
83 if (!bm) in comedi_buf_map_alloc()
86 kref_init(&bm->refcount); in comedi_buf_map_alloc()
87 bm->dma_dir = dma_dir; in comedi_buf_map_alloc()
88 if (bm->dma_dir != DMA_NONE) { in comedi_buf_map_alloc()
90 bm->dma_hw_dev = get_device(dev->hw_dev); in comedi_buf_map_alloc()
93 bm->page_list = vzalloc(sizeof(*buf) * n_pages); in comedi_buf_map_alloc()
94 if (!bm->page_list) in comedi_buf_map_alloc()
97 if (bm->dma_dir != DMA_NONE) { in comedi_buf_map_alloc()
105 virt_addr = dma_alloc_coherent(bm->dma_hw_dev, in comedi_buf_map_alloc()
112 buf = &bm->page_list[i]; in comedi_buf_map_alloc()
117 bm->n_pages = i; in comedi_buf_map_alloc()
120 buf = &bm->page_list[i]; in comedi_buf_map_alloc()
128 bm->n_pages = i; in comedi_buf_map_alloc()
133 return bm; in comedi_buf_map_alloc()
136 comedi_buf_map_put(bm); in comedi_buf_map_alloc()
146 struct comedi_buf_map *bm; in __comedi_buf_alloc() local
157 bm = comedi_buf_map_alloc(dev, s->async_dma_dir, n_pages); in __comedi_buf_alloc()
158 if (!bm) in __comedi_buf_alloc()
162 async->buf_map = bm; in __comedi_buf_alloc()
165 if (bm->dma_dir != DMA_NONE) { in __comedi_buf_alloc()
170 buf = &bm->page_list[0]; in __comedi_buf_alloc()
178 buf = &bm->page_list[i]; in __comedi_buf_alloc()
190 void comedi_buf_map_get(struct comedi_buf_map *bm) in comedi_buf_map_get() argument
192 if (bm) in comedi_buf_map_get()
193 kref_get(&bm->refcount); in comedi_buf_map_get()
196 int comedi_buf_map_put(struct comedi_buf_map *bm) in comedi_buf_map_put() argument
198 if (bm) in comedi_buf_map_put()
199 return kref_put(&bm->refcount, comedi_buf_map_kref_release); in comedi_buf_map_put()
204 int comedi_buf_map_access(struct comedi_buf_map *bm, unsigned long offset, in comedi_buf_map_access() argument
211 while (done < len && pg < bm->n_pages) { in comedi_buf_map_access()
213 void *b = bm->page_list[pg].virt_addr + pgoff; in comedi_buf_map_access()
232 struct comedi_buf_map *bm = NULL; in comedi_buf_map_from_subdev_get() local
239 bm = async->buf_map; in comedi_buf_map_from_subdev_get()
241 if (bm && bm->n_pages) in comedi_buf_map_from_subdev_get()
242 comedi_buf_map_get(bm); in comedi_buf_map_from_subdev_get()
244 bm = NULL; in comedi_buf_map_from_subdev_get()
247 return bm; in comedi_buf_map_from_subdev_get()
252 struct comedi_buf_map *bm = s->async->buf_map; in comedi_buf_is_mmapped() local
254 return bm && (kref_read(&bm->refcount) > 1); in comedi_buf_is_mmapped()