diff options
Diffstat (limited to 'drivers/leds/ledtrig-heartbeat.c')
-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) |