Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andy Shevchenko and committed by
Lee Jones
4623cc4e 1490cbb9

+3 -4
+3 -4
drivers/leds/rgb/leds-pwm-multicolor.c
··· 107 107 108 108 static int led_pwm_mc_probe(struct platform_device *pdev) 109 109 { 110 - struct fwnode_handle *mcnode, *fwnode; 110 + struct fwnode_handle *mcnode; 111 111 struct led_init_data init_data = {}; 112 112 struct led_classdev *cdev; 113 113 struct mc_subled *subled; 114 114 struct pwm_mc_led *priv; 115 - int count = 0; 115 + unsigned int count; 116 116 int ret = 0; 117 117 118 118 mcnode = device_get_named_child_node(&pdev->dev, "multi-led"); ··· 121 121 "expected multi-led node\n"); 122 122 123 123 /* count the nodes inside the multi-led node */ 124 - fwnode_for_each_child_node(mcnode, fwnode) 125 - count++; 124 + count = fwnode_get_child_node_count(mcnode); 126 125 127 126 priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, count), 128 127 GFP_KERNEL);