From: Maxime Ripard <mripard@kernel.org>
To: "Christian König" <christian.koenig@amd.com>
Cc: Rob Herring <robh@kernel.org>,
Saravana Kannan <saravanak@google.com>,
Sumit Semwal <sumit.semwal@linaro.org>,
Benjamin Gaignard <benjamin.gaignard@collabora.com>,
Brian Starkey <Brian.Starkey@arm.com>,
John Stultz <jstultz@google.com>,
"T.J. Mercier" <tjmercier@google.com>,
Mattijs Korpershoek <mkorpershoek@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH v2 1/2] dma-buf: heaps: system: Remove global variable
Date: Thu, 3 Apr 2025 09:04:28 +0200 [thread overview]
Message-ID: <20250403-elated-cinnamon-tortoise-7b6cb8@houat> (raw)
In-Reply-To: <e268d75d-c75a-499e-872d-09f91defed6b@amd.com>
[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]
On Tue, Apr 01, 2025 at 05:28:43PM +0200, Christian König wrote:
>
>
> Am 01.04.25 um 17:12 schrieb Maxime Ripard:
> > The system heap has been using its struct dma_heap pointer but wasn't
> > using it anywhere.
> >
> > Since we'll need additional parameters to attach to that heap type,
> > let's create a private structure and set it as the dma_heap drvdata,
> > removing the global variable in the process.
> >
> > Signed-off-by: Maxime Ripard <mripard@kernel.org>
> > ---
> > drivers/dma-buf/heaps/system_heap.c | 17 ++++++++++++-----
> > 1 file changed, 12 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
> > index 26d5dc89ea1663a0d078e3a5723ca3d8d12b935f..adf422eaa33a52794f952d9d4260b8743d37f421 100644
> > --- a/drivers/dma-buf/heaps/system_heap.c
> > +++ b/drivers/dma-buf/heaps/system_heap.c
> > @@ -19,11 +19,13 @@
> > #include <linux/module.h>
> > #include <linux/scatterlist.h>
> > #include <linux/slab.h>
> > #include <linux/vmalloc.h>
> >
> > -static struct dma_heap *sys_heap;
> > +struct system_heap {
> > + struct dma_heap *heap;
> > +};
> >
> > struct system_heap_buffer {
> > struct dma_heap *heap;
> > struct list_head attachments;
> > struct mutex lock;
> > @@ -422,17 +424,22 @@ static const struct dma_heap_ops system_heap_ops = {
> > };
> >
> > static int __init system_heap_create(void)
> > {
> > struct dma_heap_export_info exp_info;
> > + struct system_heap *sys_heap;
> > +
> > + sys_heap = kzalloc(sizeof(*sys_heap), GFP_KERNEL);
> > + if (!sys_heap)
> > + return -ENOMEM;
> >
> > exp_info.name = "system";
> > exp_info.ops = &system_heap_ops;
> > - exp_info.priv = NULL;
> > + exp_info.priv = sys_heap;
>
> Why do you even need this?
Urgh, sorry. I'm not even sure how I ended up with that patch, but
you're correct. I'll send a much simpler version.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-04-03 7:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 15:12 [PATCH v2 0/2] dma-buf: heaps: Support carved-out heaps Maxime Ripard
2025-04-01 15:12 ` [PATCH v2 1/2] dma-buf: heaps: system: Remove global variable Maxime Ripard
2025-04-01 15:28 ` Christian König
2025-04-03 7:04 ` Maxime Ripard [this message]
2025-04-01 15:12 ` [PATCH v2 2/2] dma-buf: heaps: Introduce a new heap for reserved memory Maxime Ripard
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=20250403-elated-cinnamon-tortoise-7b6cb8@houat \
--to=mripard@kernel.org \
--cc=Brian.Starkey@arm.com \
--cc=benjamin.gaignard@collabora.com \
--cc=christian.koenig@amd.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jstultz@google.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mkorpershoek@kernel.org \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
--cc=sumit.semwal@linaro.org \
--cc=tjmercier@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®