X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fwatchdog%2Fpcwd_pci.c;h=2617129a7ccc1bdd675fcde27a8dece4613e22c7;hb=0c06090c9472db0525cb6fe229c3bea33bbbbb3c;hp=61a89e9596421376d2047686f7177e32b073ca41;hpb=a9e82d3a02247af6b729be0a963862d70cb25bf9;p=linux-2.6 diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c index 61a89e9596..2617129a7c 100644 --- a/drivers/watchdog/pcwd_pci.c +++ b/drivers/watchdog/pcwd_pci.c @@ -46,9 +46,8 @@ #include /* For pci functions */ #include /* For io-port access */ #include /* For spin_lock/spin_unlock/... */ - -#include /* For copy_to_user/put_user/... */ -#include /* For inb/outb/... */ +#include /* For copy_to_user/put_user/... */ +#include /* For inb/outb/... */ /* Module and version information */ #define WATCHDOG_VERSION "1.03" @@ -455,8 +454,8 @@ static ssize_t pcipcwd_write(struct file *file, const char __user *data, return len; } -static int pcipcwd_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) +static long pcipcwd_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) { void __user *argp = (void __user *)arg; int __user *p = argp; @@ -471,92 +470,90 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, }; switch (cmd) { - case WDIOC_GETSUPPORT: - return copy_to_user(argp, &ident, - sizeof (ident)) ? -EFAULT : 0; + case WDIOC_GETSUPPORT: + return copy_to_user(argp, &ident, + sizeof (ident)) ? -EFAULT : 0; + + case WDIOC_GETSTATUS: + { + int status; + pcipcwd_get_status(&status); + return put_user(status, p); + } - case WDIOC_GETSTATUS: - { - int status; + case WDIOC_GETBOOTSTATUS: + return put_user(pcipcwd_private.boot_status, p); - pcipcwd_get_status(&status); + case WDIOC_GETTEMP: + { + int temperature; - return put_user(status, p); - } + if (pcipcwd_get_temperature(&temperature)) + return -EFAULT; - case WDIOC_GETBOOTSTATUS: - return put_user(pcipcwd_private.boot_status, p); + return put_user(temperature, p); + } - case WDIOC_GETTEMP: - { - int temperature; + case WDIOC_SETOPTIONS: + { + int new_options, retval = -EINVAL; - if (pcipcwd_get_temperature(&temperature)) - return -EFAULT; + if (get_user (new_options, p)) + return -EFAULT; - return put_user(temperature, p); + if (new_options & WDIOS_DISABLECARD) { + if (pcipcwd_stop()) + return -EIO; + retval = 0; } - case WDIOC_KEEPALIVE: - pcipcwd_keepalive(); - return 0; - - case WDIOC_SETOPTIONS: - { - int new_options, retval = -EINVAL; - - if (get_user (new_options, p)) - return -EFAULT; - - if (new_options & WDIOS_DISABLECARD) { - if (pcipcwd_stop()) - return -EIO; - retval = 0; - } + if (new_options & WDIOS_ENABLECARD) { + if (pcipcwd_start()) + return -EIO; + retval = 0; + } - if (new_options & WDIOS_ENABLECARD) { - if (pcipcwd_start()) - return -EIO; - retval = 0; - } + if (new_options & WDIOS_TEMPPANIC) { + temp_panic = 1; + retval = 0; + } - if (new_options & WDIOS_TEMPPANIC) { - temp_panic = 1; - retval = 0; - } + return retval; + } - return retval; - } + case WDIOC_KEEPALIVE: + pcipcwd_keepalive(); + return 0; - case WDIOC_SETTIMEOUT: - { - int new_heartbeat; + case WDIOC_SETTIMEOUT: + { + int new_heartbeat; - if (get_user(new_heartbeat, p)) - return -EFAULT; + if (get_user(new_heartbeat, p)) + return -EFAULT; - if (pcipcwd_set_heartbeat(new_heartbeat)) - return -EINVAL; + if (pcipcwd_set_heartbeat(new_heartbeat)) + return -EINVAL; - pcipcwd_keepalive(); - /* Fall */ - } + pcipcwd_keepalive(); + /* Fall */ + } - case WDIOC_GETTIMEOUT: - return put_user(heartbeat, p); + case WDIOC_GETTIMEOUT: + return put_user(heartbeat, p); - case WDIOC_GETTIMELEFT: - { - int time_left; + case WDIOC_GETTIMELEFT: + { + int time_left; - if (pcipcwd_get_timeleft(&time_left)) - return -EFAULT; + if (pcipcwd_get_timeleft(&time_left)) + return -EFAULT; - return put_user(time_left, p); - } + return put_user(time_left, p); + } - default: - return -ENOTTY; + default: + return -ENOTTY; } } @@ -644,7 +641,7 @@ static const struct file_operations pcipcwd_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .write = pcipcwd_write, - .ioctl = pcipcwd_ioctl, + .unlocked_ioctl = pcipcwd_ioctl, .open = pcipcwd_open, .release = pcipcwd_release, };