Skip to content

Commit

Permalink
leds: leds-gpio: Use of_get_child_count() helper
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tobias Klauser authored and Bryan Wu committed Sep 11, 2012
1 parent 59c4dce commit 127aedc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/leds/leds-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,10 @@ static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_dev
{
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;

Expand Down

0 comments on commit 127aedc

Please sign in to comment.