*
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/miscdevice.h>
static int wd_margin = WD_TIMO;
-#ifdef CONFIG_WATCHDOG_NOWAYOUT
-static int nowayout = 1;
-#else
-static int nowayout = 0;
-#endif
-
+static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
ibwdt_ping(void)
{
/* Write a watchdog value */
- outb_p(wd_times[wd_margin], WDT_START);
+ outb_p(wd_margin, WDT_START);
}
static ssize_t
-ibwdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
- /* Can't seek (pwrite) on this device */
- if (ppos != &file->f_pos)
- return -ESPIPE;
-
if (count) {
if (!nowayout) {
size_t i;
unsigned long arg)
{
int i, new_margin;
+ void __user *argp = (void __user *)arg;
+ int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
switch (cmd) {
case WDIOC_GETSUPPORT:
- if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
+ if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break;
case WDIOC_GETSTATUS:
- return put_user(0, (int *) arg);
+ return put_user(0, p);
case WDIOC_KEEPALIVE:
ibwdt_ping();
break;
case WDIOC_SETTIMEOUT:
- if (get_user(new_margin, (int *)arg))
+ if (get_user(new_margin, p))
return -EFAULT;
if ((new_margin < 0) || (new_margin > 30))
return -EINVAL;
/* Fall */
case WDIOC_GETTIMEOUT:
- return put_user(wd_times[wd_margin], (int *)arg);
+ return put_user(wd_times[wd_margin], p);
break;
default:
- return -ENOIOCTLCMD;
+ return -ENOTTY;
}
return 0;
}
/* Activate */
ibwdt_ping();
spin_unlock(&ibwdt_lock);
- return 0;
+ return nonseekable_open(inode, file);
}
static int
{
spin_lock(&ibwdt_lock);
if (expect_close == 42)
- outb_p(wd_times[wd_margin], WDT_STOP);
+ outb_p(0, WDT_STOP);
else
printk(KERN_CRIT PFX "WDT device closed unexpectedly. WDT will not stop!\n");
{
if (code == SYS_DOWN || code == SYS_HALT) {
/* Turn the WDT off */
- outb_p(wd_times[wd_margin], WDT_STOP);
+ outb_p(0, WDT_STOP);
}
return NOTIFY_DONE;
}
* Kernel Interfaces
*/
-static struct file_operations ibwdt_fops = {
+static const struct file_operations ibwdt_fops = {
.owner = THIS_MODULE,
+ .llseek = no_llseek,
.write = ibwdt_write,
.ioctl = ibwdt_ioctl,
.open = ibwdt_open,