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

[WATCHDOG 20/57] booke watchdog: clean up and unlocked_ioctl

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 9a5f50d3
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/watchdog.h> #include <linux/watchdog.h>
#include <linux/uaccess.h>
#include <asm/reg_booke.h> #include <asm/reg_booke.h>
#include <asm/uaccess.h>
#include <asm/system.h> #include <asm/system.h>
/* If the kernel parameter wdt=1, the watchdog will be enabled at boot. /* If the kernel parameter wdt=1, the watchdog will be enabled at boot.
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
*/ */
#ifdef CONFIG_FSL_BOOKE #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 #else
#define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */ #define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */
#endif /* for timing information */ #endif /* for timing information */
...@@ -82,7 +82,7 @@ static struct watchdog_info ident = { ...@@ -82,7 +82,7 @@ static struct watchdog_info ident = {
.identity = "PowerPC Book-E Watchdog", .identity = "PowerPC Book-E Watchdog",
}; };
static int booke_wdt_ioctl(struct inode *inode, struct file *file, static long booke_wdt_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
u32 tmp = 0; u32 tmp = 0;
...@@ -90,8 +90,7 @@ static int booke_wdt_ioctl(struct inode *inode, struct file *file, ...@@ -90,8 +90,7 @@ static int booke_wdt_ioctl(struct inode *inode, struct file *file,
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info __user *)arg, &ident, if (copy_to_user(arg, &ident, sizeof(struct watchdog_info)))
sizeof(struct watchdog_info)))
return -EFAULT; return -EFAULT;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
return put_user(ident.options, p); return put_user(ident.options, p);
...@@ -106,7 +105,8 @@ static int booke_wdt_ioctl(struct inode *inode, struct file *file, ...@@ -106,7 +105,8 @@ static int booke_wdt_ioctl(struct inode *inode, struct file *file,
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(booke_wdt_period, p)) if (get_user(booke_wdt_period, p))
return -EFAULT; return -EFAULT;
mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period)); mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP(0)) |
WDTP(booke_wdt_period));
return 0; return 0;
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(booke_wdt_period, p); return put_user(booke_wdt_period, p);
...@@ -132,8 +132,9 @@ static int booke_wdt_open(struct inode *inode, struct file *file) ...@@ -132,8 +132,9 @@ static int booke_wdt_open(struct inode *inode, struct file *file)
if (booke_wdt_enabled == 0) { if (booke_wdt_enabled == 0) {
booke_wdt_enabled = 1; booke_wdt_enabled = 1;
on_each_cpu(__booke_wdt_enable, NULL, 0, 0); on_each_cpu(__booke_wdt_enable, NULL, 0, 0);
printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled " printk(KERN_INFO
"(wdt_period=%d)\n", booke_wdt_period); "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n",
booke_wdt_period);
} }
spin_unlock(&booke_wdt_lock); spin_unlock(&booke_wdt_lock);
...@@ -144,7 +145,7 @@ static const struct file_operations booke_wdt_fops = { ...@@ -144,7 +145,7 @@ static const struct file_operations booke_wdt_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = no_llseek, .llseek = no_llseek,
.write = booke_wdt_write, .write = booke_wdt_write,
.ioctl = booke_wdt_ioctl, .unlocked_ioctl = booke_wdt_ioctl,
.open = booke_wdt_open, .open = booke_wdt_open,
}; };
...@@ -175,8 +176,9 @@ static int __init booke_wdt_init(void) ...@@ -175,8 +176,9 @@ static int __init booke_wdt_init(void)
spin_lock(&booke_wdt_lock); spin_lock(&booke_wdt_lock);
if (booke_wdt_enabled == 1) { if (booke_wdt_enabled == 1) {
printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled " printk(KERN_INFO
"(wdt_period=%d)\n", booke_wdt_period); "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n",
booke_wdt_period);
on_each_cpu(__booke_wdt_enable, NULL, 0, 0); on_each_cpu(__booke_wdt_enable, NULL, 0, 0);
} }
spin_unlock(&booke_wdt_lock); spin_unlock(&booke_wdt_lock);
......
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