[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250521-curious-dolphin-of-perspective-4cc8c2@houat>
Date: Wed, 21 May 2025 17:29:40 +0200
From: Maxime Ripard <mripard@...nel.org>
To: Jared Kangas <jkangas@...hat.com>
Cc: sumit.semwal@...aro.org, benjamin.gaignard@...labora.com,
Brian.Starkey@....com, jstultz@...gle.com, tjmercier@...gle.com,
christian.koenig@....com, linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linaro-mm-sig@...ts.linaro.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] dma-buf: heaps: Give default CMA heap a fixed name
Hi Jared,
On Thu, Apr 24, 2025 at 09:11:24AM -0700, Jared Kangas wrote:
> > > struct cma_heap {
> > > struct dma_heap *heap;
> > > @@ -394,15 +395,26 @@ static int __init __add_cma_heap(struct cma *cma, const char *name)
> > > static int __init add_default_cma_heap(void)
> > > {
> > > struct cma *default_cma = dev_get_cma_area(NULL);
> > > + const char *legacy_cma_name;
> > > int ret;
> > >
> > > if (!default_cma)
> > > return 0;
> > >
> > > - ret = __add_cma_heap(default_cma, cma_get_name(default_cma));
> > > + ret = __add_cma_heap(default_cma, DEFAULT_CMA_NAME);
> > > if (ret)
> > > return ret;
> > >
> > > + legacy_cma_name = cma_get_name(default_cma);
> > > +
> > > + if (IS_ENABLED(CONFIG_DMABUF_HEAPS_CMA_LEGACY) &&
> > > + strcmp(legacy_cma_name, DEFAULT_CMA_NAME)) {
> > > + ret = __add_cma_heap(default_cma, legacy_cma_name);
> > > + if (ret)
> > > + pr_warn("cma_heap: failed to add legacy heap: %pe\n",
> > > + ERR_PTR(-ret));
> > > + }
> > > +
> >
> > It would also simplify this part, since you would always create the legacy heap.
>
> By "always", do you mean removing the strcmp? I added this to guard
> against cases where the devicetree node's name clashed with the default
> name, given that the DT name isn't necessarily restricted to one of the
> current names in use ("linux,cma" or "default-pool"). It seems like the
> strcmp would be relevant regardless of the naming choice, but if this is
> overly cautious, I can remove it in v3.
That's not overly cautious, that's something I overlooked :)
You're totally right that we should check for that. We should probably
add a more specific error message in that case though
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (274 bytes)
Powered by blists - more mailing lists