Lines Matching refs:ubuf
34 struct udmabuf *ubuf = vma->vm_private_data; in udmabuf_vm_fault() local
37 if (pgoff >= ubuf->pagecount) in udmabuf_vm_fault()
39 vmf->page = ubuf->pages[pgoff]; in udmabuf_vm_fault()
50 struct udmabuf *ubuf = buf->priv; in mmap_udmabuf() local
56 vma->vm_private_data = ubuf; in mmap_udmabuf()
63 struct udmabuf *ubuf = buf->priv; in get_sg_table() local
70 ret = sg_alloc_table_from_pages(sg, ubuf->pages, ubuf->pagecount, in get_sg_table()
71 0, ubuf->pagecount << PAGE_SHIFT, in get_sg_table()
109 struct udmabuf *ubuf = buf->priv; in release_udmabuf() local
110 struct device *dev = ubuf->device->this_device; in release_udmabuf()
113 if (ubuf->sg) in release_udmabuf()
114 put_sg_table(dev, ubuf->sg, DMA_BIDIRECTIONAL); in release_udmabuf()
116 for (pg = 0; pg < ubuf->pagecount; pg++) in release_udmabuf()
117 put_page(ubuf->pages[pg]); in release_udmabuf()
118 kfree(ubuf->pages); in release_udmabuf()
119 kfree(ubuf); in release_udmabuf()
125 struct udmabuf *ubuf = buf->priv; in begin_cpu_udmabuf() local
126 struct device *dev = ubuf->device->this_device; in begin_cpu_udmabuf()
129 if (!ubuf->sg) { in begin_cpu_udmabuf()
130 ubuf->sg = get_sg_table(dev, buf, direction); in begin_cpu_udmabuf()
131 if (IS_ERR(ubuf->sg)) { in begin_cpu_udmabuf()
132 ret = PTR_ERR(ubuf->sg); in begin_cpu_udmabuf()
133 ubuf->sg = NULL; in begin_cpu_udmabuf()
136 dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents, in begin_cpu_udmabuf()
146 struct udmabuf *ubuf = buf->priv; in end_cpu_udmabuf() local
147 struct device *dev = ubuf->device->this_device; in end_cpu_udmabuf()
149 if (!ubuf->sg) in end_cpu_udmabuf()
152 dma_sync_sg_for_device(dev, ubuf->sg->sgl, ubuf->sg->nents, direction); in end_cpu_udmabuf()
176 struct udmabuf *ubuf; in udmabuf_create() local
185 ubuf = kzalloc(sizeof(*ubuf), GFP_KERNEL); in udmabuf_create()
186 if (!ubuf) in udmabuf_create()
195 ubuf->pagecount += list[i].size >> PAGE_SHIFT; in udmabuf_create()
196 if (ubuf->pagecount > pglimit) in udmabuf_create()
200 if (!ubuf->pagecount) in udmabuf_create()
203 ubuf->pages = kmalloc_array(ubuf->pagecount, sizeof(*ubuf->pages), in udmabuf_create()
205 if (!ubuf->pages) { in udmabuf_create()
262 ubuf->pages[pgbuf++] = page; in udmabuf_create()
273 exp_info.size = ubuf->pagecount << PAGE_SHIFT; in udmabuf_create()
274 exp_info.priv = ubuf; in udmabuf_create()
277 ubuf->device = device; in udmabuf_create()
291 put_page(ubuf->pages[--pgbuf]); in udmabuf_create()
294 kfree(ubuf->pages); in udmabuf_create()
295 kfree(ubuf); in udmabuf_create()