aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/nwflash.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/char/nwflash.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/char/nwflash.c')
-rw-r--r--drivers/char/nwflash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c
index 043a1c7b86be..a12f52400dbc 100644
--- a/drivers/char/nwflash.c
+++ b/drivers/char/nwflash.c
@@ -25,7 +25,6 @@
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/rwsem.h> 26#include <linux/rwsem.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/smp_lock.h>
29#include <linux/mutex.h> 28#include <linux/mutex.h>
30#include <linux/jiffies.h> 29#include <linux/jiffies.h>
31 30
@@ -41,6 +40,7 @@
41 40
42#define NWFLASH_VERSION "6.4" 41#define NWFLASH_VERSION "6.4"
43 42
43static DEFINE_MUTEX(flash_mutex);
44static void kick_open(void); 44static void kick_open(void);
45static int get_flash_id(void); 45static int get_flash_id(void);
46static int erase_block(int nBlock); 46static int erase_block(int nBlock);
@@ -96,7 +96,7 @@ static int get_flash_id(void)
96 96
97static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) 97static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
98{ 98{
99 lock_kernel(); 99 mutex_lock(&flash_mutex);
100 switch (cmd) { 100 switch (cmd) {
101 case CMD_WRITE_DISABLE: 101 case CMD_WRITE_DISABLE:
102 gbWriteBase64Enable = 0; 102 gbWriteBase64Enable = 0;
@@ -114,10 +114,10 @@ static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
114 default: 114 default:
115 gbWriteBase64Enable = 0; 115 gbWriteBase64Enable = 0;
116 gbWriteEnable = 0; 116 gbWriteEnable = 0;
117 unlock_kernel(); 117 mutex_unlock(&flash_mutex);
118 return -EINVAL; 118 return -EINVAL;
119 } 119 }
120 unlock_kernel(); 120 mutex_unlock(&flash_mutex);
121 return 0; 121 return 0;
122} 122}
123 123
@@ -282,7 +282,7 @@ static loff_t flash_llseek(struct file *file, loff_t offset, int orig)
282{ 282{
283 loff_t ret; 283 loff_t ret;
284 284
285 lock_kernel(); 285 mutex_lock(&flash_mutex);
286 if (flashdebug) 286 if (flashdebug)
287 printk(KERN_DEBUG "flash_llseek: offset=0x%X, orig=0x%X.\n", 287 printk(KERN_DEBUG "flash_llseek: offset=0x%X, orig=0x%X.\n",
288 (unsigned int) offset, orig); 288 (unsigned int) offset, orig);
@@ -317,7 +317,7 @@ static loff_t flash_llseek(struct file *file, loff_t offset, int orig)
317 default: 317 default:
318 ret = -EINVAL; 318 ret = -EINVAL;
319 } 319 }
320 unlock_kernel(); 320 mutex_unlock(&flash_mutex);
321 return ret; 321 return ret;
322} 322}
323 323