All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@collabora.com>
To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org
Cc: Sumit Semwal <sumit.semwal@linaro.org>,
	"Andrew F . Davis" <afd@ti.com>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Liam Mark <lmark@codeaurora.org>,
	Laura Abbott <labbott@kernel.org>,
	Brian Starkey <Brian.Starkey@arm.com>,
	John Stultz <john.stultz@linaro.org>,
	Ezequiel Garcia <ezequiel@collabora.com>,
	kernel@collabora.com
Subject: [PATCH] dma-buf: heap-helpers: Set dma-buf exporter name
Date: Fri, 14 Aug 2020 11:25:16 -0300	[thread overview]
Message-ID: <20200814142516.148934-1-ezequiel@collabora.com> (raw)

Currently the heap helper uses DEFINE_DMA_BUF_EXPORT_INFO,
which uses KBUILD_MODNAME for the dma_buf_export_info.exp_name.

This effectively makes all dma-bufs exported by the heap
helper as coming from "heap-helpers", instead of the actual heap name
(cma, system, etc).

Fix this by adding a dma-heap name getter, and then setting
dma_buf_export_info.exp_name.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
 drivers/dma-buf/dma-heap.c           | 5 +++++
 drivers/dma-buf/heaps/heap-helpers.c | 1 +
 include/linux/dma-heap.h             | 2 ++
 3 files changed, 8 insertions(+)

diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
index afd22c9dbdcf..13d001ee381a 100644
--- a/drivers/dma-buf/dma-heap.c
+++ b/drivers/dma-buf/dma-heap.c
@@ -190,6 +190,11 @@ void *dma_heap_get_drvdata(struct dma_heap *heap)
 	return heap->priv;
 }
 
+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, *h, *err_ret;
diff --git a/drivers/dma-buf/heaps/heap-helpers.c b/drivers/dma-buf/heaps/heap-helpers.c
index 9f964ca3f59c..47ecf9518442 100644
--- a/drivers/dma-buf/heaps/heap-helpers.c
+++ b/drivers/dma-buf/heaps/heap-helpers.c
@@ -30,6 +30,7 @@ struct dma_buf *heap_helper_export_dmabuf(struct heap_helper_buffer *buffer,
 {
 	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
 
+	exp_info.exp_name = dma_heap_get_name(buffer->heap);
 	exp_info.ops = &heap_helper_ops;
 	exp_info.size = buffer->size;
 	exp_info.flags = fd_flags;
diff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h
index 454e354d1ffb..0acf7e71afb5 100644
--- a/include/linux/dma-heap.h
+++ b/include/linux/dma-heap.h
@@ -50,6 +50,8 @@ struct dma_heap_export_info {
  */
 void *dma_heap_get_drvdata(struct dma_heap *heap);
 
+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
-- 
2.27.0


WARNING: multiple messages have this Message-ID (diff)
From: Ezequiel Garcia <ezequiel@collabora.com>
To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org
Cc: kernel@collabora.com, Liam Mark <lmark@codeaurora.org>,
	Laura Abbott <labbott@kernel.org>,
	"Andrew F . Davis" <afd@ti.com>,
	Ezequiel Garcia <ezequiel@collabora.com>
Subject: [PATCH] dma-buf: heap-helpers: Set dma-buf exporter name
Date: Fri, 14 Aug 2020 11:25:16 -0300	[thread overview]
Message-ID: <20200814142516.148934-1-ezequiel@collabora.com> (raw)

Currently the heap helper uses DEFINE_DMA_BUF_EXPORT_INFO,
which uses KBUILD_MODNAME for the dma_buf_export_info.exp_name.

This effectively makes all dma-bufs exported by the heap
helper as coming from "heap-helpers", instead of the actual heap name
(cma, system, etc).

Fix this by adding a dma-heap name getter, and then setting
dma_buf_export_info.exp_name.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
 drivers/dma-buf/dma-heap.c           | 5 +++++
 drivers/dma-buf/heaps/heap-helpers.c | 1 +
 include/linux/dma-heap.h             | 2 ++
 3 files changed, 8 insertions(+)

diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
index afd22c9dbdcf..13d001ee381a 100644
--- a/drivers/dma-buf/dma-heap.c
+++ b/drivers/dma-buf/dma-heap.c
@@ -190,6 +190,11 @@ void *dma_heap_get_drvdata(struct dma_heap *heap)
 	return heap->priv;
 }
 
+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, *h, *err_ret;
diff --git a/drivers/dma-buf/heaps/heap-helpers.c b/drivers/dma-buf/heaps/heap-helpers.c
index 9f964ca3f59c..47ecf9518442 100644
--- a/drivers/dma-buf/heaps/heap-helpers.c
+++ b/drivers/dma-buf/heaps/heap-helpers.c
@@ -30,6 +30,7 @@ struct dma_buf *heap_helper_export_dmabuf(struct heap_helper_buffer *buffer,
 {
 	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
 
+	exp_info.exp_name = dma_heap_get_name(buffer->heap);
 	exp_info.ops = &heap_helper_ops;
 	exp_info.size = buffer->size;
 	exp_info.flags = fd_flags;
diff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h
index 454e354d1ffb..0acf7e71afb5 100644
--- a/include/linux/dma-heap.h
+++ b/include/linux/dma-heap.h
@@ -50,6 +50,8 @@ struct dma_heap_export_info {
  */
 void *dma_heap_get_drvdata(struct dma_heap *heap);
 
+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
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2020-08-14 14:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 14:25 Ezequiel Garcia [this message]
2020-08-14 14:25 ` [PATCH] dma-buf: heap-helpers: Set dma-buf exporter name Ezequiel Garcia
2020-08-15  2:19 ` John Stultz
2020-08-15  2:19   ` John Stultz
2020-08-15  3:04   ` Ezequiel Garcia
2020-08-15  3:04     ` Ezequiel Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200814142516.148934-1-ezequiel@collabora.com \
    --to=ezequiel@collabora.com \
    --cc=Brian.Starkey@arm.com \
    --cc=afd@ti.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=john.stultz@linaro.org \
    --cc=kernel@collabora.com \
    --cc=labbott@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lmark@codeaurora.org \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.