public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	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>,
	stable@vger.kernel.org
Subject: Re: [PATCH v1 1/1] device property: Allow secondary lookup in fwnode_get_next_child_node()
Date: Wed, 11 Feb 2026 00:02:57 +0200	[thread overview]
Message-ID: <aYurEV6kKQfI3cs8@kekkonen.localdomain> (raw)
In-Reply-To: <20260210135822.47335-1-andriy.shevchenko@linux.intel.com>

Hi Andy,

Thanks for the patch.

On Tue, Feb 10, 2026 at 02:58:22PM +0100, Andy Shevchenko wrote:
> When device_get_child_node_count() got split to the fwnode and device
> respective APIs, the fwnode didn't inherit the ability to traverse over
> the secondary fwnode. Hence any user, that switches from device to fwnode
> API misses this feature. In particular, this was revealed by the commit
> 1490cbb9dbfd ("device property: Split fwnode_get_child_node_count()")
> that effectively broke the GPIO enumeration on Intel Galileo boards.
> Fix this by moving the secondary lookup from device to fwnode API.
> 
> Note, in general no device_*() API should go into the depth of the fwnode
> implementation.
> 
> Fixes: 114dbb4fa7c4 ("drivers property: When no children in primary, try secondary")
> Cc: stable@vger.kernel.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/base/property.c | 27 +++++++++++++--------------
>  1 file changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 6a63860579dd..8d9a34be57fb 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -797,7 +797,18 @@ struct fwnode_handle *
>  fwnode_get_next_child_node(const struct fwnode_handle *fwnode,
>  			   struct fwnode_handle *child)
>  {
> -	return fwnode_call_ptr_op(fwnode, get_next_child_node, child);
> +	struct fwnode_handle *next;
> +
> +	if (IS_ERR_OR_NULL(fwnode))
> +		return NULL;

This test is already being done by fwnode_call_ptr_op() (via
fwnode_has_op()) so I'd omit it here. That would probably be best put in
another patch though. Up to you.

> +
> +	/* Try to find a child in primary fwnode */
> +	next = fwnode_call_ptr_op(fwnode, get_next_child_node, child);
> +	if (next)
> +		return next;
> +
> +	/* When no more children in primary, continue with secondary */
> +	return fwnode_call_ptr_op(fwnode->secondary, get_next_child_node, child);
>  }
>  EXPORT_SYMBOL_GPL(fwnode_get_next_child_node);
>  
> @@ -841,19 +852,7 @@ EXPORT_SYMBOL_GPL(fwnode_get_next_available_child_node);
>  struct fwnode_handle *device_get_next_child_node(const struct device *dev,
>  						 struct fwnode_handle *child)
>  {
> -	const struct fwnode_handle *fwnode = dev_fwnode(dev);
> -	struct fwnode_handle *next;
> -
> -	if (IS_ERR_OR_NULL(fwnode))
> -		return NULL;
> -
> -	/* Try to find a child in primary fwnode */
> -	next = fwnode_get_next_child_node(fwnode, child);
> -	if (next)
> -		return next;
> -
> -	/* When no more children in primary, continue with secondary */
> -	return fwnode_get_next_child_node(fwnode->secondary, child);
> +	return fwnode_get_next_child_node(dev_fwnode(dev), child);

As the function becomes trivial, I'd move it to property.h.

>  }
>  EXPORT_SYMBOL_GPL(device_get_next_child_node);
>  

-- 
Kind regards,

Sakari Ailus

  reply	other threads:[~2026-02-10 22:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10 13:58 [PATCH v1 1/1] device property: Allow secondary lookup in fwnode_get_next_child_node() Andy Shevchenko
2026-02-10 22:02 ` Sakari Ailus [this message]
2026-02-11  8:14   ` Andy Shevchenko
2026-02-11  8:27     ` Sakari Ailus
2026-02-11  8:33       ` Andy Shevchenko
2026-02-22 23:19 ` Danilo Krummrich

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=aYurEV6kKQfI3cs8@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dakr@kernel.org \
    --cc=djrscally@gmail.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=stable@vger.kernel.org \
    /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