Skip to content

Commit 53762bb

Browse files
andy-shevlag-linaro
authored andcommitted
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 <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 4623cc4 commit 53762bb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/leds/rgb/leds-ncp5623.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ static int ncp5623_probe(struct i2c_client *client)
155155
struct device *dev = &client->dev;
156156
struct fwnode_handle *mc_node, *led_node;
157157
struct led_init_data init_data = { };
158-
int num_subleds = 0;
159158
struct ncp5623 *ncp;
160159
struct mc_subled *subled_info;
160+
unsigned int num_subleds;
161161
u32 color_index;
162162
u32 reg;
163163
int ret;
@@ -172,8 +172,7 @@ static int ncp5623_probe(struct i2c_client *client)
172172
if (!mc_node)
173173
return -EINVAL;
174174

175-
fwnode_for_each_child_node(mc_node, led_node)
176-
num_subleds++;
175+
num_subleds = fwnode_get_child_node_count(mc_node);
177176

178177
subled_info = devm_kcalloc(dev, num_subleds, sizeof(*subled_info), GFP_KERNEL);
179178
if (!subled_info) {

0 commit comments

Comments
 (0)