diff options
author | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 06:00:45 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 06:00:45 -0700 |
commit | 67d2c36e901403bb97cb79ddb44d702c3284d0ba (patch) | |
tree | 872805a9402f8186584075f1a8cf804b9606efea /drivers/char/watchdog/softdog.c | |
parent | 94f8c66e5e543d79231abf203d6e514ecb668688 (diff) | |
parent | 1cc77248106aafc12ba529953f652d6f8db2c84d (diff) |
Merge watchdog driver updates
Automated merge from
master.kernel.org:/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
failed due to duplicate different changes to Kconfig file. Manually fixed
up. Hopefully.
Diffstat (limited to 'drivers/char/watchdog/softdog.c')
-rw-r--r-- | drivers/char/watchdog/softdog.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/char/watchdog/softdog.c b/drivers/char/watchdog/softdog.c index 4d7ed931f5c..20e5eb8667f 100644 --- a/drivers/char/watchdog/softdog.c +++ b/drivers/char/watchdog/softdog.c @@ -77,7 +77,7 @@ static void watchdog_fire(unsigned long); static struct timer_list watchdog_ticktock = TIMER_INITIALIZER(watchdog_fire, 0, 0); -static unsigned long timer_alive; +static unsigned long driver_open, orphan_timer; static char expect_close; @@ -87,6 +87,9 @@ static char expect_close; static void watchdog_fire(unsigned long data) { + if (test_and_clear_bit(0, &orphan_timer)) + module_put(THIS_MODULE); + if (soft_noboot) printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n"); else @@ -128,9 +131,9 @@ static int softdog_set_heartbeat(int t) static int softdog_open(struct inode *inode, struct file *file) { - if(test_and_set_bit(0, &timer_alive)) + if (test_and_set_bit(0, &driver_open)) return -EBUSY; - if (nowayout) + if (!test_and_clear_bit(0, &orphan_timer)) __module_get(THIS_MODULE); /* * Activate timer @@ -147,11 +150,13 @@ static int softdog_release(struct inode *inode, struct file *file) */ if (expect_close == 42) { softdog_stop(); + module_put(THIS_MODULE); } else { printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); + set_bit(0, &orphan_timer); softdog_keepalive(); } - clear_bit(0, &timer_alive); + clear_bit(0, &driver_open); expect_close = 0; return 0; } |