From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
Jonathan Cameron <jic23@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Daniel Scally <djrscally@gmail.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
netdev@vger.kernel.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH v8 02/10] property: Add functions to iterate named child
Date: Thu, 20 Mar 2025 08:43:44 +0200 [thread overview]
Message-ID: <726281b2-66f5-45e9-94f2-4f79b4ab159d@gmail.com> (raw)
In-Reply-To: <Z9rhfJUlCbi7kA2m@kekkonen.localdomain>
On 19/03/2025 17:23, Sakari Ailus wrote:
> On Wed, Mar 19, 2025 at 08:02:24AM +0200, Matti Vaittinen wrote:
>> On 18/03/2025 17:24, Sakari Ailus wrote:
>>> On Mon, Mar 17, 2025 at 05:50:38PM +0200, Matti Vaittinen wrote:
>>>> There are a few use-cases where child nodes with a specific name need to
>>>> be parsed. Code like:
...
>>>> --- a/include/linux/property.h
>>>> +++ b/include/linux/property.h
>>>> @@ -167,10 +167,18 @@ struct fwnode_handle *fwnode_get_next_available_child_node(
>>>> for (child = fwnode_get_next_child_node(fwnode, NULL); child; \
>>>> child = fwnode_get_next_child_node(fwnode, child))
>>>> +#define fwnode_for_each_named_child_node(fwnode, child, name) \
>>>> + fwnode_for_each_child_node(fwnode, child) \
>>>> + if (!fwnode_name_eq(child, name)) { } else
>>>> +
>>>> #define fwnode_for_each_available_child_node(fwnode, child) \
>>>> for (child = fwnode_get_next_available_child_node(fwnode, NULL); child;\
>>>> child = fwnode_get_next_available_child_node(fwnode, child))
>>>> +#define fwnode_for_each_available_named_child_node(fwnode, child, name) \
>>>> + fwnode_for_each_available_child_node(fwnode, child) \
>>>> + if (!fwnode_name_eq(child, name)) { } else
>>>> +
>>>
>>> OF only enumerates available nodes via the fwnode API, software nodes don't
>>> have the concept but on ACPI I guess you could have a difference in nodes
>>> where you have device sub-nodes that aren't available. Still, these ACPI
>>> device nodes don't have meaningful names in this context (they're
>>> 4-character object names) so you wouldn't use them like this anyway.
>>
>> I believe you have far better understanding on these concepts than I do. The
>> reason behind adding fwnode_for_each_available_child_node() was the patch
>> 10/10:
>>
>> - fwnode_for_each_available_child_node(sensors, node) {
>> - if (fwnode_name_eq(node, "sensor")) {
>> - if (!thp7312_sensor_parse_dt(thp7312, node))
>> - num_sensors++;
>> - }
>> + fwnode_for_each_available_named_child_node(sensors, node, "sensor") {
>> + if (!thp7312_sensor_parse_dt(thp7312, node))
>> + num_sensors++;
>> }
>>
>>
>>> So my question is: is it useful to provide this besides
>>> fwnode_for_each_named_child_node(), given that both are effectively the
>>> same?
>>
>> So, I suppose you're saying the existing thp7312 -driver has no real reason
>> to use the 'fwnode_for_each_available_child_node()', but it could be using
>> fwnode_for_each_child_node() instead?
>>
>> If so, I am Ok with dropping the
>> 'fwnode_for_each_available_named_child_node()' and changing the 10/10 to:
>>
>> - fwnode_for_each_available_child_node(sensors, node) {
>> - if (fwnode_name_eq(node, "sensor")) {
>> - if (!thp7312_sensor_parse_dt(thp7312, node))
>> - num_sensors++;
>> - }
>> + fwnode_for_each_named_child_node(sensors, node, "sensor") {
>> + if (!thp7312_sensor_parse_dt(thp7312, node))
>> + num_sensors++;
>> }
>>
>> Do you think that'd be correct?
>
> I'd say so. Feel free to cc me to the last patch as well.
Thanks. I'll drop the fwnode_for_each_available_named_child_node() then.
> I guess one way to make this clearer is to switch to
> fwnode_for_each_child_node() in a separate patch before
> fwnode_for_each_named_child_node() conversion.
I suppose this makes sense.
I think this series can't make it to 6.15-rc1. Meaning, these
*_named_*() APIs perhaps land in 6.16-rc1. I assume these *_named_*()
APIs will go through the IIO. This rather simple IIO driver's review
took longer than I predicted, with more versions I intended (as always)
- and I kind of dislike respinning the whole series, with this large
audience, when changes are not interesting to the most.
Maybe it is simplest to drop the thp7312 (and gianfar) from this series,
and respin them only when the 6.16-rc1 is out. It's going to be couple
of months though - so there's always a risk that I forget.
The proposed change for the thp7312, from
fwnode_for_each_available_child_node() to fwnode_for_each_child_node()
can be done earlier though.
> There are also just a handful of users of
> fwnode_for_each_available_child_node() and I guess these could be
> converted, too, but I think it's outside the scope of the set.
Definitely not in the scope of the bd79124 support :)
Yours,
-- Matti
next prev parent reply other threads:[~2025-03-20 6:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-17 15:49 [PATCH v8 00/10] Support ROHM BD79124 ADC Matti Vaittinen
2025-03-17 15:50 ` [PATCH v8 02/10] property: Add functions to iterate named child Matti Vaittinen
2025-03-18 15:24 ` Sakari Ailus
2025-03-19 6:02 ` Matti Vaittinen
2025-03-19 15:23 ` Sakari Ailus
2025-03-20 6:43 ` Matti Vaittinen [this message]
2025-03-30 16:07 ` Jonathan Cameron
2025-03-17 15:52 ` [PATCH net-next v8 09/10] net: gianfar: Use device_get_child_node_count_named() Matti Vaittinen
2025-03-19 16:07 ` Simon Horman
2025-03-20 6:12 ` Matti Vaittinen
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=726281b2-66f5-45e9-94f2-4f79b4ab159d@gmail.com \
--to=mazziesaccount@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=claudiu.manoil@nxp.com \
--cc=conor+dt@kernel.org \
--cc=dakr@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=djrscally@gmail.com \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rafael@kernel.org \
--cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).