Skip to content

Commit 4623cc4

Browse files
andy-shevlag-linaro
authored andcommitted
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 <[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 1490cbb commit 4623cc4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/leds/rgb/leds-pwm-multicolor.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ static int iterate_subleds(struct device *dev, struct pwm_mc_led *priv,
107107

108108
static int led_pwm_mc_probe(struct platform_device *pdev)
109109
{
110-
struct fwnode_handle *mcnode, *fwnode;
110+
struct fwnode_handle *mcnode;
111111
struct led_init_data init_data = {};
112112
struct led_classdev *cdev;
113113
struct mc_subled *subled;
114114
struct pwm_mc_led *priv;
115-
int count = 0;
115+
unsigned int count;
116116
int ret = 0;
117117

118118
mcnode = device_get_named_child_node(&pdev->dev, "multi-led");
@@ -121,8 +121,7 @@ static int led_pwm_mc_probe(struct platform_device *pdev)
121121
"expected multi-led node\n");
122122

123123
/* 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);
126125

127126
priv = devm_kzalloc(&pdev->dev, struct_size(priv, leds, count),
128127
GFP_KERNEL);

0 commit comments

Comments
 (0)