Re: [PATCH 5/9] of: property: implement the .property_get_names() fwnode operation
From: Andy Shevchenko
Date: Tue Nov 10 2026 - 04:53:46 EST
On Tue, Nov 10, 2026 at 11:00 AM Bartosz Golaszewski <brgl@xxxxxxxxxx> wrote:
> On Mon, Nov 09, 2026 at 07:28:33PM +0200, Andy Shevchenko wrote:
> > On Mon, Nov 09, 2026 at 02:07:46PM +0100, Bartosz Golaszewski wrote:
> > > On Wed, Nov 04, 2026 at 11:21:15PM +0200, Andy Shevchenko wrote:
> > > > On Wed, Nov 04, 2026 at 03:03:47PM +0100, Bartosz Golaszewski wrote:
...
> > > > > + names[i] = kstrdup(prop->name, GFP_KERNEL);
> > > >
> > > > Can property be statically defined somewhere? We might want to also optimize
> > > > these duplications with const variant (here or elsewhere, for fwnode generic
> > > > path, I believe).
> > >
> > > Please rephrase because I'm not quite following what you're saying.
> >
> > Can prop->name come from something that is declared as
> >
> > static const ... foo = {
> > ... .name = "bar";
> > };
>
> You can't know it for every instance of struct fwnode_handle, so the
> answer is: no.
I believe I misput my question. If there is any potential that *some*
of fwnodes use statically defined string literals for the property
name? If so, kstrdup_const() and friends may be a better choice here
to save some memory (which is getting more and more expensive these
days :-).
> PS: is there a way of using match_string() with non-const data?
Why? It's an input parameter, it returns an index. Whatever you
provide will be not modified.
--
With Best Regards,
Andy Shevchenko