All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] leds: heartbeat: stop on shutdown
@ 2012-04-24 13:43 Alexander Holler
  2012-04-24 15:07 ` [PATCH v2] " Alexander Holler
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Holler @ 2012-04-24 13:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Richard Purdie, Alexander Holler

A halted kernel should not show a heartbeat.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
---
 drivers/leds/ledtrig-heartbeat.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/leds/ledtrig-heartbeat.c b/drivers/leds/ledtrig-heartbeat.c
index 759c0bb..76189b0 100644
--- a/drivers/leds/ledtrig-heartbeat.c
+++ b/drivers/leds/ledtrig-heartbeat.c
@@ -18,6 +18,7 @@
 #include <linux/timer.h>
 #include <linux/sched.h>
 #include <linux/leds.h>
+#include <linux/reboot.h>
 #include "leds.h"
 
 struct heartbeat_trig_data {
@@ -101,13 +102,26 @@ static struct led_trigger heartbeat_led_trigger = {
 	.deactivate = heartbeat_trig_deactivate,
 };
 
+static int heartbeat_reboot_notifier(struct notifier_block *nb,
+				     unsigned long code, void *unused)
+{
+	led_trigger_unregister(&heartbeat_led_trigger);
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block heartbeat_reboot_nb = {
+	.notifier_call = heartbeat_reboot_notifier,
+};
+
 static int __init heartbeat_trig_init(void)
 {
+	register_reboot_notifier(&heartbeat_reboot_nb);
 	return led_trigger_register(&heartbeat_led_trigger);
 }
 
 static void __exit heartbeat_trig_exit(void)
 {
+	unregister_reboot_notifier(&heartbeat_reboot_nb);
 	led_trigger_unregister(&heartbeat_led_trigger);
 }
 
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-04-24 22:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-24 13:43 [PATCH] leds: heartbeat: stop on shutdown Alexander Holler
2012-04-24 15:07 ` [PATCH v2] " Alexander Holler
2012-04-24 15:24   ` Shuah Khan
2012-04-24 16:32     ` Alexander Holler
2012-04-24 17:00       ` Shuah Khan
2012-04-24 17:27         ` Alexander Holler
2012-04-24 17:31           ` Shuah Khan
2012-04-24 17:34             ` Alexander Holler
2012-04-24 22:30   ` [PATCH v3] leds: heartbeat: stop on shutdown, reboot or panic Alexander Holler
2012-04-24 22:38     ` [PATCH v4] " Alexander Holler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.