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

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@linux.intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20250310150835.3139322-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Andy Shevchenko and committed by
Lee Jones
53762bb4 4623cc4e

+2 -3
+2 -3
drivers/leds/rgb/leds-ncp5623.c
··· 155 155 struct device *dev = &client->dev; 156 156 struct fwnode_handle *mc_node, *led_node; 157 157 struct led_init_data init_data = { }; 158 - int num_subleds = 0; 159 158 struct ncp5623 *ncp; 160 159 struct mc_subled *subled_info; 160 + unsigned int num_subleds; 161 161 u32 color_index; 162 162 u32 reg; 163 163 int ret; ··· 172 172 if (!mc_node) 173 173 return -EINVAL; 174 174 175 - fwnode_for_each_child_node(mc_node, led_node) 176 - num_subleds++; 175 + num_subleds = fwnode_get_child_node_count(mc_node); 177 176 178 177 subled_info = devm_kcalloc(dev, num_subleds, sizeof(*subled_info), GFP_KERNEL); 179 178 if (!subled_info) {