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
/
machzwd.c
diff --git
a/drivers/char/watchdog/machzwd.c
b/drivers/char/watchdog/machzwd.c
index
99c6b21
..
276577d
100644
(file)
--- a/
drivers/char/watchdog/machzwd.c
+++ b/
drivers/char/watchdog/machzwd.c
@@
-28,7
+28,6
@@
* Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
*/
* Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
@@
-88,24
+87,13
@@
static unsigned short zf_readw(unsigned char port)
return inw(DATA_W);
}
return inw(DATA_W);
}
-static unsigned short zf_readb(unsigned char port)
-{
- outb(port, INDEX);
- return inb(DATA_B);
-}
-
MODULE_AUTHOR("Fernando Fuganti <fuganti@conectiva.com.br>");
MODULE_DESCRIPTION("MachZ ZF-Logic Watchdog driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
MODULE_AUTHOR("Fernando Fuganti <fuganti@conectiva.com.br>");
MODULE_DESCRIPTION("MachZ ZF-Logic Watchdog driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
-#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)");
@@
-155,13
+143,6
@@
static unsigned long next_heartbeat = 0;
#endif
#endif
-/* STATUS register functions */
-
-static inline unsigned char zf_get_status(void)
-{
- return zf_readb(STATUS);
-}
-
static inline void zf_set_status(unsigned char new)
{
zf_writeb(STATUS, new);
static inline void zf_set_status(unsigned char new)
{
zf_writeb(STATUS, new);
@@
-182,22
+163,6
@@
static inline void zf_set_control(unsigned short new)
/* WD#? counter functions */
/* WD#? counter functions */
-/*
- * Just get current counter value
- */
-
-static inline unsigned short zf_get_timer(unsigned char n)
-{
- switch(n){
- case WD1:
- return zf_readw(COUNTER_1);
- case WD2:
- return zf_readb(COUNTER_2);
- default:
- return 0;
- }
-}
-
/*
* Just set counter value
*/
/*
* Just set counter value
*/
@@
-302,13
+267,9
@@
static void zf_ping(unsigned long data)
}
}
}
}
-static ssize_t zf_write(struct file *file, const char *buf, size_t count,
+static ssize_t zf_write(struct file *file, const char
__user
*buf, size_t count,
loff_t *ppos)
{
loff_t *ppos)
{
- /* Can't seek (pwrite) on this device */
- if (ppos != &file->f_pos)
- return -ESPIPE;
-
/* See if we got the magic character */
if(count){
/* See if we got the magic character */
if(count){
@@
-352,22
+313,23
@@
static ssize_t zf_write(struct file *file, const char *buf, size_t count,
static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
{
static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
{
+ void __user *argp = (void __user *)arg;
+ int __user *p = argp;
switch(cmd){
case WDIOC_GETSUPPORT:
switch(cmd){
case WDIOC_GETSUPPORT:
- if (copy_to_user((struct watchdog_info *)arg,
- &zf_info, sizeof(zf_info)))
+ if (copy_to_user(argp, &zf_info, sizeof(zf_info)))
return -EFAULT;
break;
case WDIOC_GETSTATUS:
return -EFAULT;
break;
case WDIOC_GETSTATUS:
- return put_user(0,
(int *) arg
);
+ return put_user(0,
p
);
case WDIOC_KEEPALIVE:
zf_ping(0);
break;
default:
case WDIOC_KEEPALIVE:
zf_ping(0);
break;
default:
- return -ENO
IOCTLCMD
;
+ return -ENO
TTY
;
}
return 0;
}
return 0;
@@
-388,7
+350,7
@@
static int zf_open(struct inode *inode, struct file *file)
zf_timer_on();
zf_timer_on();
- return
0
;
+ return
nonseekable_open(inode, file)
;
}
static int zf_close(struct inode *inode, struct file *file)
}
static int zf_close(struct inode *inode, struct file *file)
@@
-426,8
+388,9
@@
static int zf_notify_sys(struct notifier_block *this, unsigned long code,
-static struct file_operations zf_fops = {
+static
const
struct file_operations zf_fops = {
.owner = THIS_MODULE,
.owner = THIS_MODULE,
+ .llseek = no_llseek,
.write = zf_write,
.ioctl = zf_ioctl,
.open = zf_open,
.write = zf_write,
.ioctl = zf_ioctl,
.open = zf_open,
@@
-463,8
+426,7
@@
static int __init zf_init(void)
printk(KERN_INFO PFX ": MachZ ZF-Logic Watchdog driver initializing.\n");
ret = zf_get_ZFL_version();
printk(KERN_INFO PFX ": MachZ ZF-Logic Watchdog driver initializing.\n");
ret = zf_get_ZFL_version();
- printk("%#x\n", ret);
- if((!ret) || (ret != 0xffff)){
+ if ((!ret) || (ret == 0xffff)) {
printk(KERN_WARNING PFX ": no ZF-Logic found\n");
return -ENODEV;
}
printk(KERN_WARNING PFX ": no ZF-Logic found\n");
return -ENODEV;
}
@@
-519,7
+481,7
@@
out:
}
}
-void __exit zf_exit(void)
+
static
void __exit zf_exit(void)
{
zf_timer_off();
{
zf_timer_off();