Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308975
b: refs/heads/master
c: 49dca5a
h: refs/heads/master
i:
  308973: 7098104
  308971: a1a610c
  308967: dc80438
  308959: 9537140
v: v3
  • Loading branch information
Alexander Holler authored and Linus Torvalds committed May 29, 2012
1 parent 12448bc commit c9e0749
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6335f8fa974bc284da0f55877935538e1d7b55eb
refs/heads/master: 49dca5aebfdeadd4bf27b6cb4c60392147dc35a4
28 changes: 27 additions & 1 deletion trunk/drivers/leds/ledtrig-heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -103,13 +104,38 @@ 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 struct notifier_block heartbeat_panic_nb = {
.notifier_call = heartbeat_reboot_notifier,
};

static int __init heartbeat_trig_init(void)
{
return led_trigger_register(&heartbeat_led_trigger);
int rc = led_trigger_register(&heartbeat_led_trigger);

if (!rc) {
atomic_notifier_chain_register(&panic_notifier_list,
&heartbeat_panic_nb);
register_reboot_notifier(&heartbeat_reboot_nb);
}
return rc;
}

static void __exit heartbeat_trig_exit(void)
{
unregister_reboot_notifier(&heartbeat_reboot_nb);
atomic_notifier_chain_unregister(&panic_notifier_list,
&heartbeat_panic_nb);
led_trigger_unregister(&heartbeat_led_trigger);
}

Expand Down

0 comments on commit c9e0749

Please sign in to comment.