Lines Matching full:heap
20 #include <linux/dma-heap.h>
21 #include <uapi/linux/dma-heap.h>
28 * struct dma_heap - represents a dmabuf heap in the system
30 * @ops: ops struct for this heap
31 * @heap_devt heap device node
33 * @heap_cdev heap char device
35 * Represents a heap of memory from which buffers can be made.
52 static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len, in dma_heap_buffer_alloc() argument
64 return heap->ops->allocate(heap, len, fd_flags, heap_flags); in dma_heap_buffer_alloc()
69 struct dma_heap *heap; in dma_heap_open() local
71 heap = xa_load(&dma_heap_minors, iminor(inode)); in dma_heap_open()
72 if (!heap) { in dma_heap_open()
78 file->private_data = heap; in dma_heap_open()
87 struct dma_heap *heap = file->private_data; in dma_heap_ioctl_allocate() local
99 fd = dma_heap_buffer_alloc(heap, heap_allocation->len, in dma_heap_ioctl_allocate()
184 * dma_heap_get_drvdata() - get per-subdriver data for the heap
185 * @heap: DMA-Heap to retrieve private data for
188 * The per-subdriver data for the heap.
190 void *dma_heap_get_drvdata(struct dma_heap *heap) in dma_heap_get_drvdata() argument
192 return heap->priv; in dma_heap_get_drvdata()
196 * dma_heap_get_name() - get heap name
197 * @heap: DMA-Heap to retrieve private data for
200 * The char* for the heap name.
202 const char *dma_heap_get_name(struct dma_heap *heap) in dma_heap_get_name() argument
204 return heap->name; in dma_heap_get_name()
209 struct dma_heap *heap, *h, *err_ret; in dma_heap_add() local
215 pr_err("dma_heap: Cannot add heap without a name\n"); in dma_heap_add()
220 pr_err("dma_heap: Cannot add heap with invalid ops struct\n"); in dma_heap_add()
224 heap = kzalloc(sizeof(*heap), GFP_KERNEL); in dma_heap_add()
225 if (!heap) in dma_heap_add()
228 heap->name = exp_info->name; in dma_heap_add()
229 heap->ops = exp_info->ops; in dma_heap_add()
230 heap->priv = exp_info->priv; in dma_heap_add()
233 ret = xa_alloc(&dma_heap_minors, &minor, heap, in dma_heap_add()
236 pr_err("dma_heap: Unable to get minor number for heap\n"); in dma_heap_add()
242 heap->heap_devt = MKDEV(MAJOR(dma_heap_devt), minor); in dma_heap_add()
244 cdev_init(&heap->heap_cdev, &dma_heap_fops); in dma_heap_add()
245 ret = cdev_add(&heap->heap_cdev, heap->heap_devt, 1); in dma_heap_add()
254 heap->heap_devt, in dma_heap_add()
256 heap->name); in dma_heap_add()
268 pr_err("dma_heap: Already registered heap named %s\n", in dma_heap_add()
275 /* Add heap to the list */ in dma_heap_add()
276 list_add(&heap->list, &heap_list); in dma_heap_add()
279 return heap; in dma_heap_add()
282 device_destroy(dma_heap_class, heap->heap_devt); in dma_heap_add()
284 cdev_del(&heap->heap_cdev); in dma_heap_add()
288 kfree(heap); in dma_heap_add()