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
/
nwflash.c
diff --git
a/drivers/char/nwflash.c
b/drivers/char/nwflash.c
index
f344ed3
..
206cf6f
100644
(file)
--- a/
drivers/char/nwflash.c
+++ b/
drivers/char/nwflash.c
@@
-27,6
+27,7
@@
#include <linux/rwsem.h>
#include <linux/init.h>
#include <linux/smp_lock.h>
#include <linux/rwsem.h>
#include <linux/init.h>
#include <linux/smp_lock.h>
+#include <linux/mutex.h>
#include <asm/hardware/dec21285.h>
#include <asm/io.h>
#include <asm/hardware/dec21285.h>
#include <asm/io.h>
@@
-56,7
+57,7
@@
static int gbWriteEnable;
static int gbWriteBase64Enable;
static volatile unsigned char *FLASH_BASE;
static int gbFlashSize = KFLASH_SIZE;
static int gbWriteBase64Enable;
static volatile unsigned char *FLASH_BASE;
static int gbFlashSize = KFLASH_SIZE;
-static DE
CLARE_MUTEX(nwflash_sem
);
+static DE
FINE_MUTEX(nwflash_mutex
);
extern spinlock_t gpio_lock;
extern spinlock_t gpio_lock;
@@
-140,7
+141,7
@@
static ssize_t flash_read(struct file *file, char __user *buf, size_t size,
/*
* We now lock against reads and writes. --rmk
*/
/*
* We now lock against reads and writes. --rmk
*/
- if (
down_interruptible(&nwflash_sem
))
+ if (
mutex_lock_interruptible(&nwflash_mutex
))
return -ERESTARTSYS;
ret = copy_to_user(buf, (void *)(FLASH_BASE + p), count);
return -ERESTARTSYS;
ret = copy_to_user(buf, (void *)(FLASH_BASE + p), count);
@@
-149,7
+150,7
@@
static ssize_t flash_read(struct file *file, char __user *buf, size_t size,
*ppos += count;
} else
ret = -EFAULT;
*ppos += count;
} else
ret = -EFAULT;
-
up(&nwflash_sem
);
+
mutex_unlock(&nwflash_mutex
);
}
return ret;
}
}
return ret;
}
@@
-182,13
+183,13
@@
static ssize_t flash_write(struct file *file, const char __user *buf,
if (count > gbFlashSize - p)
count = gbFlashSize - p;
if (count > gbFlashSize - p)
count = gbFlashSize - p;
- if (
verify_area
(VERIFY_READ, buf, count))
+ if (
!access_ok
(VERIFY_READ, buf, count))
return -EFAULT;
/*
* We now lock against reads and writes. --rmk
*/
return -EFAULT;
/*
* We now lock against reads and writes. --rmk
*/
- if (
down_interruptible(&nwflash_sem
))
+ if (
mutex_lock_interruptible(&nwflash_mutex
))
return -ERESTARTSYS;
written = 0;
return -ERESTARTSYS;
written = 0;
@@
-277,7
+278,7
@@
static ssize_t flash_write(struct file *file, const char __user *buf,
*/
leds_event(led_release);
*/
leds_event(led_release);
-
up(&nwflash_sem
);
+
mutex_unlock(&nwflash_mutex
);
return written;
}
return written;
}
@@
-641,7
+642,7
@@
static void kick_open(void)
udelay(25);
}
udelay(25);
}
-static struct file_operations flash_fops =
+static
const
struct file_operations flash_fops =
{
.owner = THIS_MODULE,
.llseek = flash_llseek,
{
.owner = THIS_MODULE,
.llseek = flash_llseek,
@@
-696,7
+697,7
@@
static void __exit nwflash_exit(void)
MODULE_LICENSE("GPL");
MODULE_LICENSE("GPL");
-
MODULE_PARM(flashdebug, "i"
);
+
module_param(flashdebug, bool, 0644
);
module_init(nwflash_init);
module_exit(nwflash_exit);
module_init(nwflash_init);
module_exit(nwflash_exit);