Re: [PATCH v6 2/5] device property: Introduce fwnode_for_each_parent_node()

From: Doug Anderson
Date: Fri Apr 29 2022 - 19:48:05 EST


Hi,

On Fri, Apr 8, 2022 at 11:50 AM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> In a few cases the functionality of fwnode_for_each_parent_node()
> is already in use. Introduce a common helper macro for it.
>
> It may be used by others as well in the future.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> Reviewed-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
> ---
> v6: added tag (Sakari)
> drivers/base/property.c | 56 +++++++++++++++++++++-------------------
> include/linux/property.h | 9 +++++--
> 2 files changed, 36 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 6ecc1398b0ba..f0ac31d28798 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -596,17 +596,17 @@ EXPORT_SYMBOL_GPL(fwnode_get_next_parent);
> */
> struct device *fwnode_get_next_parent_dev(struct fwnode_handle *fwnode)
> {
> + struct fwnode_handle *parent;
> struct device *dev;
>
> - fwnode_handle_get(fwnode);
> - do {
> - fwnode = fwnode_get_next_parent(fwnode);
> - if (!fwnode)
> - return NULL;
> + fwnode_for_each_parent_node(fwnode, parent) {
> dev = get_dev_from_fwnode(fwnode);

Breadcrumbs in case anyone else ends up at this patch due to a bisect,
like I just did. The above should have been changed to
"get_dev_from_fwnode(parent);" in this patch. Fix posted at:

https://lore.kernel.org/r/20220429164325.1.I2a3b980ea051e59140227999f0f0ca16f1125768@changeid