leds: Remove incorrect use of preempt_count() from leds-gpio
authorDavid Brownell <dbrownell@users.sourceforge.net>
Thu, 27 Mar 2008 00:59:02 +0000 (00:59 +0000)
committerRichard Purdie <rpurdie@rpsys.net>
Mon, 31 Mar 2008 22:31:13 +0000 (23:31 +0100)
It appears that we can't just check to see if we're in a task
context ... so instead of trying that, just make the relevant
leds always schedule a little worklet.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
drivers/leds/leds-gpio.c

index d13b622419df5c99f88a99cec37e03fccf984e9e..4c0b05852cb6f2b7c85ab80013c06af0a73ecba0 100644 (file)
@@ -49,13 +49,13 @@ static void gpio_led_set(struct led_classdev *led_cdev,
        if (led_dat->active_low)
                level = !level;
 
-       /* setting GPIOs with I2C/etc requires a preemptible task context */
+       /* Setting GPIOs with I2C/etc requires a task context, and we don't
+        * seem to have a reliable way to know if we're already in one; so
+        * let's just assume the worst.
+        */
        if (led_dat->can_sleep) {
-               if (preempt_count()) {
-                       led_dat->new_level = level;
-                       schedule_work(&led_dat->work);
-               } else
-                       gpio_set_value_cansleep(led_dat->gpio, level);
+               led_dat->new_level = level;
+               schedule_work(&led_dat->work);
        } else
                gpio_set_value(led_dat->gpio, level);
 }