diff mbox series

[v1,1/4] device property: Split fwnode_get_child_node_count()

Message ID 20250310150835.3139322-2-andriy.shevchenko@linux.intel.com
State New
Headers show
Series leds: Introduce and use fwnode_get_child_node_count() | expand

Commit Message

Andy Shevchenko March 10, 2025, 2:54 p.m. UTC
The new helper is introduced to allow counting the child firmware nodes
of their parent without requiring a device to be passed. This also makes
the fwnode and device property API more symmetrical with the rest.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/property.c  | 12 ++++++------
 include/linux/property.h |  7 ++++++-
 2 files changed, 12 insertions(+), 7 deletions(-)

Comments

Jonathan Cameron March 11, 2025, 9:51 a.m. UTC | #1
On Mon, 10 Mar 2025 16:54:51 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> The new helper is introduced to allow counting the child firmware nodes
> of their parent without requiring a device to be passed. This also makes
> the fwnode and device property API more symmetrical with the rest.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Markus Elfring March 11, 2025, noon UTC | #2
> The new helper is introduced to allow counting the child firmware nodes
> of their parent without requiring a device to be passed. …

See also:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14-rc6#n94

Regards,
Markus
Greg Kroah-Hartman March 11, 2025, 12:05 p.m. UTC | #3
On Tue, Mar 11, 2025 at 01:00:16PM +0100, Markus Elfring wrote:
> > The new helper is introduced to allow counting the child firmware nodes
> > of their parent without requiring a device to be passed. …
> 
> See also:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14-rc6#n94
> 
> Regards,
> Markus
> 

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot
Heikki Krogerus March 12, 2025, 11:36 a.m. UTC | #4
On Mon, Mar 10, 2025 at 04:54:51PM +0200, Andy Shevchenko wrote:
> The new helper is introduced to allow counting the child firmware nodes
> of their parent without requiring a device to be passed. This also makes
> the fwnode and device property API more symmetrical with the rest.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/base/property.c  | 12 ++++++------
>  include/linux/property.h |  7 ++++++-
>  2 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index c1392743df9c..805f75b35115 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -928,22 +928,22 @@ bool fwnode_device_is_available(const struct fwnode_handle *fwnode)
>  EXPORT_SYMBOL_GPL(fwnode_device_is_available);
>  
>  /**
> - * device_get_child_node_count - return the number of child nodes for device
> - * @dev: Device to count the child nodes for
> + * fwnode_get_child_node_count - return the number of child nodes for a given firmware node
> + * @fwnode: Pointer to the parent firmware node
>   *
> - * Return: the number of child nodes for a given device.
> + * Return: the number of child nodes for a given firmware node.
>   */
> -unsigned int device_get_child_node_count(const struct device *dev)
> +unsigned int fwnode_get_child_node_count(const struct fwnode_handle *fwnode)
>  {
>  	struct fwnode_handle *child;
>  	unsigned int count = 0;
>  
> -	device_for_each_child_node(dev, child)
> +	fwnode_for_each_child_node(fwnode, child)
>  		count++;
>  
>  	return count;
>  }
> -EXPORT_SYMBOL_GPL(device_get_child_node_count);
> +EXPORT_SYMBOL_GPL(fwnode_get_child_node_count);
>  
>  bool device_dma_supported(const struct device *dev)
>  {
> diff --git a/include/linux/property.h b/include/linux/property.h
> index e214ecd241eb..bc5bfc98176b 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -208,7 +208,12 @@ DEFINE_FREE(fwnode_handle, struct fwnode_handle *, fwnode_handle_put(_T))
>  int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index);
>  int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name);
>  
> -unsigned int device_get_child_node_count(const struct device *dev);
> +unsigned int fwnode_get_child_node_count(const struct fwnode_handle *fwnode);
> +
> +static inline unsigned int device_get_child_node_count(const struct device *dev)
> +{
> +	return fwnode_get_child_node_count(dev_fwnode(dev));
> +}
>  
>  static inline int device_property_read_u8(const struct device *dev,
>  					  const char *propname, u8 *val)
> -- 
> 2.47.2
diff mbox series

Patch

diff --git a/drivers/base/property.c b/drivers/base/property.c
index c1392743df9c..805f75b35115 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -928,22 +928,22 @@  bool fwnode_device_is_available(const struct fwnode_handle *fwnode)
 EXPORT_SYMBOL_GPL(fwnode_device_is_available);
 
 /**
- * device_get_child_node_count - return the number of child nodes for device
- * @dev: Device to count the child nodes for
+ * fwnode_get_child_node_count - return the number of child nodes for a given firmware node
+ * @fwnode: Pointer to the parent firmware node
  *
- * Return: the number of child nodes for a given device.
+ * Return: the number of child nodes for a given firmware node.
  */
-unsigned int device_get_child_node_count(const struct device *dev)
+unsigned int fwnode_get_child_node_count(const struct fwnode_handle *fwnode)
 {
 	struct fwnode_handle *child;
 	unsigned int count = 0;
 
-	device_for_each_child_node(dev, child)
+	fwnode_for_each_child_node(fwnode, child)
 		count++;
 
 	return count;
 }
-EXPORT_SYMBOL_GPL(device_get_child_node_count);
+EXPORT_SYMBOL_GPL(fwnode_get_child_node_count);
 
 bool device_dma_supported(const struct device *dev)
 {
diff --git a/include/linux/property.h b/include/linux/property.h
index e214ecd241eb..bc5bfc98176b 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -208,7 +208,12 @@  DEFINE_FREE(fwnode_handle, struct fwnode_handle *, fwnode_handle_put(_T))
 int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index);
 int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name);
 
-unsigned int device_get_child_node_count(const struct device *dev);
+unsigned int fwnode_get_child_node_count(const struct fwnode_handle *fwnode);
+
+static inline unsigned int device_get_child_node_count(const struct device *dev)
+{
+	return fwnode_get_child_node_count(dev_fwnode(dev));
+}
 
 static inline int device_property_read_u8(const struct device *dev,
 					  const char *propname, u8 *val)