summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-gpio.c
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2008-03-27 01:59:02 +0100
committerRichard Purdie <rpurdie@rpsys.net>2008-04-01 00:31:13 +0200
commit306dd85c1d41e20a07d1e821e27f5df4927bb5e7 (patch)
treea20f7b63be7b176700c40348a82eedcc8b6e8876 /drivers/leds/leds-gpio.c
parentleds: Fix potential leds-gpio oops (diff)
downloadlinux-306dd85c1d41e20a07d1e821e27f5df4927bb5e7.tar.xz
linux-306dd85c1d41e20a07d1e821e27f5df4927bb5e7.zip
leds: Remove incorrect use of preempt_count() from leds-gpio
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>
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r--drivers/leds/leds-gpio.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index d13b622419df..4c0b05852cb6 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -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);
}