Lines Matching full:heap
12 #include <linux/dma-heap.h>
19 #include <uapi/linux/dma-heap.h>
26 * struct dma_heap - represents a dmabuf heap in the system
28 * @ops: ops struct for this heap
29 * @priv: private data for this heap
30 * @heap_devt: heap device node
32 * @heap_cdev: heap char device
34 * Represents a heap of memory from which buffers can be made.
51 static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len, in dma_heap_buffer_alloc() argument
66 dmabuf = heap->ops->allocate(heap, len, fd_flags, heap_flags); in dma_heap_buffer_alloc()
80 struct dma_heap *heap; in dma_heap_open() local
82 heap = xa_load(&dma_heap_minors, iminor(inode)); in dma_heap_open()
83 if (!heap) { in dma_heap_open()
89 file->private_data = heap; in dma_heap_open()
98 struct dma_heap *heap = file->private_data; in dma_heap_ioctl_allocate() local
110 fd = dma_heap_buffer_alloc(heap, heap_allocation->len, in dma_heap_ioctl_allocate()
195 * dma_heap_get_drvdata - get per-heap driver data
196 * @heap: DMA-Heap to retrieve private data for
199 * The per-heap data for the heap.
201 void *dma_heap_get_drvdata(struct dma_heap *heap) in dma_heap_get_drvdata() argument
203 return heap->priv; in dma_heap_get_drvdata()
207 * dma_heap_get_name - get heap name
208 * @heap: DMA-Heap to retrieve the name of
211 * The char* for the heap name.
213 const char *dma_heap_get_name(struct dma_heap *heap) in dma_heap_get_name() argument
215 return heap->name; in dma_heap_get_name()
219 * dma_heap_add - adds a heap to dmabuf heaps
220 * @exp_info: information needed to register this heap
224 struct dma_heap *heap, *h, *err_ret; in dma_heap_add() local
230 pr_err("dma_heap: Cannot add heap without a name\n"); in dma_heap_add()
235 pr_err("dma_heap: Cannot add heap with invalid ops struct\n"); in dma_heap_add()
239 heap = kzalloc(sizeof(*heap), GFP_KERNEL); in dma_heap_add()
240 if (!heap) in dma_heap_add()
243 heap->name = exp_info->name; in dma_heap_add()
244 heap->ops = exp_info->ops; in dma_heap_add()
245 heap->priv = exp_info->priv; in dma_heap_add()
248 ret = xa_alloc(&dma_heap_minors, &minor, heap, in dma_heap_add()
251 pr_err("dma_heap: Unable to get minor number for heap\n"); in dma_heap_add()
257 heap->heap_devt = MKDEV(MAJOR(dma_heap_devt), minor); in dma_heap_add()
259 cdev_init(&heap->heap_cdev, &dma_heap_fops); in dma_heap_add()
260 ret = cdev_add(&heap->heap_cdev, heap->heap_devt, 1); in dma_heap_add()
269 heap->heap_devt, in dma_heap_add()
271 heap->name); in dma_heap_add()
283 pr_err("dma_heap: Already registered heap named %s\n", in dma_heap_add()
290 /* Add heap to the list */ in dma_heap_add()
291 list_add(&heap->list, &heap_list); in dma_heap_add()
294 return heap; in dma_heap_add()
297 device_destroy(dma_heap_class, heap->heap_devt); in dma_heap_add()
299 cdev_del(&heap->heap_cdev); in dma_heap_add()
303 kfree(heap); in dma_heap_add()