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 kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git]
/
drivers
/
char
/
watchdog
/
cpu5wdt.c
diff --git
a/drivers/char/watchdog/cpu5wdt.c
b/drivers/char/watchdog/cpu5wdt.c
index
dad804f
..
3e8410b
100644
(file)
--- a/
drivers/char/watchdog/cpu5wdt.c
+++ b/
drivers/char/watchdog/cpu5wdt.c
@@
-28,6
+28,8
@@
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/timer.h>
+#include <linux/completion.h>
+#include <linux/jiffies.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/uaccess.h>
@@
-56,7
+58,7
@@
static int ticks = 10000;
/* some device data */
static struct {
/* some device data */
static struct {
- struct
semaphore
stop;
+ struct
completion
stop;
volatile int running;
struct timer_list timer;
volatile int queue;
volatile int running;
struct timer_list timer;
volatile int queue;
@@
-84,7
+86,7
@@
static void cpu5wdt_trigger(unsigned long unused)
}
else {
/* ticks doesn't matter anyway */
}
else {
/* ticks doesn't matter anyway */
-
up
(&cpu5wdt_device.stop);
+
complete
(&cpu5wdt_device.stop);
}
}
}
}
@@
-134,7
+136,7
@@
static int cpu5wdt_open(struct inode *inode, struct file *file)
if ( test_and_set_bit(0, &cpu5wdt_device.inuse) )
return -EBUSY;
if ( test_and_set_bit(0, &cpu5wdt_device.inuse) )
return -EBUSY;
- return
0
;
+ return
nonseekable_open(inode, file)
;
}
static int cpu5wdt_release(struct inode *inode, struct file *file)
}
static int cpu5wdt_release(struct inode *inode, struct file *file)
@@
-145,6
+147,7
@@
static int cpu5wdt_release(struct inode *inode, struct file *file)
static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
+ void __user *argp = (void __user *)arg;
unsigned int value;
static struct watchdog_info ident =
{
unsigned int value;
static struct watchdog_info ident =
{
@@
-159,15
+162,15
@@
static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
case WDIOC_GETSTATUS:
value = inb(port + CPU5WDT_STATUS_REG);
value = (value >> 2) & 1;
case WDIOC_GETSTATUS:
value = inb(port + CPU5WDT_STATUS_REG);
value = (value >> 2) & 1;
- if ( copy_to_user(
(int *)arg, (int *)
&value, sizeof(int)) )
+ if ( copy_to_user(
argp,
&value, sizeof(int)) )
return -EFAULT;
break;
case WDIOC_GETSUPPORT:
return -EFAULT;
break;
case WDIOC_GETSUPPORT:
- if ( copy_to_user(
(struct watchdog_info *)arg
, &ident, sizeof(ident)) )
+ if ( copy_to_user(
argp
, &ident, sizeof(ident)) )
return -EFAULT;
break;
case WDIOC_SETOPTIONS:
return -EFAULT;
break;
case WDIOC_SETOPTIONS:
- if ( copy_from_user(&value,
(int *)arg
, sizeof(int)) )
+ if ( copy_from_user(&value,
argp
, sizeof(int)) )
return -EFAULT;
switch(value) {
case WDIOS_ENABLECARD:
return -EFAULT;
switch(value) {
case WDIOS_ENABLECARD:
@@
-185,7
+188,7
@@
static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
return 0;
}
return 0;
}
-static ssize_t cpu5wdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+static ssize_t cpu5wdt_write(struct file *file, const char
__user
*buf, size_t count, loff_t *ppos)
{
if ( !count )
return -EIO;
{
if ( !count )
return -EIO;
@@
-197,6
+200,7
@@
static ssize_t cpu5wdt_write(struct file *file, const char *buf, size_t count, l
static struct file_operations cpu5wdt_fops = {
.owner = THIS_MODULE,
static struct file_operations cpu5wdt_fops = {
.owner = THIS_MODULE,
+ .llseek = no_llseek,
.ioctl = cpu5wdt_ioctl,
.open = cpu5wdt_open,
.write = cpu5wdt_write,
.ioctl = cpu5wdt_ioctl,
.open = cpu5wdt_open,
.write = cpu5wdt_write,
@@
-236,7
+240,7
@@
static int __devinit cpu5wdt_init(void)
if ( !val )
printk(KERN_INFO PFX "sorry, was my fault\n");
if ( !val )
printk(KERN_INFO PFX "sorry, was my fault\n");
- init_
MUTEX_LOCKED
(&cpu5wdt_device.stop);
+ init_
completion
(&cpu5wdt_device.stop);
cpu5wdt_device.queue = 0;
clear_bit(0, &cpu5wdt_device.inuse);
cpu5wdt_device.queue = 0;
clear_bit(0, &cpu5wdt_device.inuse);
@@
-266,7
+270,7
@@
static void __devexit cpu5wdt_exit(void)
{
if ( cpu5wdt_device.queue ) {
cpu5wdt_device.queue = 0;
{
if ( cpu5wdt_device.queue ) {
cpu5wdt_device.queue = 0;
-
dow
n(&cpu5wdt_device.stop);
+
wait_for_completio
n(&cpu5wdt_device.stop);
}
misc_deregister(&cpu5wdt_misc);
}
misc_deregister(&cpu5wdt_misc);