diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-05 16:09:37 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-05 16:09:37 -0400 |
| commit | 24eee627eb7b05ac3cbca240f36b615969e65775 (patch) | |
| tree | d9c9bef83de3374d6dae335401ccf38aa14c99e4 | |
| parent | 5eecb9cc9029aef3c308fc94149c4a3065d40d9a (diff) | |
| parent | fb31fbeb647ed1910290712c13f11f1db09e5506 (diff) | |
Merge branch 'fixes-for-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
Pull leds fix from Bryan Wu:
"Fix for heartbeat led trigger driver"
* 'fixes-for-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds:
leds: heartbeat: fix bug on panic
| -rw-r--r-- | drivers/leds/ledtrig-heartbeat.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/leds/ledtrig-heartbeat.c b/drivers/leds/ledtrig-heartbeat.c index 41dc76db4311..a019fbb70880 100644 --- a/drivers/leds/ledtrig-heartbeat.c +++ b/drivers/leds/ledtrig-heartbeat.c | |||
| @@ -21,6 +21,8 @@ | |||
| 21 | #include <linux/reboot.h> | 21 | #include <linux/reboot.h> |
| 22 | #include "leds.h" | 22 | #include "leds.h" |
| 23 | 23 | ||
| 24 | static int panic_heartbeats; | ||
| 25 | |||
| 24 | struct heartbeat_trig_data { | 26 | struct heartbeat_trig_data { |
| 25 | unsigned int phase; | 27 | unsigned int phase; |
| 26 | unsigned int period; | 28 | unsigned int period; |
| @@ -34,6 +36,11 @@ static void led_heartbeat_function(unsigned long data) | |||
| 34 | unsigned long brightness = LED_OFF; | 36 | unsigned long brightness = LED_OFF; |
| 35 | unsigned long delay = 0; | 37 | unsigned long delay = 0; |
| 36 | 38 | ||
| 39 | if (unlikely(panic_heartbeats)) { | ||
| 40 | led_set_brightness(led_cdev, LED_OFF); | ||
| 41 | return; | ||
| 42 | } | ||
| 43 | |||
| 37 | /* acts like an actual heart beat -- ie thump-thump-pause... */ | 44 | /* acts like an actual heart beat -- ie thump-thump-pause... */ |
| 38 | switch (heartbeat_data->phase) { | 45 | switch (heartbeat_data->phase) { |
| 39 | case 0: | 46 | case 0: |
| @@ -111,12 +118,19 @@ static int heartbeat_reboot_notifier(struct notifier_block *nb, | |||
| 111 | return NOTIFY_DONE; | 118 | return NOTIFY_DONE; |
| 112 | } | 119 | } |
| 113 | 120 | ||
| 121 | static int heartbeat_panic_notifier(struct notifier_block *nb, | ||
| 122 | unsigned long code, void *unused) | ||
| 123 | { | ||
| 124 | panic_heartbeats = 1; | ||
| 125 | return NOTIFY_DONE; | ||
| 126 | } | ||
| 127 | |||
| 114 | static struct notifier_block heartbeat_reboot_nb = { | 128 | static struct notifier_block heartbeat_reboot_nb = { |
| 115 | .notifier_call = heartbeat_reboot_notifier, | 129 | .notifier_call = heartbeat_reboot_notifier, |
| 116 | }; | 130 | }; |
| 117 | 131 | ||
| 118 | static struct notifier_block heartbeat_panic_nb = { | 132 | static struct notifier_block heartbeat_panic_nb = { |
| 119 | .notifier_call = heartbeat_reboot_notifier, | 133 | .notifier_call = heartbeat_panic_notifier, |
| 120 | }; | 134 | }; |
| 121 | 135 | ||
| 122 | static int __init heartbeat_trig_init(void) | 136 | static int __init heartbeat_trig_init(void) |
