]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
leds: tca6507: Use of_get_child_count()
authorAxel Lin <axel.lin@ingics.com>
Sun, 27 Jan 2013 09:14:14 +0000 (01:14 -0800)
committerBryan Wu <cooloney@gmail.com>
Thu, 7 Feb 2013 00:00:42 +0000 (16:00 -0800)
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
drivers/leds/leds-tca6507.c

index 220fc7fbf1f090b3966dd18f13c65537e5013e9d..070ba0741b2168f9f325aff110b8f935f94ac1b6 100644 (file)
@@ -674,14 +674,10 @@ tca6507_led_dt_init(struct i2c_client *client)
        struct device_node *np = client->dev.of_node, *child;
        struct tca6507_platform_data *pdata;
        struct led_info *tca_leds;
-       int count = 0;
+       int count;
 
-       for_each_child_of_node(np, child)
-               count++;
-       if (!count)
-               return ERR_PTR(-ENODEV);
-
-       if (count > NUM_LEDS)
+       count = of_get_child_count(np);
+       if (!count || count > NUM_LEDS)
                return ERR_PTR(-ENODEV);
 
        tca_leds = devm_kzalloc(&client->dev,