leds: leds-gpio: Use of_get_child_count() helper
Use of_get_child_count() instead of custom implementation.
Signed-off-by: Tobias Klauser <klto@zhaw.ch>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index c392c1e..cde85ba 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -170,11 +170,10 @@
{
struct device_node *np = pdev->dev.of_node, *child;
struct gpio_leds_priv *priv;
- int count = 0, ret;
+ int count, ret;
/* count LEDs in this device, so we know how much to allocate */
- for_each_child_of_node(np, child)
- count++;
+ count = of_get_child_count(np);
if (!count)
return NULL;