Lines Matching defs:bm

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