[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250310150835.3139322-4-andriy.shevchenko@linux.intel.com>
Date: Mon, 10 Mar 2025 16:54:53 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rob Herring (Arm)" <robh@...nel.org>,
Markus Elfring <elfring@...rs.sourceforge.net>,
Jakob Riepler <jakob+lkml@...anoidlabs.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-leds@...r.kernel.org,
linux-usb@...r.kernel.org
Cc: Daniel Scally <djrscally@...il.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>,
Lee Jones <lee@...nel.org>,
Pavel Machek <pavel@...nel.org>,
Matti Vaittinen <mazziesaccount@...il.com>,
Jonathan Cameron <jic23@...nel.org>
Subject: [PATCH v1 3/4] leds: ncp5623: Use fwnode_get_child_node_count()
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@...ux.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
Powered by blists - more mailing lists