[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0heg9w=k1yqkECNo9XLP2hZny_WJQv4EJq_Wh0dVT137g@mail.gmail.com>
Date: Wed, 20 May 2020 12:34:06 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Subject: Re: [PATCH v1] drivers property: When no children in primary, try secondary
On Wed, May 20, 2020 at 12:30 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> Software firmware nodes can provide a child node to its parent.
> Since software node can be secondary, we need a mechanism to access
> the children. The idea is to list children of the primary node first
> and when they are finished, continue with secondary node if available.
Makes sense.
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Greg, do you want me to apply it?
If you'd rather take it yourself, please feel free to add
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
> drivers/base/property.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 5f35c0ccf5e0..1e6d75e65938 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -708,14 +708,23 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev,
> struct fwnode_handle *child)
> {
> struct acpi_device *adev = ACPI_COMPANION(dev);
> - struct fwnode_handle *fwnode = NULL;
> + struct fwnode_handle *fwnode = NULL, *next;
>
> if (dev->of_node)
> fwnode = &dev->of_node->fwnode;
> else if (adev)
> fwnode = acpi_fwnode_handle(adev);
>
> - return fwnode_get_next_child_node(fwnode, child);
> + /* 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 */
> + if (!IS_ERR_OR_NULL(fwnode->secondary))
> + next = fwnode_get_next_child_node(fwnode->secondary, child);
> +
> + return next;
> }
> EXPORT_SYMBOL_GPL(device_get_next_child_node);
>
> --
> 2.26.2
>
Powered by blists - more mailing lists