leds/mc13892: Use workqueue for setting LED brightness
BugLink: http://bugs.launchpad.net/bugs/531696 Setting the LED brightness on mc13892 boards uses spi_sync, which may sleep. The LED class infrastructure requires that the brightness_set operation does not sleep, as it may be called from atomic contexts. This results in a 'scheduling while atomic BUG' when doing the following: echo mmc0 > /sys/class/leds/xxx/trigger This change modifies the driver to use a workqueue to do the SPI operation, so that we can sleep. The led_classdev->brightness_set callback just updates the brightness value and schedules work, making it suitable to call with irqs disabled. Because we've split the set operation into two parts, we need to define some context (struct mc13892_led) to pass between the led classdev code and the work function. Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com> Signed-off-by: Bryan Wu <bryan.wu@canonical.com> Signed-off-by: Andy Whitcroft <apw@canonical.com>
parent
41946522
Please register or sign in to comment