Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 48149
b: refs/heads/master
c: e42162a
h: refs/heads/master
i:
  48147: b6f5765
v: v3
  • Loading branch information
Wim Van Sebroeck committed Jan 27, 2007
1 parent 5a19e0e commit 54b99a9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 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: c9d7710ea2b497784314a916a39d4d390855a557
refs/heads/master: e42162a46d948769c8b45d25ee81827bc7dac435
32 changes: 26 additions & 6 deletions trunk/drivers/char/watchdog/ib700wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,20 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" _
static void
ibwdt_ping(void)
{
spin_lock(&ibwdt_lock);

/* Write a watchdog value */
outb_p(wd_margin, WDT_START);

spin_unlock(&ibwdt_lock);
}

static void
ibwdt_disable(void)
{
spin_lock(&ibwdt_lock);
outb_p(0, WDT_STOP);
spin_unlock(&ibwdt_lock);
}

static int
Expand Down Expand Up @@ -218,7 +224,26 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,

case WDIOC_GETTIMEOUT:
return put_user(wd_times[wd_margin], p);
break;

case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;

if (get_user(options, p))
return -EFAULT;

if (options & WDIOS_DISABLECARD) {
ibwdt_disable();
retval = 0;
}

if (options & WDIOS_ENABLECARD) {
ibwdt_ping();
retval = 0;
}

return retval;
}

default:
return -ENOTTY;
Expand All @@ -229,24 +254,20 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static int
ibwdt_open(struct inode *inode, struct file *file)
{
spin_lock(&ibwdt_lock);
if (test_and_set_bit(0, &ibwdt_is_open)) {
spin_unlock(&ibwdt_lock);
return -EBUSY;
}
if (nowayout)
__module_get(THIS_MODULE);

/* Activate */
ibwdt_ping();
spin_unlock(&ibwdt_lock);
return nonseekable_open(inode, file);
}

static int
ibwdt_close(struct inode *inode, struct file *file)
{
spin_lock(&ibwdt_lock);
if (expect_close == 42) {
ibwdt_disable();
} else {
Expand All @@ -255,7 +276,6 @@ ibwdt_close(struct inode *inode, struct file *file)
}
clear_bit(0, &ibwdt_is_open);
expect_close = 0;
spin_unlock(&ibwdt_lock);
return 0;
}

Expand Down

0 comments on commit 54b99a9

Please sign in to comment.