Commit d0e58eed authored by Alan Cox's avatar Alan Cox Committed by Wim Van Sebroeck

[WATCHDOG 55/57] wdt285: switch to unlocked_ioctl and tidy up oddments of coding style

Review and switch to unlocked_ioctl
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent dae67a28
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/uaccess.h>
#include <linux/irq.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/hardware/dec21285.h> #include <asm/hardware/dec21285.h>
...@@ -115,8 +115,8 @@ static int watchdog_release(struct inode *inode, struct file *file) ...@@ -115,8 +115,8 @@ static int watchdog_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
static ssize_t static ssize_t watchdog_write(struct file *file, const char *data,
watchdog_write(struct file *file, const char *data, size_t len, loff_t *ppos) size_t len, loff_t *ppos)
{ {
/* /*
* Refresh the timer. * Refresh the timer.
...@@ -127,19 +127,18 @@ watchdog_write(struct file *file, const char *data, size_t len, loff_t *ppos) ...@@ -127,19 +127,18 @@ watchdog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
return len; return len;
} }
static struct watchdog_info ident = { static const struct watchdog_info ident = {
.options = WDIOF_SETTIMEOUT, .options = WDIOF_SETTIMEOUT,
.identity = "Footbridge Watchdog", .identity = "Footbridge Watchdog",
}; };
static int static long watchdog_ioctl(struct file *file, unsigned int cmd,
watchdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
unsigned int new_margin; unsigned int new_margin;
int ret = -ENOTTY; int ret = -ENOTTY;
switch(cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
ret = 0; ret = 0;
if (copy_to_user((void *)arg, &ident, sizeof(ident))) if (copy_to_user((void *)arg, &ident, sizeof(ident)))
...@@ -148,7 +147,7 @@ watchdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -148,7 +147,7 @@ watchdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
ret = put_user(0,(int *)arg); ret = put_user(0, (int *)arg);
break; break;
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
...@@ -182,7 +181,7 @@ static const struct file_operations watchdog_fops = { ...@@ -182,7 +181,7 @@ static const struct file_operations watchdog_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = no_llseek, .llseek = no_llseek,
.write = watchdog_write, .write = watchdog_write,
.ioctl = watchdog_ioctl, .unlocked_ioctl = watchdog_ioctl,
.open = watchdog_open, .open = watchdog_open,
.release = watchdog_release, .release = watchdog_release,
}; };
...@@ -204,11 +203,13 @@ static int __init footbridge_watchdog_init(void) ...@@ -204,11 +203,13 @@ static int __init footbridge_watchdog_init(void)
if (retval < 0) if (retval < 0)
return retval; return retval;
printk("Footbridge Watchdog Timer: 0.01, timer margin: %d sec\n", printk(KERN_INFO
"Footbridge Watchdog Timer: 0.01, timer margin: %d sec\n",
soft_margin); soft_margin);
if (machine_is_cats()) if (machine_is_cats())
printk("Warning: Watchdog reset may not work on this machine.\n"); printk(KERN_WARN
"Warning: Watchdog reset may not work on this machine.\n");
return 0; return 0;
} }
...@@ -223,7 +224,7 @@ MODULE_LICENSE("GPL"); ...@@ -223,7 +224,7 @@ MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
module_param(soft_margin, int, 0); module_param(soft_margin, int, 0);
MODULE_PARM_DESC(soft_margin,"Watchdog timeout in seconds"); MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds");
module_init(footbridge_watchdog_init); module_init(footbridge_watchdog_init);
module_exit(footbridge_watchdog_exit); module_exit(footbridge_watchdog_exit);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment