diff options
Diffstat (limited to 'drivers/char/nwflash.c')
-rw-r--r-- | drivers/char/nwflash.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c index ca41d62b1d9d..8865387d3448 100644 --- a/drivers/char/nwflash.c +++ b/drivers/char/nwflash.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/rwsem.h> | 27 | #include <linux/rwsem.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/smp_lock.h> | 29 | #include <linux/smp_lock.h> |
30 | #include <linux/mutex.h> | ||
30 | 31 | ||
31 | #include <asm/hardware/dec21285.h> | 32 | #include <asm/hardware/dec21285.h> |
32 | #include <asm/io.h> | 33 | #include <asm/io.h> |
@@ -56,7 +57,7 @@ static int gbWriteEnable; | |||
56 | static int gbWriteBase64Enable; | 57 | static int gbWriteBase64Enable; |
57 | static volatile unsigned char *FLASH_BASE; | 58 | static volatile unsigned char *FLASH_BASE; |
58 | static int gbFlashSize = KFLASH_SIZE; | 59 | static int gbFlashSize = KFLASH_SIZE; |
59 | static DECLARE_MUTEX(nwflash_sem); | 60 | static DEFINE_MUTEX(nwflash_mutex); |
60 | 61 | ||
61 | extern spinlock_t gpio_lock; | 62 | extern spinlock_t gpio_lock; |
62 | 63 | ||
@@ -140,7 +141,7 @@ static ssize_t flash_read(struct file *file, char __user *buf, size_t size, | |||
140 | /* | 141 | /* |
141 | * We now lock against reads and writes. --rmk | 142 | * We now lock against reads and writes. --rmk |
142 | */ | 143 | */ |
143 | if (down_interruptible(&nwflash_sem)) | 144 | if (mutex_lock_interruptible(&nwflash_mutex)) |
144 | return -ERESTARTSYS; | 145 | return -ERESTARTSYS; |
145 | 146 | ||
146 | ret = copy_to_user(buf, (void *)(FLASH_BASE + p), count); | 147 | 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, | |||
149 | *ppos += count; | 150 | *ppos += count; |
150 | } else | 151 | } else |
151 | ret = -EFAULT; | 152 | ret = -EFAULT; |
152 | up(&nwflash_sem); | 153 | mutex_unlock(&nwflash_mutex); |
153 | } | 154 | } |
154 | return ret; | 155 | return ret; |
155 | } | 156 | } |
@@ -188,7 +189,7 @@ static ssize_t flash_write(struct file *file, const char __user *buf, | |||
188 | /* | 189 | /* |
189 | * We now lock against reads and writes. --rmk | 190 | * We now lock against reads and writes. --rmk |
190 | */ | 191 | */ |
191 | if (down_interruptible(&nwflash_sem)) | 192 | if (mutex_lock_interruptible(&nwflash_mutex)) |
192 | return -ERESTARTSYS; | 193 | return -ERESTARTSYS; |
193 | 194 | ||
194 | written = 0; | 195 | written = 0; |
@@ -277,7 +278,7 @@ static ssize_t flash_write(struct file *file, const char __user *buf, | |||
277 | */ | 278 | */ |
278 | leds_event(led_release); | 279 | leds_event(led_release); |
279 | 280 | ||
280 | up(&nwflash_sem); | 281 | mutex_unlock(&nwflash_mutex); |
281 | 282 | ||
282 | return written; | 283 | return written; |
283 | } | 284 | } |