Commit 306dd85c authored by David Brownell's avatar David Brownell Committed by Richard Purdie

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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarRichard Purdie <rpurdie@rpsys.net>
parent d95cbe61
...@@ -49,13 +49,13 @@ static void gpio_led_set(struct led_classdev *led_cdev, ...@@ -49,13 +49,13 @@ static void gpio_led_set(struct led_classdev *led_cdev,
if (led_dat->active_low) if (led_dat->active_low)
level = !level; 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 (led_dat->can_sleep) {
if (preempt_count()) { led_dat->new_level = level;
led_dat->new_level = level; schedule_work(&led_dat->work);
schedule_work(&led_dat->work);
} else
gpio_set_value_cansleep(led_dat->gpio, level);
} else } else
gpio_set_value(led_dat->gpio, level); gpio_set_value(led_dat->gpio, level);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment