lkml.org 
[lkml]   [2021]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] software node: fix wrong node passed to find nargs_prop
Le Mon, 20 Dec 2021 23:37:07 +0000,
Daniel Scally <djrscally@gmail.com> a écrit :

> Thanks Andy
>
> On 20/12/2021 22:13, Andy Shevchenko wrote:
> [...]
>
> I think this is right (it's not used in the ACPI version, and the OF
> version is quite convoluted so a bit hard to follow)...but also I note
> that none of the users of fwnode_property_get_reference_args() pass
> anything to nargs_prop anyway...do we even need this?

Indeed, this is currently not used anywhere, nargs is always used
instead of nargs_prop. The usage is meant to be (almost) the same as
of_parse_phandle_with_args().

ie:

ret = of_parse_phandle_with_args(node, "resets", "#reset-cells",
index, &args);

can be replaced by:

ret = fwnode_property_get_reference_args(node, "resets",
"#reset-cells", 0 index,
&args);

I have some patches that uses that with software nodes and that will
need this support.

>
> Use the correct reference node in call to
> > property_entry_read_int_array() to retrieve the correct nargs value.
> >
> > Fixes: b06184acf751 ("software node: Add
> > software_node_get_reference_args()")
>
> I think this might have been introduced later...maybe 996b0830f95d1,
> maybe e933bedd45099

From what I saw, it was already in the original commit adding this but
I can be wrong.

>
> > Signed-off-by: Clément Léger <clement.leger@bootlin.com
> > <mailto:clement.leger@bootlin.com>>
> > ---
> >  drivers/base/swnode.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
> > index 4debcea4fb12..0a482212c7e8 100644
> > --- a/drivers/base/swnode.c
> > +++ b/drivers/base/swnode.c
> > @@ -529,7 +529,7 @@ software_node_get_reference_args(const struct
> > fwnode_handle *fwnode,
> >                 return -ENOENT;
> >
> >         if (nargs_prop) {
> > -               error =
> > property_entry_read_int_array(swnode->node->properties,
> > +               error =
> > property_entry_read_int_array(ref->node->properties,
> >                                                       nargs_prop,
> > sizeof(u32),
> >                                                      
> > &nargs_prop_val, 1);
> >                 if (error)
> > --
> > 2.34.1
> >
> >
> >
> > --
> > With Best Regards,
> > Andy Shevchenko
> >
> >



--
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

\
 
 \ /
  Last update: 2021-12-21 10:47    [W:1.455 / U:0.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site