diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2025-03-10 16:54:52 +0200 |
|---|---|---|
| committer | Lee Jones <lee@kernel.org> | 2025-04-10 10:12:20 +0100 |
| commit | 4623cc4e9a5f1b7ad7e6599dfc2a5a4d9d4f5d72 (patch) | |
| tree | 98d12d788ec3f56a22bddbb0b8373b47f429be99 /drivers/leds | |
| parent | 1490cbb9dbfd0eabfe45f9b674097aea7e6760fc (diff) | |
| download | linux-next-4623cc4e9a5f1b7ad7e6599dfc2a5a4d9d4f5d72.tar.gz linux-next-4623cc4e9a5f1b7ad7e6599dfc2a5a4d9d4f5d72.zip | |
leds: pwm-multicolor: 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@linux.intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20250310150835.3139322-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/leds')
| -rw-r--r-- | drivers/leds/rgb/leds-pwm-multicolor.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/leds/rgb/leds-pwm-multicolor.c b/drivers/leds/rgb/leds-pwm-multicolor.c index 1c7705bafdfc..e0d7d3c9215c 100644 --- a/drivers/leds/rgb/leds-pwm-multicolor.c +++ b/drivers/leds/rgb/leds-pwm-multicolor.c @@ -107,12 +107,12 @@ release_fwnode: 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); |
