Skip to content
Commit 8b6c8f39 authored by Jeremy Kerr's avatar Jeremy Kerr Committed by Andy Whitcroft
Browse files

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: default avatarJeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: default avatarBryan Wu <bryan.wu@canonical.com>
Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
parent 41946522
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