diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-07 18:05:09 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-07 18:05:09 -0700 |
commit | b588e2bbd7b872c9cdf635fe0f04840534e72443 (patch) | |
tree | 8e298e0f18f305dd12223ffb36c2450cf62318bb /drivers/watchdog/booke_wdt.c | |
parent | 3df302ff56fac91d54e964faed9d293018ac71ca (diff) | |
parent | 7944d3a5a70ee5c1904ed1e8b1d71ff0af2854d9 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
* git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog: (70 commits)
[WATCHDOG] more coding style clean-up's
[WATCHDOG] sbc8360.c - move stop code into a function
[WATCHDOG] Coding style - Indentation - part 2
[WATCHDOG] Coding style - Indentation - part 1
[WATCHDOG] mpc8xxx_wdt: add support for MPC8xx watchdogs
[WATCHDOG] mpc8xxx_wdt: fix build
[WATCHDOG] mpc8xxx_wdt: various renames, mostly s/mpc83xx/mpc8xxx/g
[WATCHDOG] mpc83xx_wdt: rename to mpc8xxx_wdt
[WATCHDOG] mpc83xx_wdt: add support for MPC86xx CPUs
[WATCHDOG] mpc83xx_wdt: convert to the OF platform driver
[WATCHDOG] pcwd: a couple of watchdogs escaped conversion
[WATCHDOG] Clean-up includes
[WATCHDOG] hpwdt.c - fix double includes
[WATCHDOG 57/57] wdt501/pci: Clean up, coding style and switch to unlocked_ioctl
[WATCHDOG 56/57] wdt977: clean up, coding style and switch to unlocked_ioctl
[WATCHDOG 55/57] wdt285: switch to unlocked_ioctl and tidy up oddments of coding style
[WATCHDOG 54/57] wdrtas: clean up, coding style, switch to unlocked_ioctl
[WATCHDOG 53/57] wafer5823wdt: Clean up, coding style, switch to unlocked_ioctl
[WATCHDOG 52/57] w83977f_wdt: clean up, coding style and switch to unlocked_ioctl
[WATCHDOG 51/57] w83877f_wdt: clean up code, coding style, switch to unlocked_ioctl
...
Diffstat (limited to 'drivers/watchdog/booke_wdt.c')
-rw-r--r-- | drivers/watchdog/booke_wdt.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index 770824458d4..c3b78a76f17 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c @@ -18,9 +18,9 @@ #include <linux/miscdevice.h> #include <linux/notifier.h> #include <linux/watchdog.h> +#include <linux/uaccess.h> #include <asm/reg_booke.h> -#include <asm/uaccess.h> #include <asm/system.h> /* If the kernel parameter wdt=1, the watchdog will be enabled at boot. @@ -32,7 +32,7 @@ */ #ifdef CONFIG_FSL_BOOKE -#define WDT_PERIOD_DEFAULT 63 /* Ex. wdt_period=28 bus=333Mhz , reset=~40sec */ +#define WDT_PERIOD_DEFAULT 63 /* Ex. wdt_period=28 bus=333Mhz,reset=~40sec */ #else #define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */ #endif /* for timing information */ @@ -82,16 +82,15 @@ static struct watchdog_info ident = { .identity = "PowerPC Book-E Watchdog", }; -static int booke_wdt_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) +static long booke_wdt_ioctl(struct file *file, + unsigned int cmd, unsigned long arg) { u32 tmp = 0; u32 __user *p = (u32 __user *)arg; switch (cmd) { case WDIOC_GETSUPPORT: - if (copy_to_user((struct watchdog_info __user *)arg, &ident, - sizeof(struct watchdog_info))) + if (copy_to_user(arg, &ident, sizeof(struct watchdog_info))) return -EFAULT; case WDIOC_GETSTATUS: return put_user(ident.options, p); @@ -100,16 +99,6 @@ static int booke_wdt_ioctl(struct inode *inode, struct file *file, tmp = mfspr(SPRN_TSR) & TSR_WRS(3); /* returns 1 if last reset was caused by the WDT */ return (tmp ? 1 : 0); - case WDIOC_KEEPALIVE: - booke_wdt_ping(); - return 0; - case WDIOC_SETTIMEOUT: - if (get_user(booke_wdt_period, p)) - return -EFAULT; - mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period)); - return 0; - case WDIOC_GETTIMEOUT: - return put_user(booke_wdt_period, p); case WDIOC_SETOPTIONS: if (get_user(tmp, p)) return -EINVAL; @@ -119,6 +108,17 @@ static int booke_wdt_ioctl(struct inode *inode, struct file *file, } else return -EINVAL; return 0; + case WDIOC_KEEPALIVE: + booke_wdt_ping(); + return 0; + case WDIOC_SETTIMEOUT: + if (get_user(booke_wdt_period, p)) + return -EFAULT; + mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP(0)) | + WDTP(booke_wdt_period)); + return 0; + case WDIOC_GETTIMEOUT: + return put_user(booke_wdt_period, p); default: return -ENOTTY; } @@ -132,8 +132,9 @@ static int booke_wdt_open(struct inode *inode, struct file *file) if (booke_wdt_enabled == 0) { booke_wdt_enabled = 1; on_each_cpu(__booke_wdt_enable, NULL, 0); - printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled " - "(wdt_period=%d)\n", booke_wdt_period); + printk(KERN_INFO + "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", + booke_wdt_period); } spin_unlock(&booke_wdt_lock); @@ -144,7 +145,7 @@ static const struct file_operations booke_wdt_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .write = booke_wdt_write, - .ioctl = booke_wdt_ioctl, + .unlocked_ioctl = booke_wdt_ioctl, .open = booke_wdt_open, }; @@ -175,8 +176,9 @@ static int __init booke_wdt_init(void) spin_lock(&booke_wdt_lock); if (booke_wdt_enabled == 1) { - printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled " - "(wdt_period=%d)\n", booke_wdt_period); + printk(KERN_INFO + "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", + booke_wdt_period); on_each_cpu(__booke_wdt_enable, NULL, 0); } spin_unlock(&booke_wdt_lock); |