All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Scally <djrscally@gmail.com>
To: "Clément Léger" <clement.leger@bootlin.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] software node: fix wrong node passed to find nargs_prop
Date: Tue, 21 Dec 2021 22:08:42 +0000	[thread overview]
Message-ID: <36e29eb4-c3ab-af60-5106-04b289a87128@gmail.com> (raw)
In-Reply-To: <20211221104659.2f8af03a@fixe.home>

Hello

On 21/12/2021 09:46, Clément Léger wrote:
> 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.

Ok, in that case I think this is the right thing to do and you can have my:

Reviewed-by: Daniel Scally <djrscally@gmail.com>

Might be nice to transfer the function comment from
of_parse_phandle_with_args() to fwnode_property_get_reference_args(), as
that's nice and clear.

>>
>> 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.

You're right of course - sorry for the noise

>>
>>>     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
>>>
>>>   
> 
> 
> 

  reply	other threads:[~2021-12-21 22:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20 21:05 [PATCH] software node: fix wrong node passed to find nargs_prop Clément Léger
     [not found] ` <CAHp75Vf+F2L4EFmokRYD+-M9hSuz+SbiiWnqHvFZttRyfKS-mg@mail.gmail.com>
2021-12-20 23:37   ` Daniel Scally
2021-12-21  9:34     ` Greg Kroah-Hartman
2021-12-21  9:45       ` Sakari Ailus
2021-12-21 22:09         ` Daniel Scally
2021-12-22  9:34           ` Sakari Ailus
2021-12-21  9:46     ` Clément Léger
2021-12-21 22:08       ` Daniel Scally [this message]
2021-12-21 11:52 ` Sakari Ailus
2021-12-22 11:19 ` Heikki Krogerus
2021-12-22 17:27   ` Rafael J. Wysocki

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=36e29eb4-c3ab-af60-5106-04b289a87128@gmail.com \
    --to=djrscally@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=clement.leger@bootlin.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.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 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.