[PATCH v2 15/16] property: Drop functions operating on "available" child nodes

Sakari Ailus posted 16 patches 1 week ago
[PATCH v2 15/16] property: Drop functions operating on "available" child nodes
Posted by Sakari Ailus 1 week ago
fwnode_get_next_available_child_node() and later
fwnode_for_each_available_child_node() were introduced to mirror the OF
interface operating on OF nodes. Now that these two are functionally the
same as the variants without "_available" part, drop the "_available"
variants.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/base/property.c  | 30 +-----------------------------
 include/linux/property.h |  6 ------
 2 files changed, 1 insertion(+), 35 deletions(-)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index ff440456af7b..75c3283fb5ca 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -802,35 +802,7 @@ fwnode_get_next_child_node(const struct fwnode_handle *fwnode,
 EXPORT_SYMBOL_GPL(fwnode_get_next_child_node);
 
 /**
- * fwnode_get_next_available_child_node - Return the next available child node handle for a node
- * @fwnode: Firmware node to find the next child node for.
- * @child: Handle to one of the node's child nodes or a %NULL handle.
- *
- * The caller is responsible for calling fwnode_handle_put() on the returned
- * fwnode pointer. Note that this function also puts a reference to @child
- * unconditionally.
- */
-struct fwnode_handle *
-fwnode_get_next_available_child_node(const struct fwnode_handle *fwnode,
-				     struct fwnode_handle *child)
-{
-	struct fwnode_handle *next_child = child;
-
-	if (IS_ERR_OR_NULL(fwnode))
-		return NULL;
-
-	do {
-		next_child = fwnode_get_next_child_node(fwnode, next_child);
-		if (!next_child)
-			return NULL;
-	} while (!fwnode_device_is_available(next_child));
-
-	return next_child;
-}
-EXPORT_SYMBOL_GPL(fwnode_get_next_available_child_node);
-
-/**
- * device_get_next_child_node - Return the next available child node handle for a device
+ * device_get_next_child_node - Return the next available child node handle
  * @dev: Device to find the next child node for.
  * @child: Handle to one of the device's child nodes or a %NULL handle.
  *
diff --git a/include/linux/property.h b/include/linux/property.h
index 8b8bbbe6b5b7..da6202053862 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -161,8 +161,6 @@ struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwn,
 					    unsigned int depth);
 struct fwnode_handle *fwnode_get_next_child_node(
 	const struct fwnode_handle *fwnode, struct fwnode_handle *child);
-struct fwnode_handle *fwnode_get_next_available_child_node(
-	const struct fwnode_handle *fwnode, struct fwnode_handle *child);
 
 #define fwnode_for_each_child_node(fwnode, child)			\
 	for (child = fwnode_get_next_child_node(fwnode, NULL); child;	\
@@ -172,10 +170,6 @@ struct fwnode_handle *fwnode_get_next_available_child_node(
 	fwnode_for_each_child_node(fwnode, child)			\
 		for_each_if(fwnode_name_eq(child, name))
 
-#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))
-
 struct fwnode_handle *device_get_next_child_node(const struct device *dev,
 						 struct fwnode_handle *child);
 
-- 
2.47.3
Re: [PATCH v2 15/16] property: Drop functions operating on "available" child nodes
Posted by Laurent Pinchart 1 week ago
Hi Sakari,

Thank you for the patch.

On Wed, Sep 24, 2025 at 10:46:01AM +0300, Sakari Ailus wrote:
> fwnode_get_next_available_child_node() and later
> fwnode_for_each_available_child_node() were introduced to mirror the OF
> interface operating on OF nodes. Now that these two are functionally the
> same as the variants without "_available" part, drop the "_available"
> variants.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/base/property.c  | 30 +-----------------------------
>  include/linux/property.h |  6 ------
>  2 files changed, 1 insertion(+), 35 deletions(-)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index ff440456af7b..75c3283fb5ca 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -802,35 +802,7 @@ fwnode_get_next_child_node(const struct fwnode_handle *fwnode,
>  EXPORT_SYMBOL_GPL(fwnode_get_next_child_node);
>  
>  /**
> - * fwnode_get_next_available_child_node - Return the next available child node handle for a node
> - * @fwnode: Firmware node to find the next child node for.
> - * @child: Handle to one of the node's child nodes or a %NULL handle.
> - *
> - * The caller is responsible for calling fwnode_handle_put() on the returned
> - * fwnode pointer. Note that this function also puts a reference to @child
> - * unconditionally.
> - */
> -struct fwnode_handle *
> -fwnode_get_next_available_child_node(const struct fwnode_handle *fwnode,
> -				     struct fwnode_handle *child)
> -{
> -	struct fwnode_handle *next_child = child;
> -
> -	if (IS_ERR_OR_NULL(fwnode))
> -		return NULL;
> -
> -	do {
> -		next_child = fwnode_get_next_child_node(fwnode, next_child);
> -		if (!next_child)
> -			return NULL;
> -	} while (!fwnode_device_is_available(next_child));
> -
> -	return next_child;
> -}
> -EXPORT_SYMBOL_GPL(fwnode_get_next_available_child_node);
> -
> -/**
> - * device_get_next_child_node - Return the next available child node handle for a device
> + * device_get_next_child_node - Return the next available child node handle

This last line is an unrelated change. With that fixed,

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

>   * @dev: Device to find the next child node for.
>   * @child: Handle to one of the device's child nodes or a %NULL handle.
>   *
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 8b8bbbe6b5b7..da6202053862 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -161,8 +161,6 @@ struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwn,
>  					    unsigned int depth);
>  struct fwnode_handle *fwnode_get_next_child_node(
>  	const struct fwnode_handle *fwnode, struct fwnode_handle *child);
> -struct fwnode_handle *fwnode_get_next_available_child_node(
> -	const struct fwnode_handle *fwnode, struct fwnode_handle *child);
>  
>  #define fwnode_for_each_child_node(fwnode, child)			\
>  	for (child = fwnode_get_next_child_node(fwnode, NULL); child;	\
> @@ -172,10 +170,6 @@ struct fwnode_handle *fwnode_get_next_available_child_node(
>  	fwnode_for_each_child_node(fwnode, child)			\
>  		for_each_if(fwnode_name_eq(child, name))
>  
> -#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))
> -
>  struct fwnode_handle *device_get_next_child_node(const struct device *dev,
>  						 struct fwnode_handle *child);
>  

-- 
Regards,

Laurent Pinchart
Re: [PATCH v2 15/16] property: Drop functions operating on "available" child nodes
Posted by Jonathan Cameron 2 days, 16 hours ago
> > -/**
> > - * device_get_next_child_node - Return the next available child node handle for a device
> > + * device_get_next_child_node - Return the next available child node handle  
> 
> This last line is an unrelated change. With that fixed,
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

I'll assume you'll tidy that up.

Very pleased to see this go, simply for the saving in time explaining the odd difference
to people in driver reviews!

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>