Lines Matching refs:ubuf
36 struct udmabuf *ubuf = vma->vm_private_data; in udmabuf_vm_fault() local
39 if (pgoff >= ubuf->pagecount) in udmabuf_vm_fault()
41 vmf->page = ubuf->pages[pgoff]; in udmabuf_vm_fault()
52 struct udmabuf *ubuf = buf->priv; in mmap_udmabuf() local
58 vma->vm_private_data = ubuf; in mmap_udmabuf()
64 struct udmabuf *ubuf = buf->priv; in vmap_udmabuf() local
69 vaddr = vm_map_ram(ubuf->pages, ubuf->pagecount, -1); in vmap_udmabuf()
79 struct udmabuf *ubuf = buf->priv; in vunmap_udmabuf() local
83 vm_unmap_ram(map->vaddr, ubuf->pagecount); in vunmap_udmabuf()
89 struct udmabuf *ubuf = buf->priv; in get_sg_table() local
96 ret = sg_alloc_table_from_pages(sg, ubuf->pages, ubuf->pagecount, in get_sg_table()
97 0, ubuf->pagecount << PAGE_SHIFT, in get_sg_table()
135 struct udmabuf *ubuf = buf->priv; in release_udmabuf() local
136 struct device *dev = ubuf->device->this_device; in release_udmabuf()
139 if (ubuf->sg) in release_udmabuf()
140 put_sg_table(dev, ubuf->sg, DMA_BIDIRECTIONAL); in release_udmabuf()
142 for (pg = 0; pg < ubuf->pagecount; pg++) in release_udmabuf()
143 put_page(ubuf->pages[pg]); in release_udmabuf()
144 kfree(ubuf->pages); in release_udmabuf()
145 kfree(ubuf); in release_udmabuf()
151 struct udmabuf *ubuf = buf->priv; in begin_cpu_udmabuf() local
152 struct device *dev = ubuf->device->this_device; in begin_cpu_udmabuf()
155 if (!ubuf->sg) { in begin_cpu_udmabuf()
156 ubuf->sg = get_sg_table(dev, buf, direction); in begin_cpu_udmabuf()
157 if (IS_ERR(ubuf->sg)) { in begin_cpu_udmabuf()
158 ret = PTR_ERR(ubuf->sg); in begin_cpu_udmabuf()
159 ubuf->sg = NULL; in begin_cpu_udmabuf()
162 dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents, in begin_cpu_udmabuf()
172 struct udmabuf *ubuf = buf->priv; in end_cpu_udmabuf() local
173 struct device *dev = ubuf->device->this_device; in end_cpu_udmabuf()
175 if (!ubuf->sg) in end_cpu_udmabuf()
178 dma_sync_sg_for_device(dev, ubuf->sg->sgl, ubuf->sg->nents, direction); in end_cpu_udmabuf()
204 struct udmabuf *ubuf; in udmabuf_create() local
211 ubuf = kzalloc(sizeof(*ubuf), GFP_KERNEL); in udmabuf_create()
212 if (!ubuf) in udmabuf_create()
221 ubuf->pagecount += list[i].size >> PAGE_SHIFT; in udmabuf_create()
222 if (ubuf->pagecount > pglimit) in udmabuf_create()
226 if (!ubuf->pagecount) in udmabuf_create()
229 ubuf->pages = kmalloc_array(ubuf->pagecount, sizeof(*ubuf->pages), in udmabuf_create()
231 if (!ubuf->pages) { in udmabuf_create()
260 ubuf->pages[pgbuf++] = page; in udmabuf_create()
267 exp_info.size = ubuf->pagecount << PAGE_SHIFT; in udmabuf_create()
268 exp_info.priv = ubuf; in udmabuf_create()
271 ubuf->device = device; in udmabuf_create()
285 put_page(ubuf->pages[--pgbuf]); in udmabuf_create()
288 kfree(ubuf->pages); in udmabuf_create()
289 kfree(ubuf); in udmabuf_create()