X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fwatchdog%2Fmixcomwd.c;h=d8dede575402e14ab31952fec1d249cb0156b008;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=6d3e7d5facc901ee2fa7c99549e6f0f3cd153bbe;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/char/watchdog/mixcomwd.c b/drivers/char/watchdog/mixcomwd.c index 6d3e7d5fa..d8dede575 100644 --- a/drivers/char/watchdog/mixcomwd.c +++ b/drivers/char/watchdog/mixcomwd.c @@ -45,6 +45,8 @@ #include #include #include +#include +#include #include #include @@ -59,15 +61,10 @@ static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */ static int watchdog_port; static int mixcomwd_timer_alive; -static struct timer_list mixcomwd_timer = TIMER_INITIALIZER(NULL, 0, 0); +static DEFINE_TIMER(mixcomwd_timer, NULL, 0, 0); static char expect_close; -#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)"); @@ -108,7 +105,7 @@ static int mixcomwd_open(struct inode *inode, struct file *file) mixcomwd_timer_alive=0; } } - return 0; + return nonseekable_open(inode, file); } static int mixcomwd_release(struct inode *inode, struct file *file) @@ -134,12 +131,8 @@ static int mixcomwd_release(struct inode *inode, struct file *file) } -static ssize_t mixcomwd_write(struct file *file, const char *data, size_t len, loff_t *ppos) +static ssize_t mixcomwd_write(struct file *file, const char __user *data, size_t len, loff_t *ppos) { - if (ppos != &file->f_pos) { - return -ESPIPE; - } - if(len) { if (!nowayout) { @@ -164,6 +157,8 @@ static ssize_t mixcomwd_write(struct file *file, const char *data, size_t len, l static int mixcomwd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; int status; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, @@ -178,13 +173,12 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file, if (!nowayout) { status|=mixcomwd_timer_alive; } - if (copy_to_user((int *)arg, &status, sizeof(int))) { + if (copy_to_user(p, &status, sizeof(int))) { return -EFAULT; } break; 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; @@ -200,6 +194,7 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file, static struct file_operations mixcomwd_fops= { .owner = THIS_MODULE, + .llseek = no_llseek, .write = mixcomwd_write, .ioctl = mixcomwd_ioctl, .open = mixcomwd_open,