lkml.org 
[lkml]   [2012]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4] backlight: corgi_lcd: Use gpio_set_value_cansleep() to avoid WARN_ON
On Wed, Dec 05, 2012 at 09:59:07AM +0900, Jingoo Han wrote:
> - if (gpio_is_valid(lcd->gpio_backlight_cont))
> - gpio_set_value(lcd->gpio_backlight_cont, cont);
> + if (gpio_is_valid(lcd->gpio_backlight_cont)) {
> + if (gpio_cansleep(lcd->gpio_backlight_cont))
> + gpio_set_value_cansleep(lcd->gpio_backlight_cont, cont);
> + else
> + gpio_set_value(lcd->gpio_backlight_cont, cont);
> + }

Why not simply:

+ if (gpio_is_valid(lcd->gpio_backlight_cont))
+ gpio_set_value_cansleep(lcd->gpio_backlight_cont, cont);

If you read the gpiolib code and documentation, what you will realise is
that the two calls are identical except for the "might_sleep_if()" in
gpio_set_value_cansleep(). You will also note that gpiolib itself _only_
calls gpio_set_value_cansleep() without checking gpio_cansleep() in
contexts where sleeping is possible. So if it's good enough for gpiolib,
it should be good enough here.


\
 
 \ /
  Last update: 2012-12-05 11:22    [W:0.118 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site