Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7113
b: refs/heads/master
c: 1cc7724
h: refs/heads/master
i:
  7111: 16bb676
v: v3
  • Loading branch information
Chuck Ebbert authored and Wim Van Sebroeck committed Sep 3, 2005
1 parent 95db5f3 commit a6e0ade
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 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: 93642ecd463df30d032da8ac37c2676cee4ad876
refs/heads/master: 1cc77248106aafc12ba529953f652d6f8db2c84d
13 changes: 9 additions & 4 deletions trunk/drivers/char/watchdog/softdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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;
}
Expand Down

0 comments on commit a6e0ade

Please sign in to comment.