Re: [PATCH 1/4] leds: leds-gpio: use gpio_request_one

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

 



On Tue, Oct 23, 2012 at 5:17 AM, Jingoo Han <jg1.han@xxxxxxxxxxx> wrote:
> Using gpio_request_one can make the code simpler because it can
> set the direction and initial value in one shot.
>

Looks good to me, I will apply this 4 patches into my for-next branch.

Thanks,
-Bryan

> Signed-off-by: Jingoo Han <jg1.han@xxxxxxxxxxx>
> ---
>  drivers/leds/leds-gpio.c |   12 +++++-------
>  1 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 087d1e6..0b41853 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -106,10 +106,6 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
>                 return 0;
>         }
>
> -       ret = gpio_request(template->gpio, template->name);
> -       if (ret < 0)
> -               return ret;
> -
>         led_dat->cdev.name = template->name;
>         led_dat->cdev.default_trigger = template->default_trigger;
>         led_dat->gpio = template->gpio;
> @@ -129,10 +125,12 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
>         if (!template->retain_state_suspended)
>                 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
>
> -       ret = gpio_direction_output(led_dat->gpio, led_dat->active_low ^ state);
> +       ret = gpio_request_one(template->gpio,
> +                       GPIOF_DIR_OUT | (led_dat->active_low ^ state),
> +                       template->name);
>         if (ret < 0)
> -               goto err;
> -
> +               return ret;
> +
>         INIT_WORK(&led_dat->work, gpio_led_work);
>
>         ret = led_classdev_register(parent, &led_dat->cdev);
> --
> 1.7.1
>
>
--
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