X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fwatchdog%2Fsoftdog.c;h=4067e1f8a36878c7fa6665175051231b2710542f;hb=refs%2Fheads%2Fvserver;hp=e9f4f22e7276cb62ce49e08721809b6710a54626;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/char/watchdog/softdog.c b/drivers/char/watchdog/softdog.c index e9f4f22e7..4067e1f8a 100644 --- a/drivers/char/watchdog/softdog.c +++ b/drivers/char/watchdog/softdog.c @@ -38,7 +38,6 @@ #include #include -#include #include #include #include @@ -47,6 +46,8 @@ #include #include #include +#include + #include #define PFX "SoftDog: " @@ -56,12 +57,7 @@ static int soft_margin = TIMER_MARGIN; /* in seconds */ module_param(soft_margin, int, 0); MODULE_PARM_DESC(soft_margin, "Watchdog soft_margin in seconds. (0f_pos) - return -ESPIPE; - /* * Refresh the timer. */ @@ -194,6 +191,8 @@ static ssize_t softdog_write(struct file *file, const char *data, size_t len, lo static int softdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; int new_margin; static struct watchdog_info ident = { .options = WDIOF_SETTIMEOUT | @@ -204,25 +203,25 @@ static int softdog_ioctl(struct inode *inode, struct file *file, }; switch (cmd) { default: - return -ENOIOCTLCMD; + return -ENOTTY; case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *)arg, &ident, + return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0,(int *)arg); + return put_user(0, p); case WDIOC_KEEPALIVE: softdog_keepalive(); return 0; case WDIOC_SETTIMEOUT: - if (get_user(new_margin, (int *)arg)) + if (get_user(new_margin, p)) return -EFAULT; if (softdog_set_heartbeat(new_margin)) return -EINVAL; softdog_keepalive(); /* Fall */ case WDIOC_GETTIMEOUT: - return put_user(soft_margin, (int *)arg); + return put_user(soft_margin, p); } } @@ -244,7 +243,7 @@ static int softdog_notify_sys(struct notifier_block *this, unsigned long code, * Kernel Interfaces */ -static struct file_operations softdog_fops = { +static const struct file_operations softdog_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .write = softdog_write,