From e09764eb7da7fe2c5d52153c97aa262c217fb9a4 Mon Sep 17 00:00:00 2001 From: John Stultz Date: Sat, 6 Feb 2021 05:28:51 +0000 Subject: [PATCH] BACKPORT: FROMLIST: dma-buf: dma-heap: Provide accessor to get heap name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It can be useful to access the name for the heap, so provide an accessor to do so. Cc: Daniel Vetter Cc: Sumit Semwal Cc: Liam Mark Cc: Chris Goldsworthy Cc: Laura Abbott Cc: Brian Starkey Cc: Hridya Valsaraju Cc: Suren Baghdasaryan Cc: Sandeep Patil Cc: Daniel Mentz Cc: Ørjan Eide Cc: Robin Murphy Cc: Ezequiel Garcia Cc: Simon Ser Cc: James Jones Cc: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz [jstultz: Minor collision resolution w/ conflict in common.git] Link: https://lore.kernel.org/lkml/20210209194818.2459062-1-john.stultz@linaro.org/ Bug: 167709539 Change-Id: I3d2126118336077ab1caa2b9312c94cb146dd194 --- drivers/dma-buf/dma-heap.c | 12 ++++++++++++ include/linux/dma-heap.h | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c index 4627d4495228..d8b797458b69 100644 --- a/drivers/dma-buf/dma-heap.c +++ b/drivers/dma-buf/dma-heap.c @@ -280,6 +280,18 @@ struct device *dma_heap_get_dev(struct dma_heap *heap) } EXPORT_SYMBOL_GPL(dma_heap_get_dev); +/** + * dma_heap_get_name() - get heap name + * @heap: DMA-Heap to retrieve private data for + * + * Returns: + * The char* for the heap name. + */ +const char *dma_heap_get_name(struct dma_heap *heap) +{ + return heap->name; +} + struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info) { struct dma_heap *heap, *err_ret; diff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h index cfd47a6b2b49..e8f0e92c27dd 100644 --- a/include/linux/dma-heap.h +++ b/include/linux/dma-heap.h @@ -61,6 +61,15 @@ void *dma_heap_get_drvdata(struct dma_heap *heap); */ struct device *dma_heap_get_dev(struct dma_heap *heap); +/** + * dma_heap_get_name() - get heap name + * @heap: DMA-Heap to retrieve private data for + * + * Returns: + * The char* for the heap name. + */ +const char *dma_heap_get_name(struct dma_heap *heap); + /** * dma_heap_add - adds a heap to dmabuf heaps * @exp_info: information needed to register this heap