Lines Matching full: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()
30 for (i = 0; i < bm->n_pages; i++) { in comedi_buf_map_kref_release()
31 buf = &bm->page_list[i]; in comedi_buf_map_kref_release()
32 dma_free_coherent(bm->dma_hw_dev, PAGE_SIZE, in comedi_buf_map_kref_release()
37 for (i = 0; i < bm->n_pages; i++) { in comedi_buf_map_kref_release()
38 buf = &bm->page_list[i]; in comedi_buf_map_kref_release()
43 vfree(bm->page_list); in comedi_buf_map_kref_release()
45 if (bm->dma_dir != DMA_NONE) in comedi_buf_map_kref_release()
46 put_device(bm->dma_hw_dev); in comedi_buf_map_kref_release()
47 kfree(bm); in comedi_buf_map_kref_release()
54 struct comedi_buf_map *bm; in __comedi_buf_free() local
59 bm = async->buf_map; in __comedi_buf_free()
62 comedi_buf_map_put(bm); in __comedi_buf_free()
69 struct comedi_buf_map *bm; in comedi_buf_map_alloc() local
73 bm = kzalloc(sizeof(*bm), GFP_KERNEL); in comedi_buf_map_alloc()
74 if (!bm) in comedi_buf_map_alloc()
77 kref_init(&bm->refcount); in comedi_buf_map_alloc()
78 bm->dma_dir = dma_dir; in comedi_buf_map_alloc()
79 if (bm->dma_dir != DMA_NONE) { in comedi_buf_map_alloc()
81 bm->dma_hw_dev = get_device(dev->hw_dev); in comedi_buf_map_alloc()
84 bm->page_list = vzalloc(sizeof(*buf) * n_pages); in comedi_buf_map_alloc()
85 if (!bm->page_list) in comedi_buf_map_alloc()
88 if (bm->dma_dir != DMA_NONE) { in comedi_buf_map_alloc()
90 buf = &bm->page_list[i]; in comedi_buf_map_alloc()
92 dma_alloc_coherent(bm->dma_hw_dev, PAGE_SIZE, in comedi_buf_map_alloc()
99 buf = &bm->page_list[i]; in comedi_buf_map_alloc()
107 bm->n_pages = i; in comedi_buf_map_alloc()
111 return bm; in comedi_buf_map_alloc()
114 comedi_buf_map_put(bm); in comedi_buf_map_alloc()
123 struct comedi_buf_map *bm; in __comedi_buf_alloc() local
132 bm = comedi_buf_map_alloc(dev, s->async_dma_dir, n_pages); in __comedi_buf_alloc()
133 if (!bm) in __comedi_buf_alloc()
137 async->buf_map = bm; in __comedi_buf_alloc()
142 void comedi_buf_map_get(struct comedi_buf_map *bm) in comedi_buf_map_get() argument
144 if (bm) in comedi_buf_map_get()
145 kref_get(&bm->refcount); in comedi_buf_map_get()
148 int comedi_buf_map_put(struct comedi_buf_map *bm) in comedi_buf_map_put() argument
150 if (bm) in comedi_buf_map_put()
151 return kref_put(&bm->refcount, comedi_buf_map_kref_release); in comedi_buf_map_put()
156 int comedi_buf_map_access(struct comedi_buf_map *bm, unsigned long offset, in comedi_buf_map_access() argument
163 while (done < len && pg < bm->n_pages) { in comedi_buf_map_access()
165 void *b = bm->page_list[pg].virt_addr + pgoff; in comedi_buf_map_access()
184 struct comedi_buf_map *bm = NULL; in comedi_buf_map_from_subdev_get() local
191 bm = async->buf_map; in comedi_buf_map_from_subdev_get()
193 if (bm && bm->n_pages) in comedi_buf_map_from_subdev_get()
194 comedi_buf_map_get(bm); in comedi_buf_map_from_subdev_get()
196 bm = NULL; in comedi_buf_map_from_subdev_get()
199 return bm; in comedi_buf_map_from_subdev_get()
204 struct comedi_buf_map *bm = s->async->buf_map; in comedi_buf_is_mmapped() local
206 return bm && (kref_read(&bm->refcount) > 1); in comedi_buf_is_mmapped()