linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count()
@ 2025-03-10 14:54 Andy Shevchenko
  2025-03-10 14:54 ` [PATCH v1 1/4] device property: Split fwnode_get_child_node_count() Andy Shevchenko
                   ` (8 more replies)
  0 siblings, 9 replies; 24+ messages in thread
From: Andy Shevchenko @ 2025-03-10 14:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Andy Shevchenko, Heikki Krogerus, Jonathan Cameron,
	linux-acpi, linux-kernel, linux-leds, linux-usb
  Cc: Daniel Scally, Sakari Ailus, Rafael J. Wysocki, Danilo Krummrich,
	Lee Jones, Pavel Machek, Matti Vaittinen, Jonathan Cameron

This series was inspired during review of "Support ROHM BD79124 ADC" [1].
The three conversion patches are the examples of the new API in use.

Since the first two examples of LEDS, in case of posotove response it may
be routed via that tree and immutable branch/tag shared with others, e.g.,
IIO which Matti's series is targeting and might be dependent on. The USB
patch can be applied later separately, up to the respective maintainers.

Link: https://lore.kernel.org/r/cover.1741610847.git.mazziesaccount@gmail.com> [1]

Andy Shevchenko (4):
  device property: Split fwnode_get_child_node_count()
  leds: pwm-multicolor: Use fwnode_get_child_node_count()
  leds: ncp5623: Use fwnode_get_child_node_count()
  usb: typec: tcpm: Use fwnode_get_child_node_count()

 drivers/base/property.c                | 12 ++++++------
 drivers/leds/rgb/leds-ncp5623.c        |  5 ++---
 drivers/leds/rgb/leds-pwm-multicolor.c |  7 +++----
 drivers/usb/typec/tcpm/tcpm.c          |  6 ++----
 include/linux/property.h               |  7 ++++++-
 5 files changed, 19 insertions(+), 18 deletions(-)

-- 
2.47.2


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH v1 1/4] device property: Split fwnode_get_child_node_count()
  2025-03-10 14:54 [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Andy Shevchenko
@ 2025-03-10 14:54 ` Andy Shevchenko
  2025-03-11  9:51   ` Jonathan Cameron
                     ` (4 more replies)
  2025-03-10 14:54 ` [PATCH v1 2/4] leds: pwm-multicolor: Use fwnode_get_child_node_count() Andy Shevchenko
                   ` (7 subsequent siblings)
  8 siblings, 5 replies; 24+ messages in thread
From: Andy Shevchenko @ 2025-03-10 14:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Andy Shevchenko, Heikki Krogerus, Jonathan Cameron,
	linux-acpi, linux-kernel, linux-leds, linux-usb
  Cc: Daniel Scally, Sakari Ailus, Rafael J. Wysocki, Danilo Krummrich,
	Lee Jones, Pavel Machek, Matti Vaittinen, Jonathan Cameron

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(-)

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


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v1 2/4] leds: pwm-multicolor: Use fwnode_get_child_node_count()
  2025-03-10 14:54 [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Andy Shevchenko
  2025-03-10 14:54 ` [PATCH v1 1/4] device property: Split fwnode_get_child_node_count() Andy Shevchenko
@ 2025-03-10 14:54 ` Andy Shevchenko
  2025-03-11  9:52   ` Jonathan Cameron
  2025-03-10 14:54 ` [PATCH v1 3/4] leds: ncp5623: " Andy Shevchenko
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 24+ messages in thread
From: Andy Shevchenko @ 2025-03-10 14:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Andy Shevchenko, Heikki Krogerus, Jonathan Cameron,
	linux-acpi, linux-kernel, linux-leds, linux-usb
  Cc: Daniel Scally, Sakari Ailus, Rafael J. Wysocki, Danilo Krummrich,
	Lee Jones, Pavel Machek, Matti Vaittinen, Jonathan Cameron

Since fwnode_get_child_node_count() was split from its device property
counterpart, we may utilise it in the driver and drop custom implementation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/leds/rgb/leds-pwm-multicolor.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/leds/rgb/leds-pwm-multicolor.c b/drivers/leds/rgb/leds-pwm-multicolor.c
index f80a06cc31f8..61f4e17100f8 100644
--- a/drivers/leds/rgb/leds-pwm-multicolor.c
+++ b/drivers/leds/rgb/leds-pwm-multicolor.c
@@ -107,12 +107,12 @@ static int iterate_subleds(struct device *dev, struct pwm_mc_led *priv,
 
 static int led_pwm_mc_probe(struct platform_device *pdev)
 {
-	struct fwnode_handle *mcnode, *fwnode;
+	struct fwnode_handle *mcnode;
 	struct led_init_data init_data = {};
 	struct led_classdev *cdev;
 	struct mc_subled *subled;
 	struct pwm_mc_led *priv;
-	int count = 0;
+	unsigned int count;
 	int ret = 0;
 
 	mcnode = device_get_named_child_node(&pdev->dev, "multi-led");
@@ -121,8 +121,7 @@ static int led_pwm_mc_probe(struct platform_device *pdev)
 				     "expected multi-led node\n");
 
 	/* count the nodes inside the multi-led node */
-	fwnode_for_each_child_node(mcnode, fwnode)
-		count++;
+	count = fwnode_get_child_node_count(mcnode);
 
 	priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, count),
 			    GFP_KERNEL);
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v1 3/4] leds: ncp5623: Use fwnode_get_child_node_count()
  2025-03-10 14:54 [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Andy Shevchenko
  2025-03-10 14:54 ` [PATCH v1 1/4] device property: Split fwnode_get_child_node_count() Andy Shevchenko
  2025-03-10 14:54 ` [PATCH v1 2/4] leds: pwm-multicolor: Use fwnode_get_child_node_count() Andy Shevchenko
@ 2025-03-10 14:54 ` Andy Shevchenko
  2025-03-11  9:54   ` Jonathan Cameron
  2025-03-10 14:54 ` [PATCH v1 4/4] usb: typec: tcpm: " Andy Shevchenko
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 24+ messages in thread
From: Andy Shevchenko @ 2025-03-10 14:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Andy Shevchenko, Heikki Krogerus, Jonathan Cameron,
	linux-acpi, linux-kernel, linux-leds, linux-usb
  Cc: Daniel Scally, Sakari Ailus, Rafael J. Wysocki, Danilo Krummrich,
	Lee Jones, Pavel Machek, Matti Vaittinen, Jonathan Cameron

Since fwnode_get_child_node_count() was split from its device property
counterpart, we may utilise it in the driver and drop custom implementation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/leds/rgb/leds-ncp5623.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/rgb/leds-ncp5623.c b/drivers/leds/rgb/leds-ncp5623.c
index f18156683375..7c7d44623a9e 100644
--- a/drivers/leds/rgb/leds-ncp5623.c
+++ b/drivers/leds/rgb/leds-ncp5623.c
@@ -155,9 +155,9 @@ static int ncp5623_probe(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	struct fwnode_handle *mc_node, *led_node;
 	struct led_init_data init_data = { };
-	int num_subleds = 0;
 	struct ncp5623 *ncp;
 	struct mc_subled *subled_info;
+	unsigned int num_subleds;
 	u32 color_index;
 	u32 reg;
 	int ret;
@@ -172,8 +172,7 @@ static int ncp5623_probe(struct i2c_client *client)
 	if (!mc_node)
 		return -EINVAL;
 
-	fwnode_for_each_child_node(mc_node, led_node)
-		num_subleds++;
+	num_subleds = fwnode_get_child_node_count(mc_node);
 
 	subled_info = devm_kcalloc(dev, num_subleds, sizeof(*subled_info), GFP_KERNEL);
 	if (!subled_info) {
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v1 4/4] usb: typec: tcpm: Use fwnode_get_child_node_count()
  2025-03-10 14:54 [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Andy Shevchenko
                   ` (2 preceding siblings ...)
  2025-03-10 14:54 ` [PATCH v1 3/4] leds: ncp5623: " Andy Shevchenko
@ 2025-03-10 14:54 ` Andy Shevchenko
  2025-03-11  9:55   ` Jonathan Cameron
                     ` (2 more replies)
  2025-03-14 12:38 ` [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Lee Jones
                   ` (4 subsequent siblings)
  8 siblings, 3 replies; 24+ messages in thread
From: Andy Shevchenko @ 2025-03-10 14:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Andy Shevchenko, Heikki Krogerus, Jonathan Cameron,
	linux-acpi, linux-kernel, linux-leds, linux-usb
  Cc: Daniel Scally, Sakari Ailus, Rafael J. Wysocki, Danilo Krummrich,
	Lee Jones, Pavel Machek, Matti Vaittinen, Jonathan Cameron

Since fwnode_get_child_node_count() was split from its device property
counterpart, we may utilise it in the driver and drop custom implementation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/usb/typec/tcpm/tcpm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 9c455f073233..8ca2e26752fb 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -7166,7 +7166,7 @@ static void tcpm_fw_get_timings(struct tcpm_port *port, struct fwnode_handle *fw
 
 static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode)
 {
-	struct fwnode_handle *capabilities, *child, *caps = NULL;
+	struct fwnode_handle *capabilities, *caps = NULL;
 	unsigned int nr_src_pdo, nr_snk_pdo;
 	const char *opmode_str;
 	u32 *src_pdo, *snk_pdo;
@@ -7232,9 +7232,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode
 	if (!capabilities) {
 		port->pd_count = 1;
 	} else {
-		fwnode_for_each_child_node(capabilities, child)
-			port->pd_count++;
-
+		port->pd_count = fwnode_get_child_node_count(capabilities);
 		if (!port->pd_count) {
 			ret = -ENODATA;
 			goto put_capabilities;
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 1/4] device property: Split fwnode_get_child_node_count()
  2025-03-10 14:54 ` [PATCH v1 1/4] device property: Split fwnode_get_child_node_count() Andy Shevchenko
@ 2025-03-11  9:51   ` Jonathan Cameron
  2025-03-11 12:00   ` [PATCH " Markus Elfring
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 24+ messages in thread
From: Jonathan Cameron @ 2025-03-11  9:51 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, linux-acpi, linux-kernel,
	linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Lee Jones, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

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>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 2/4] leds: pwm-multicolor: Use fwnode_get_child_node_count()
  2025-03-10 14:54 ` [PATCH v1 2/4] leds: pwm-multicolor: Use fwnode_get_child_node_count() Andy Shevchenko
@ 2025-03-11  9:52   ` Jonathan Cameron
  0 siblings, 0 replies; 24+ messages in thread
From: Jonathan Cameron @ 2025-03-11  9:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, linux-acpi, linux-kernel,
	linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Lee Jones, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Mon, 10 Mar 2025 16:54:52 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Since fwnode_get_child_node_count() was split from its device property
> counterpart, we may utilise it in the driver and drop custom implementation.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 3/4] leds: ncp5623: Use fwnode_get_child_node_count()
  2025-03-10 14:54 ` [PATCH v1 3/4] leds: ncp5623: " Andy Shevchenko
@ 2025-03-11  9:54   ` Jonathan Cameron
  2025-03-12 10:57     ` Andy Shevchenko
  0 siblings, 1 reply; 24+ messages in thread
From: Jonathan Cameron @ 2025-03-11  9:54 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, linux-acpi, linux-kernel,
	linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Lee Jones, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Mon, 10 Mar 2025 16:54:53 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Since fwnode_get_child_node_count() was split from its device property
> counterpart, we may utilise it in the driver and drop custom implementation.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/leds/rgb/leds-ncp5623.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/leds/rgb/leds-ncp5623.c b/drivers/leds/rgb/leds-ncp5623.c
> index f18156683375..7c7d44623a9e 100644
> --- a/drivers/leds/rgb/leds-ncp5623.c
> +++ b/drivers/leds/rgb/leds-ncp5623.c
> @@ -155,9 +155,9 @@ static int ncp5623_probe(struct i2c_client *client)
>  	struct device *dev = &client->dev;
>  	struct fwnode_handle *mc_node, *led_node;
>  	struct led_init_data init_data = { };
> -	int num_subleds = 0;
>  	struct ncp5623 *ncp;
>  	struct mc_subled *subled_info;
> +	unsigned int num_subleds;
I have no idea what the scheme is for ordering here. My gut
feeling would have been to leave it in original location but it's
not something I feel strongly about.


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

>  	u32 color_index;
>  	u32 reg;
>  	int ret;
> @@ -172,8 +172,7 @@ static int ncp5623_probe(struct i2c_client *client)
>  	if (!mc_node)
>  		return -EINVAL;
>  
> -	fwnode_for_each_child_node(mc_node, led_node)
> -		num_subleds++;
> +	num_subleds = fwnode_get_child_node_count(mc_node);
>  
>  	subled_info = devm_kcalloc(dev, num_subleds, sizeof(*subled_info), GFP_KERNEL);
>  	if (!subled_info) {


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 4/4] usb: typec: tcpm: Use fwnode_get_child_node_count()
  2025-03-10 14:54 ` [PATCH v1 4/4] usb: typec: tcpm: " Andy Shevchenko
@ 2025-03-11  9:55   ` Jonathan Cameron
  2025-03-12  3:29   ` Kyle Tso
  2025-03-12 11:36   ` Heikki Krogerus
  2 siblings, 0 replies; 24+ messages in thread
From: Jonathan Cameron @ 2025-03-11  9:55 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, linux-acpi, linux-kernel,
	linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Lee Jones, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Mon, 10 Mar 2025 16:54:54 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Since fwnode_get_child_node_count() was split from its device property
> counterpart, we may utilise it in the driver and drop custom implementation.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

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

Seems like a nice little series to me!

Jonathan

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 9c455f073233..8ca2e26752fb 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -7166,7 +7166,7 @@ static void tcpm_fw_get_timings(struct tcpm_port *port, struct fwnode_handle *fw
>  
>  static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode)
>  {
> -	struct fwnode_handle *capabilities, *child, *caps = NULL;
> +	struct fwnode_handle *capabilities, *caps = NULL;
>  	unsigned int nr_src_pdo, nr_snk_pdo;
>  	const char *opmode_str;
>  	u32 *src_pdo, *snk_pdo;
> @@ -7232,9 +7232,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode
>  	if (!capabilities) {
>  		port->pd_count = 1;
>  	} else {
> -		fwnode_for_each_child_node(capabilities, child)
> -			port->pd_count++;
> -
> +		port->pd_count = fwnode_get_child_node_count(capabilities);
>  		if (!port->pd_count) {
>  			ret = -ENODATA;
>  			goto put_capabilities;


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 1/4] device property: Split fwnode_get_child_node_count()
  2025-03-10 14:54 ` [PATCH v1 1/4] device property: Split fwnode_get_child_node_count() Andy Shevchenko
  2025-03-11  9:51   ` Jonathan Cameron
@ 2025-03-11 12:00   ` Markus Elfring
  2025-03-11 12:05     ` Greg Kroah-Hartman
  2025-03-12 11:36   ` [PATCH v1 " Heikki Krogerus
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 24+ messages in thread
From: Markus Elfring @ 2025-03-11 12:00 UTC (permalink / raw)
  To: Andy Shevchenko, linux-acpi, linux-leds, linux-usb,
	Greg Kroah-Hartman, Heikki Krogerus, Jakob Riepler,
	Jonathan Cameron, Rob Herring
  Cc: LKML, Daniel Scally, Danilo Krummrich, Jonathan Cameron,
	Lee Jones, Matti Vaittinen, Pavel Machek, Rafael J. Wysocki,
	Sakari Ailus

> 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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 1/4] device property: Split fwnode_get_child_node_count()
  2025-03-11 12:00   ` [PATCH " Markus Elfring
@ 2025-03-11 12:05     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 24+ messages in thread
From: Greg Kroah-Hartman @ 2025-03-11 12:05 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Andy Shevchenko, linux-acpi, linux-leds, linux-usb,
	Heikki Krogerus, Jakob Riepler, Jonathan Cameron, Rob Herring,
	LKML, Daniel Scally, Danilo Krummrich, Jonathan Cameron,
	Lee Jones, Matti Vaittinen, Pavel Machek, Rafael J. Wysocki,
	Sakari Ailus

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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 4/4] usb: typec: tcpm: Use fwnode_get_child_node_count()
  2025-03-10 14:54 ` [PATCH v1 4/4] usb: typec: tcpm: " Andy Shevchenko
  2025-03-11  9:55   ` Jonathan Cameron
@ 2025-03-12  3:29   ` Kyle Tso
  2025-03-12 11:36   ` Heikki Krogerus
  2 siblings, 0 replies; 24+ messages in thread
From: Kyle Tso @ 2025-03-12  3:29 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, Jonathan Cameron, linux-acpi,
	linux-kernel, linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Lee Jones, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Mon, Mar 10, 2025 at 11:09 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Since fwnode_get_child_node_count() was split from its device property
> counterpart, we may utilise it in the driver and drop custom implementation.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Kyle Tso <kyletso@google.com>

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 9c455f073233..8ca2e26752fb 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -7166,7 +7166,7 @@ static void tcpm_fw_get_timings(struct tcpm_port *port, struct fwnode_handle *fw
>
>  static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode)
>  {
> -       struct fwnode_handle *capabilities, *child, *caps = NULL;
> +       struct fwnode_handle *capabilities, *caps = NULL;
>         unsigned int nr_src_pdo, nr_snk_pdo;
>         const char *opmode_str;
>         u32 *src_pdo, *snk_pdo;
> @@ -7232,9 +7232,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode
>         if (!capabilities) {
>                 port->pd_count = 1;
>         } else {
> -               fwnode_for_each_child_node(capabilities, child)
> -                       port->pd_count++;
> -
> +               port->pd_count = fwnode_get_child_node_count(capabilities);
>                 if (!port->pd_count) {
>                         ret = -ENODATA;
>                         goto put_capabilities;
> --
> 2.47.2
>
>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 3/4] leds: ncp5623: Use fwnode_get_child_node_count()
  2025-03-11  9:54   ` Jonathan Cameron
@ 2025-03-12 10:57     ` Andy Shevchenko
  0 siblings, 0 replies; 24+ messages in thread
From: Andy Shevchenko @ 2025-03-12 10:57 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, linux-acpi, linux-kernel,
	linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Lee Jones, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Tue, Mar 11, 2025 at 09:54:02AM +0000, Jonathan Cameron wrote:
> On Mon, 10 Mar 2025 16:54:53 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

...

> > static int ncp5623_probe(struct i2c_client *client)

> >  	struct device *dev = &client->dev;
> >  	struct fwnode_handle *mc_node, *led_node;
> >  	struct led_init_data init_data = { };
> > -	int num_subleds = 0;
> >  	struct ncp5623 *ncp;
> >  	struct mc_subled *subled_info;
> > +	unsigned int num_subleds;
> I have no idea what the scheme is for ordering here. My gut
> feeling would have been to leave it in original location but it's
> not something I feel strongly about.

I guess I tried to follow multiple approaches here while moving it:
1) it follows "longer line first";
2) it follows "group the variables of the same type".

I also dunno what was behind the original code, but I think my approach has
a benefit as pointed out above.

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

Thank you!

> >  	u32 color_index;
> >  	u32 reg;
> >  	int ret;

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 1/4] device property: Split fwnode_get_child_node_count()
  2025-03-10 14:54 ` [PATCH v1 1/4] device property: Split fwnode_get_child_node_count() Andy Shevchenko
  2025-03-11  9:51   ` Jonathan Cameron
  2025-03-11 12:00   ` [PATCH " Markus Elfring
@ 2025-03-12 11:36   ` Heikki Krogerus
  2025-03-14 13:43   ` Sakari Ailus
  2025-03-14 20:12   ` Rafael J. Wysocki
  4 siblings, 0 replies; 24+ messages in thread
From: Heikki Krogerus @ 2025-03-12 11:36 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Jonathan Cameron, linux-acpi, linux-kernel,
	linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Lee Jones, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

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

-- 
heikki

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 4/4] usb: typec: tcpm: Use fwnode_get_child_node_count()
  2025-03-10 14:54 ` [PATCH v1 4/4] usb: typec: tcpm: " Andy Shevchenko
  2025-03-11  9:55   ` Jonathan Cameron
  2025-03-12  3:29   ` Kyle Tso
@ 2025-03-12 11:36   ` Heikki Krogerus
  2 siblings, 0 replies; 24+ messages in thread
From: Heikki Krogerus @ 2025-03-12 11:36 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Jonathan Cameron, linux-acpi, linux-kernel,
	linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Lee Jones, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Mon, Mar 10, 2025 at 04:54:54PM +0200, Andy Shevchenko wrote:
> Since fwnode_get_child_node_count() was split from its device property
> counterpart, we may utilise it in the driver and drop custom implementation.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

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

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 9c455f073233..8ca2e26752fb 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -7166,7 +7166,7 @@ static void tcpm_fw_get_timings(struct tcpm_port *port, struct fwnode_handle *fw
>  
>  static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode)
>  {
> -	struct fwnode_handle *capabilities, *child, *caps = NULL;
> +	struct fwnode_handle *capabilities, *caps = NULL;
>  	unsigned int nr_src_pdo, nr_snk_pdo;
>  	const char *opmode_str;
>  	u32 *src_pdo, *snk_pdo;
> @@ -7232,9 +7232,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode
>  	if (!capabilities) {
>  		port->pd_count = 1;
>  	} else {
> -		fwnode_for_each_child_node(capabilities, child)
> -			port->pd_count++;
> -
> +		port->pd_count = fwnode_get_child_node_count(capabilities);
>  		if (!port->pd_count) {
>  			ret = -ENODATA;
>  			goto put_capabilities;
> -- 
> 2.47.2

-- 
heikki

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count()
  2025-03-10 14:54 [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Andy Shevchenko
                   ` (3 preceding siblings ...)
  2025-03-10 14:54 ` [PATCH v1 4/4] usb: typec: tcpm: " Andy Shevchenko
@ 2025-03-14 12:38 ` Lee Jones
  2025-03-14 12:39 ` Lee Jones
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 24+ messages in thread
From: Lee Jones @ 2025-03-14 12:38 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, Jonathan Cameron, linux-acpi,
	linux-kernel, linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Mon, 10 Mar 2025, Andy Shevchenko wrote:

> This series was inspired during review of "Support ROHM BD79124 ADC" [1].
> The three conversion patches are the examples of the new API in use.
> 
> Since the first two examples of LEDS, in case of posotove response it may
> be routed via that tree and immutable branch/tag shared with others, e.g.,
> IIO which Matti's series is targeting and might be dependent on. The USB
> patch can be applied later separately, up to the respective maintainers.
> 
> Link: https://lore.kernel.org/r/cover.1741610847.git.mazziesaccount@gmail.com> [1]
> 
> Andy Shevchenko (4):
>   device property: Split fwnode_get_child_node_count()
>   leds: pwm-multicolor: Use fwnode_get_child_node_count()
>   leds: ncp5623: Use fwnode_get_child_node_count()
>   usb: typec: tcpm: Use fwnode_get_child_node_count()
> 
>  drivers/base/property.c                | 12 ++++++------
>  drivers/leds/rgb/leds-ncp5623.c        |  5 ++---
>  drivers/leds/rgb/leds-pwm-multicolor.c |  7 +++----
>  drivers/usb/typec/tcpm/tcpm.c          |  6 ++----
>  include/linux/property.h               |  7 ++++++-
>  5 files changed, 19 insertions(+), 18 deletions(-)

What's the proposed merge strategy here Andy?

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count()
  2025-03-10 14:54 [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Andy Shevchenko
                   ` (4 preceding siblings ...)
  2025-03-14 12:38 ` [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Lee Jones
@ 2025-03-14 12:39 ` Lee Jones
  2025-03-14 13:35   ` Andy Shevchenko
  2025-03-21 11:03 ` Lee Jones
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 24+ messages in thread
From: Lee Jones @ 2025-03-14 12:39 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, Jonathan Cameron, linux-acpi,
	linux-kernel, linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Mon, 10 Mar 2025, Andy Shevchenko wrote:

> This series was inspired during review of "Support ROHM BD79124 ADC" [1].
> The three conversion patches are the examples of the new API in use.
> 
> Since the first two examples of LEDS, in case of posotove response it may
> be routed via that tree and immutable branch/tag shared with others, e.g.,
> IIO which Matti's series is targeting and might be dependent on. The USB
> patch can be applied later separately, up to the respective maintainers.

Ah, just seen this.

I'm okay with that, but need Acks for the other patches.

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count()
  2025-03-14 12:39 ` Lee Jones
@ 2025-03-14 13:35   ` Andy Shevchenko
  0 siblings, 0 replies; 24+ messages in thread
From: Andy Shevchenko @ 2025-03-14 13:35 UTC (permalink / raw)
  To: Lee Jones
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, Jonathan Cameron, linux-acpi,
	linux-kernel, linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Fri, Mar 14, 2025 at 12:39:36PM +0000, Lee Jones wrote:
> On Mon, 10 Mar 2025, Andy Shevchenko wrote:
> 
> > This series was inspired during review of "Support ROHM BD79124 ADC" [1].
> > The three conversion patches are the examples of the new API in use.
> > 
> > Since the first two examples of LEDS, in case of posotove response it may
> > be routed via that tree and immutable branch/tag shared with others, e.g.,
> > IIO which Matti's series is targeting and might be dependent on. The USB
> > patch can be applied later separately, up to the respective maintainers.
> 
> Ah, just seen this.
> 
> I'm okay with that, but need Acks for the other patches.

Right, we need an Ack from Rafael / Greg I suppose?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 1/4] device property: Split fwnode_get_child_node_count()
  2025-03-10 14:54 ` [PATCH v1 1/4] device property: Split fwnode_get_child_node_count() Andy Shevchenko
                     ` (2 preceding siblings ...)
  2025-03-12 11:36   ` [PATCH v1 " Heikki Krogerus
@ 2025-03-14 13:43   ` Sakari Ailus
  2025-03-14 20:12   ` Rafael J. Wysocki
  4 siblings, 0 replies; 24+ messages in thread
From: Sakari Ailus @ 2025-03-14 13:43 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, Jonathan Cameron, linux-acpi,
	linux-kernel, linux-leds, linux-usb, Daniel Scally,
	Rafael J. Wysocki, Danilo Krummrich, Lee Jones, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

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: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 1/4] device property: Split fwnode_get_child_node_count()
  2025-03-10 14:54 ` [PATCH v1 1/4] device property: Split fwnode_get_child_node_count() Andy Shevchenko
                     ` (3 preceding siblings ...)
  2025-03-14 13:43   ` Sakari Ailus
@ 2025-03-14 20:12   ` Rafael J. Wysocki
  4 siblings, 0 replies; 24+ messages in thread
From: Rafael J. Wysocki @ 2025-03-14 20:12 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, Jonathan Cameron, linux-acpi,
	linux-kernel, linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Lee Jones, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Mon, Mar 10, 2025 at 4:08 PM 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>

Acked-by: Rafael J. Wysocki <rafael@kernel.org>

> ---
>  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
>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count()
  2025-03-10 14:54 [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Andy Shevchenko
                   ` (5 preceding siblings ...)
  2025-03-14 12:39 ` Lee Jones
@ 2025-03-21 11:03 ` Lee Jones
  2025-04-10  9:13   ` Lee Jones
  2025-04-10  9:12 ` Lee Jones
  2025-04-15 16:57 ` [GIT PULL] Immutable branch between LEDS, Base and USB due for the v6.16 merge window Lee Jones
  8 siblings, 1 reply; 24+ messages in thread
From: Lee Jones @ 2025-03-21 11:03 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, Jonathan Cameron, linux-acpi,
	linux-kernel, linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Mon, 10 Mar 2025, Andy Shevchenko wrote:

> This series was inspired during review of "Support ROHM BD79124 ADC" [1].
> The three conversion patches are the examples of the new API in use.
> 
> Since the first two examples of LEDS, in case of posotove response it may
> be routed via that tree and immutable branch/tag shared with others, e.g.,
> IIO which Matti's series is targeting and might be dependent on. The USB
> patch can be applied later separately, up to the respective maintainers.
> 
> Link: https://lore.kernel.org/r/cover.1741610847.git.mazziesaccount@gmail.com> [1]
> 
> Andy Shevchenko (4):
>   device property: Split fwnode_get_child_node_count()
>   leds: pwm-multicolor: Use fwnode_get_child_node_count()
>   leds: ncp5623: Use fwnode_get_child_node_count()
>   usb: typec: tcpm: Use fwnode_get_child_node_count()
> 
>  drivers/base/property.c                | 12 ++++++------
>  drivers/leds/rgb/leds-ncp5623.c        |  5 ++---
>  drivers/leds/rgb/leds-pwm-multicolor.c |  7 +++----
>  drivers/usb/typec/tcpm/tcpm.c          |  6 ++----
>  include/linux/property.h               |  7 ++++++-
>  5 files changed, 19 insertions(+), 18 deletions(-)

Note to self: This has everything we need.  Merge it for v6.16.

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count()
  2025-03-10 14:54 [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Andy Shevchenko
                   ` (6 preceding siblings ...)
  2025-03-21 11:03 ` Lee Jones
@ 2025-04-10  9:12 ` Lee Jones
  2025-04-15 16:57 ` [GIT PULL] Immutable branch between LEDS, Base and USB due for the v6.16 merge window Lee Jones
  8 siblings, 0 replies; 24+ messages in thread
From: Lee Jones @ 2025-04-10  9:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, Jonathan Cameron, linux-acpi,
	linux-kernel, linux-leds, linux-usb, Andy Shevchenko
  Cc: Daniel Scally, Sakari Ailus, Rafael J. Wysocki, Danilo Krummrich,
	Lee Jones, Pavel Machek, Matti Vaittinen, Jonathan Cameron

On Mon, 10 Mar 2025 16:54:50 +0200, Andy Shevchenko wrote:
> This series was inspired during review of "Support ROHM BD79124 ADC" [1].
> The three conversion patches are the examples of the new API in use.
> 
> Since the first two examples of LEDS, in case of posotove response it may
> be routed via that tree and immutable branch/tag shared with others, e.g.,
> IIO which Matti's series is targeting and might be dependent on. The USB
> patch can be applied later separately, up to the respective maintainers.
> 
> [...]

Applied, thanks!

[1/4] device property: Split fwnode_get_child_node_count()
      commit: 1490cbb9dbfd0eabfe45f9b674097aea7e6760fc
[2/4] leds: pwm-multicolor: Use fwnode_get_child_node_count()
      commit: 4623cc4e9a5f1b7ad7e6599dfc2a5a4d9d4f5d72
[3/4] leds: ncp5623: Use fwnode_get_child_node_count()
      commit: 53762bb44b0659e79a3e3177372e823ec4afcc8a
[4/4] usb: typec: tcpm: Use fwnode_get_child_node_count()
      commit: 08ca89e98620c08d68b7e7aed6c9294698e214e1

--
Lee Jones [李琼斯]


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count()
  2025-03-21 11:03 ` Lee Jones
@ 2025-04-10  9:13   ` Lee Jones
  0 siblings, 0 replies; 24+ messages in thread
From: Lee Jones @ 2025-04-10  9:13 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, Jonathan Cameron, linux-acpi,
	linux-kernel, linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

On Fri, 21 Mar 2025, Lee Jones wrote:

> On Mon, 10 Mar 2025, Andy Shevchenko wrote:
> 
> > This series was inspired during review of "Support ROHM BD79124 ADC" [1].
> > The three conversion patches are the examples of the new API in use.
> > 
> > Since the first two examples of LEDS, in case of posotove response it may
> > be routed via that tree and immutable branch/tag shared with others, e.g.,
> > IIO which Matti's series is targeting and might be dependent on. The USB
> > patch can be applied later separately, up to the respective maintainers.
> > 
> > Link: https://lore.kernel.org/r/cover.1741610847.git.mazziesaccount@gmail.com> [1]
> > 
> > Andy Shevchenko (4):
> >   device property: Split fwnode_get_child_node_count()
> >   leds: pwm-multicolor: Use fwnode_get_child_node_count()
> >   leds: ncp5623: Use fwnode_get_child_node_count()
> >   usb: typec: tcpm: Use fwnode_get_child_node_count()
> > 
> >  drivers/base/property.c                | 12 ++++++------
> >  drivers/leds/rgb/leds-ncp5623.c        |  5 ++---
> >  drivers/leds/rgb/leds-pwm-multicolor.c |  7 +++----
> >  drivers/usb/typec/tcpm/tcpm.c          |  6 ++----
> >  include/linux/property.h               |  7 ++++++-
> >  5 files changed, 19 insertions(+), 18 deletions(-)
> 
> Note to self: This has everything we need.  Merge it for v6.16.

Submitted for build testing.  Will provide a PR once finished.

Note to self: ib-leds-base-usb-6.16

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [GIT PULL] Immutable branch between LEDS, Base and USB due for the v6.16 merge window
  2025-03-10 14:54 [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Andy Shevchenko
                   ` (7 preceding siblings ...)
  2025-04-10  9:12 ` Lee Jones
@ 2025-04-15 16:57 ` Lee Jones
  8 siblings, 0 replies; 24+ messages in thread
From: Lee Jones @ 2025-04-15 16:57 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rob Herring (Arm), Markus Elfring,
	Jakob Riepler, Heikki Krogerus, Jonathan Cameron, linux-acpi,
	linux-kernel, linux-leds, linux-usb, Daniel Scally, Sakari Ailus,
	Rafael J. Wysocki, Danilo Krummrich, Pavel Machek,
	Matti Vaittinen, Jonathan Cameron

Enjoy!

The following changes since commit 0af2f6be1b4281385b618cb86ad946eded089ac8:

  Linux 6.15-rc1 (2025-04-06 13:11:33 -0700)

are available in the Git repository at:

  ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/lee/leds.git tags/ib-leds-base-usb-v6.16

for you to fetch changes up to 08ca89e98620c08d68b7e7aed6c9294698e214e1:

  usb: typec: tcpm: Use fwnode_get_child_node_count() (2025-04-10 10:12:28 +0100)

----------------------------------------------------------------
Immutable branch between LEDS, Base and USB due for the v6.16 merge window

----------------------------------------------------------------
Andy Shevchenko (4):
      device property: Split fwnode_get_child_node_count()
      leds: pwm-multicolor: Use fwnode_get_child_node_count()
      leds: ncp5623: Use fwnode_get_child_node_count()
      usb: typec: tcpm: Use fwnode_get_child_node_count()

 drivers/base/property.c                | 12 ++++++------
 drivers/leds/rgb/leds-ncp5623.c        |  5 ++---
 drivers/leds/rgb/leds-pwm-multicolor.c |  7 +++----
 drivers/usb/typec/tcpm/tcpm.c          |  6 ++----
 include/linux/property.h               |  7 ++++++-
 5 files changed, 19 insertions(+), 18 deletions(-)

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2025-04-15 16:57 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10 14:54 [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Andy Shevchenko
2025-03-10 14:54 ` [PATCH v1 1/4] device property: Split fwnode_get_child_node_count() Andy Shevchenko
2025-03-11  9:51   ` Jonathan Cameron
2025-03-11 12:00   ` [PATCH " Markus Elfring
2025-03-11 12:05     ` Greg Kroah-Hartman
2025-03-12 11:36   ` [PATCH v1 " Heikki Krogerus
2025-03-14 13:43   ` Sakari Ailus
2025-03-14 20:12   ` Rafael J. Wysocki
2025-03-10 14:54 ` [PATCH v1 2/4] leds: pwm-multicolor: Use fwnode_get_child_node_count() Andy Shevchenko
2025-03-11  9:52   ` Jonathan Cameron
2025-03-10 14:54 ` [PATCH v1 3/4] leds: ncp5623: " Andy Shevchenko
2025-03-11  9:54   ` Jonathan Cameron
2025-03-12 10:57     ` Andy Shevchenko
2025-03-10 14:54 ` [PATCH v1 4/4] usb: typec: tcpm: " Andy Shevchenko
2025-03-11  9:55   ` Jonathan Cameron
2025-03-12  3:29   ` Kyle Tso
2025-03-12 11:36   ` Heikki Krogerus
2025-03-14 12:38 ` [PATCH v1 0/4] leds: Introduce and use fwnode_get_child_node_count() Lee Jones
2025-03-14 12:39 ` Lee Jones
2025-03-14 13:35   ` Andy Shevchenko
2025-03-21 11:03 ` Lee Jones
2025-04-10  9:13   ` Lee Jones
2025-04-10  9:12 ` Lee Jones
2025-04-15 16:57 ` [GIT PULL] Immutable branch between LEDS, Base and USB due for the v6.16 merge window Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).