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
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
char
/
watchdog
/
sc1200wdt.c
diff --git
a/drivers/char/watchdog/sc1200wdt.c
b/drivers/char/watchdog/sc1200wdt.c
index
c0bfea2
..
e323983
100644
(file)
--- a/
drivers/char/watchdog/sc1200wdt.c
+++ b/
drivers/char/watchdog/sc1200wdt.c
@@
-27,7
+27,6
@@
*
*/
*
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/miscdevice.h>
@@
-38,6
+37,7
@@
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/pnp.h>
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/pnp.h>
+#include <linux/fs.h>
#include <linux/pci.h>
#include <asm/semaphore.h>
#include <linux/pci.h>
#include <asm/semaphore.h>
@@
-73,9
+73,9
@@
static char banner[] __initdata = KERN_INFO PFX SC1200_MODULE_VER;
static int timeout = 1;
static int io = -1;
static int io_len = 2; /* for non plug and play */
static int timeout = 1;
static int io = -1;
static int io_len = 2; /* for non plug and play */
-struct semaphore open_sem;
+st
atic st
ruct semaphore open_sem;
static char expect_close;
static char expect_close;
-s
pinlock_t sc1200wdt_lock;
/* io port access serialisation */
+s
tatic spinlock_t sc1200wdt_lock;
/* io port access serialisation */
#if defined CONFIG_PNP
static int isapnp = 1;
#if defined CONFIG_PNP
static int isapnp = 1;
@@
-90,12
+90,7
@@
MODULE_PARM_DESC(io, "io port");
module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1");
module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1");
-#ifdef CONFIG_WATCHDOG_NOWAYOUT
-static int nowayout = 1;
-#else
-static int nowayout = 0;
-#endif
-
+static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
@@
-156,6
+151,8
@@
static inline int sc1200wdt_status(void)
static int sc1200wdt_open(struct inode *inode, struct file *file)
{
static int sc1200wdt_open(struct inode *inode, struct file *file)
{
+ nonseekable_open(inode, file);
+
/* allow one at a time */
if (down_trylock(&open_sem))
return -EBUSY;
/* allow one at a time */
if (down_trylock(&open_sem))
return -EBUSY;
@@
-173,6
+170,8
@@
static int sc1200wdt_open(struct inode *inode, struct file *file)
static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
int new_timeout;
static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
int new_timeout;
+ void __user *argp = (void __user *)arg;
+ int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 0,
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 0,
@@
-181,25
+180,25
@@
static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
switch (cmd) {
default:
switch (cmd) {
default:
- return -ENO
IOCTLCMD; /* Keep Pavel Machek amused ;) */
+ return -ENO
TTY;
case WDIOC_GETSUPPORT:
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:
return -EFAULT;
return 0;
case WDIOC_GETSTATUS:
- return put_user(sc1200wdt_status(),
(int *)arg
);
+ return put_user(sc1200wdt_status(),
p
);
case WDIOC_GETBOOTSTATUS:
case WDIOC_GETBOOTSTATUS:
- return put_user(0,
(int *)arg
);
+ return put_user(0,
p
);
case WDIOC_KEEPALIVE:
sc1200wdt_write_data(WDTO, timeout);
return 0;
case WDIOC_SETTIMEOUT:
case WDIOC_KEEPALIVE:
sc1200wdt_write_data(WDTO, timeout);
return 0;
case WDIOC_SETTIMEOUT:
- if (get_user(new_timeout,
(int *)arg
))
+ if (get_user(new_timeout,
p
))
return -EFAULT;
/* the API states this is given in secs */
return -EFAULT;
/* the API states this is given in secs */
@@
-212,13
+211,13
@@
static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
/* fall through and return the new timeout */
case WDIOC_GETTIMEOUT:
/* fall through and return the new timeout */
case WDIOC_GETTIMEOUT:
- return put_user(timeout * 60,
(int *)arg
);
+ return put_user(timeout * 60,
p
);
case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;
case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;
- if (get_user(options,
(int *)arg
))
+ if (get_user(options,
p
))
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
return -EFAULT;
if (options & WDIOS_DISABLECARD) {
@@
-253,11
+252,8
@@
static int sc1200wdt_release(struct inode *inode, struct file *file)
}
}
-static ssize_t sc1200wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+static ssize_t sc1200wdt_write(struct file *file, const char
__user
*data, size_t len, loff_t *ppos)
{
{
- if (ppos != &file->f_pos)
- return -ESPIPE;
-
if (len) {
if (!nowayout) {
size_t i;
if (len) {
if (!nowayout) {
size_t i;
@@
-296,9
+292,10
@@
static struct notifier_block sc1200wdt_notifier =
.notifier_call = sc1200wdt_notify_sys,
};
.notifier_call = sc1200wdt_notify_sys,
};
-static struct file_operations sc1200wdt_fops =
+static
const
struct file_operations sc1200wdt_fops =
{
.owner = THIS_MODULE,
{
.owner = THIS_MODULE,
+ .llseek = no_llseek,
.write = sc1200wdt_write,
.ioctl = sc1200wdt_ioctl,
.open = sc1200wdt_open,
.write = sc1200wdt_write,
.ioctl = sc1200wdt_ioctl,
.open = sc1200wdt_open,
@@
-332,7
+329,7
@@
static int __init sc1200wdt_probe(void)
#if defined CONFIG_PNP
#if defined CONFIG_PNP
-struct pnp_device_id scl200wdt_pnp_devices[] = {
+st
atic st
ruct pnp_device_id scl200wdt_pnp_devices[] = {
/* National Semiconductor PC87307/PC97307 watchdog component */
{.id = "NSC0800", .driver_data = 0},
{.id = ""},
/* National Semiconductor PC87307/PC97307 watchdog component */
{.id = "NSC0800", .driver_data = 0},
{.id = ""},
@@
-379,7
+376,7
@@
static int __init sc1200wdt_init(void)
{
int ret;
{
int ret;
- printk(banner);
+ printk(
"%s\n",
banner);
spin_lock_init(&sc1200wdt_lock);
sema_init(&open_sem, 1);
spin_lock_init(&sc1200wdt_lock);
sema_init(&open_sem, 1);
@@
-395,7
+392,7
@@
static int __init sc1200wdt_init(void)
if (io == -1) {
printk(KERN_ERR PFX "io parameter must be specified\n");
ret = -EINVAL;
if (io == -1) {
printk(KERN_ERR PFX "io parameter must be specified\n");
ret = -EINVAL;
- goto out_
clean
;
+ goto out_
pnp
;
}
#if defined CONFIG_PNP
}
#if defined CONFIG_PNP
@@
-408,7
+405,7
@@
static int __init sc1200wdt_init(void)
if (!request_region(io, io_len, SC1200_MODULE_NAME)) {
printk(KERN_ERR PFX "Unable to register IO port %#x\n", io);
ret = -EBUSY;
if (!request_region(io, io_len, SC1200_MODULE_NAME)) {
printk(KERN_ERR PFX "Unable to register IO port %#x\n", io);
ret = -EBUSY;
- goto out_
clean
;
+ goto out_
pnp
;
}
ret = sc1200wdt_probe();
}
ret = sc1200wdt_probe();
@@
-438,6
+435,11
@@
out_rbt:
out_io:
release_region(io, io_len);
out_io:
release_region(io, io_len);
+out_pnp:
+#if defined CONFIG_PNP
+ if (isapnp)
+ pnp_unregister_driver(&scl200wdt_pnp_driver);
+#endif
goto out_clean;
}
goto out_clean;
}