git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vserver 1.9.5.x5
[linux-2.6.git]
/
drivers
/
char
/
watchdog
/
scx200_wdt.c
diff --git
a/drivers/char/watchdog/scx200_wdt.c
b/drivers/char/watchdog/scx200_wdt.c
index
6f0657b
..
0c47a43
100644
(file)
--- a/
drivers/char/watchdog/scx200_wdt.c
+++ b/
drivers/char/watchdog/scx200_wdt.c
@@
-101,7
+101,7
@@
static int scx200_wdt_open(struct inode *inode, struct file *file)
return -EBUSY;
scx200_wdt_enable();
return -EBUSY;
scx200_wdt_enable();
- return
0
;
+ return
nonseekable_open(inode, file)
;
}
static int scx200_wdt_release(struct inode *inode, struct file *file)
}
static int scx200_wdt_release(struct inode *inode, struct file *file)
@@
-132,12
+132,9
@@
static struct notifier_block scx200_wdt_notifier =
.notifier_call = scx200_wdt_notify_sys,
};
.notifier_call = scx200_wdt_notify_sys,
};
-static ssize_t scx200_wdt_write(struct file *file, const char *data,
+static ssize_t scx200_wdt_write(struct file *file, const char
__user
*data,
size_t len, loff_t *ppos)
{
size_t len, loff_t *ppos)
{
- if (ppos != &file->f_pos)
- return -ESPIPE;
-
/* check for a magic close character */
if (len)
{
/* check for a magic close character */
if (len)
{
@@
-163,6
+160,8
@@
static ssize_t scx200_wdt_write(struct file *file, const char *data,
static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
+ void __user *argp = (void __user *)arg;
+ int __user *p = argp;
static struct watchdog_info ident = {
.identity = "NatSemi SCx200 Watchdog",
.firmware_version = 1,
static struct watchdog_info ident = {
.identity = "NatSemi SCx200 Watchdog",
.firmware_version = 1,
@@
-174,20
+173,19
@@
static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
default:
return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT:
default:
return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT:
- if(copy_to_user((struct watchdog_info *)arg, &ident,
- sizeof(ident)))
+ if(copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
return 0;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return -EFAULT;
return 0;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
- if (put_user(0,
(int *)arg
))
+ if (put_user(0,
p
))
return -EFAULT;
return 0;
case WDIOC_KEEPALIVE:
scx200_wdt_ping();
return 0;
case WDIOC_SETTIMEOUT:
return -EFAULT;
return 0;
case WDIOC_KEEPALIVE:
scx200_wdt_ping();
return 0;
case WDIOC_SETTIMEOUT:
- if (get_user(new_margin,
(int *)arg
))
+ if (get_user(new_margin,
p
))
return -EFAULT;
if (new_margin < 1)
return -EINVAL;
return -EFAULT;
if (new_margin < 1)
return -EINVAL;
@@
-195,7
+193,7
@@
static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
scx200_wdt_update_margin();
scx200_wdt_ping();
case WDIOC_GETTIMEOUT:
scx200_wdt_update_margin();
scx200_wdt_ping();
case WDIOC_GETTIMEOUT:
- if (put_user(margin,
(int *)arg
))
+ if (put_user(margin,
p
))
return -EFAULT;
return 0;
}
return -EFAULT;
return 0;
}
@@
-203,6
+201,7
@@
static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
static struct file_operations scx200_wdt_fops = {
.owner = THIS_MODULE,
static struct file_operations scx200_wdt_fops = {
.owner = THIS_MODULE,
+ .llseek = no_llseek,
.write = scx200_wdt_write,
.ioctl = scx200_wdt_ioctl,
.open = scx200_wdt_open,
.write = scx200_wdt_write,
.ioctl = scx200_wdt_ioctl,
.open = scx200_wdt_open,
@@
-218,6
+217,11
@@
static struct miscdevice scx200_wdt_miscdev = {
static int __init scx200_wdt_init(void)
{
int r;
static int __init scx200_wdt_init(void)
{
int r;
+ static struct pci_device_id ns_sc[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE) },
+ { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE) },
+ { },
+ };
printk(KERN_DEBUG NAME ": NatSemi SCx200 Watchdog Driver\n");
printk(KERN_DEBUG NAME ": NatSemi SCx200 Watchdog Driver\n");
@@
-225,12
+229,7
@@
static int __init scx200_wdt_init(void)
* First check that this really is a NatSemi SCx200 CPU or a Geode
* SC1100 processor
*/
* First check that this really is a NatSemi SCx200 CPU or a Geode
* SC1100 processor
*/
- if ((pci_find_device(PCI_VENDOR_ID_NS,
- PCI_DEVICE_ID_NS_SCx200_BRIDGE,
- NULL)) == NULL
- && (pci_find_device(PCI_VENDOR_ID_NS,
- PCI_DEVICE_ID_NS_SC1100_BRIDGE,
- NULL)) == NULL)
+ if (!pci_dev_present(ns_sc))
return -ENODEV;
/* More sanity checks, verify that the configuration block is there */
return -ENODEV;
/* More sanity checks, verify that the configuration block is there */