Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 63519
b: refs/heads/master
c: bf2fc92
h: refs/heads/master
i:
  63517: ef2b0cc
  63515: 29ae6f3
  63511: c374962
  63503: c77f160
  63487: 8031156
v: v3
  • Loading branch information
Dale Farnsworth authored and Wim Van Sebroeck committed Jul 24, 2007
1 parent 659412f commit 9317665
Show file tree
Hide file tree
Showing 2 changed files with 25 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: d37a5c3ddf7f57fdc0632e279eabb1772f89dfc5
refs/heads/master: bf2fc92cae3630301d98b9faa38c1a98bb57d801
28 changes: 24 additions & 4 deletions trunk/drivers/char/watchdog/mv64x60_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static int wdt_status;
static void __iomem *mv64x60_wdt_regs;
static int mv64x60_wdt_timeout;
static unsigned int bus_clk;
static char expect_close;

static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
Expand Down Expand Up @@ -115,10 +116,14 @@ static int mv64x60_wdt_open(struct inode *inode, struct file *file)

static int mv64x60_wdt_release(struct inode *inode, struct file *file)
{
mv64x60_wdt_service();

if (!nowayout)
if (expect_close == 42)
mv64x60_wdt_handler_disable();
else {
printk(KERN_CRIT
"mv64x60_wdt: unexpected close, not stopping timer!\n");
mv64x60_wdt_service();
}
expect_close = 0;

clear_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags);

Expand All @@ -128,8 +133,22 @@ static int mv64x60_wdt_release(struct inode *inode, struct file *file)
static ssize_t mv64x60_wdt_write(struct file *file, const char __user *data,
size_t len, loff_t * ppos)
{
if (len)
if (len) {
if (!nowayout) {
size_t i;

expect_close = 0;

for (i = 0; i != len; i++) {
char c;
if(get_user(c, data + i))
return -EFAULT;
if (c == 'V')
expect_close = 42;
}
}
mv64x60_wdt_service();
}

return len;
}
Expand All @@ -142,6 +161,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
void __user *argp = (void __user *)arg;
static struct watchdog_info info = {
.options = WDIOF_SETTIMEOUT |
WDIOF_MAGICCLOSE |
WDIOF_KEEPALIVEPING,
.firmware_version = 0,
.identity = "MV64x60 watchdog",
Expand Down

0 comments on commit 9317665

Please sign in to comment.