Skip to content

Commit

Permalink
leds: Remove incorrect use of preempt_count() from leds-gpio
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Brownell authored and Richard Purdie committed Mar 31, 2008
1 parent d95cbe6 commit 306dd85
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/leds/leds-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 306dd85

Please sign in to comment.