On Thursday 14 February 2008, Uwe Kleine-König wrote:
> If you have GPIO_LIB gpio_cansleep oopses on an invalid
> gpio.  So better gpio_request your pin first.
> 
> Signed-off-by: Uwe Kleine-König <[EMAIL PROTECTED]>
> Cc: David Brownell <[EMAIL PROTECTED]>

Acked-by: David Brownell <[EMAIL PROTECTED]>

... my bad, sorry.  The "first do gpio_request(), THEN
you can test gpio_cansleep()" issue got resolved in that
direction a bit late; this is the only in-tree driver
that I know would be affected.  My test platforms haven't
yet been updated to 2.6.25-rc1 ... :(



> Cc: Raphael Assenat <[EMAIL PROTECTED]>
> Cc: Richard Purdie <[EMAIL PROTECTED]>
> ---
> Hello,
> 
> I currently start using GPIO_LIB and don't have any chips yet.  The Oops will
> vanish after I will have registered the chips for my SoC's gpios, but still
> this way the code is more robust.
> 
> Best regards
> Uwe
> 
>  drivers/leds/leds-gpio.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 6c0a9c4..76ddcf3 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -79,6 +79,10 @@ static int gpio_led_probe(struct platform_device *pdev)
>               cur_led = &pdata->leds[i];
>               led_dat = &leds_data[i];
>  
> +             ret = gpio_request(led_dat->gpio, cur_led->name);
> +             if (ret < 0)
> +                     goto err;
> +
>               led_dat->cdev.name = cur_led->name;
>               led_dat->cdev.default_trigger = cur_led->default_trigger;
>               led_dat->gpio = cur_led->gpio;
> @@ -87,10 +91,6 @@ static int gpio_led_probe(struct platform_device *pdev)
>               led_dat->cdev.brightness_set = gpio_led_set;
>               led_dat->cdev.brightness = LED_OFF;
>  
> -             ret = gpio_request(led_dat->gpio, led_dat->cdev.name);
> -             if (ret < 0)
> -                     goto err;
> -
>               gpio_direction_output(led_dat->gpio, led_dat->active_low);
>  
>               INIT_WORK(&led_dat->work, gpio_led_work);
> -- 
> 1.5.4.1
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to