Re: [PATCH] leds: tca6507: Use of_get_child_count()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks good to me, applied!

Thanks,
-Bryan

On Sun, Jan 27, 2013 at 1:14 AM, Axel Lin <axel.lin@xxxxxxxxxx> wrote:
> Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx>
> ---
>  drivers/leds/leds-tca6507.c |   10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
> index 220fc7f..070ba07 100644
> --- a/drivers/leds/leds-tca6507.c
> +++ b/drivers/leds/leds-tca6507.c
> @@ -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,
> --
> 1.7.9.5
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-leds" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux