aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdchar.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-10-30 07:35:11 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-30 07:35:11 -0400
commit67577927e8d7a1f4b09b4992df640eadc6aacb36 (patch)
tree2e9efe6b5745965faf0dcc084d4613d9356263f9 /drivers/mtd/mtdchar.c
parent6fe4c590313133ebd5dadb769031489ff178ece1 (diff)
parent51f00a471ce8f359627dd99aeac322947a0e491b (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Conflicts: drivers/mtd/mtd_blkdevs.c Merge Grant's device-tree bits so that we can apply the subsequent fixes. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-rw-r--r--drivers/mtd/mtdchar.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index b7ed09c57903..3eff1e562ad3 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -26,7 +26,7 @@
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/sched.h> 28#include <linux/sched.h>
29#include <linux/smp_lock.h> 29#include <linux/mutex.h>
30#include <linux/backing-dev.h> 30#include <linux/backing-dev.h>
31#include <linux/compat.h> 31#include <linux/compat.h>
32#include <linux/mount.h> 32#include <linux/mount.h>
@@ -38,6 +38,7 @@
38#include <asm/uaccess.h> 38#include <asm/uaccess.h>
39 39
40#define MTD_INODE_FS_MAGIC 0x11307854 40#define MTD_INODE_FS_MAGIC 0x11307854
41static DEFINE_MUTEX(mtd_mutex);
41static struct vfsmount *mtd_inode_mnt __read_mostly; 42static struct vfsmount *mtd_inode_mnt __read_mostly;
42 43
43/* 44/*
@@ -91,7 +92,7 @@ static int mtd_open(struct inode *inode, struct file *file)
91 if ((file->f_mode & FMODE_WRITE) && (minor & 1)) 92 if ((file->f_mode & FMODE_WRITE) && (minor & 1))
92 return -EACCES; 93 return -EACCES;
93 94
94 lock_kernel(); 95 mutex_lock(&mtd_mutex);
95 mtd = get_mtd_device(NULL, devnum); 96 mtd = get_mtd_device(NULL, devnum);
96 97
97 if (IS_ERR(mtd)) { 98 if (IS_ERR(mtd)) {
@@ -139,7 +140,7 @@ static int mtd_open(struct inode *inode, struct file *file)
139 file->private_data = mfi; 140 file->private_data = mfi;
140 141
141out: 142out:
142 unlock_kernel(); 143 mutex_unlock(&mtd_mutex);
143 return ret; 144 return ret;
144} /* mtd_open */ 145} /* mtd_open */
145 146
@@ -967,9 +968,9 @@ static long mtd_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
967{ 968{
968 int ret; 969 int ret;
969 970
970 lock_kernel(); 971 mutex_lock(&mtd_mutex);
971 ret = mtd_ioctl(file, cmd, arg); 972 ret = mtd_ioctl(file, cmd, arg);
972 unlock_kernel(); 973 mutex_unlock(&mtd_mutex);
973 974
974 return ret; 975 return ret;
975} 976}
@@ -993,7 +994,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
993 void __user *argp = compat_ptr(arg); 994 void __user *argp = compat_ptr(arg);
994 int ret = 0; 995 int ret = 0;
995 996
996 lock_kernel(); 997 mutex_lock(&mtd_mutex);
997 998
998 switch (cmd) { 999 switch (cmd) {
999 case MEMWRITEOOB32: 1000 case MEMWRITEOOB32:
@@ -1028,7 +1029,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
1028 ret = mtd_ioctl(file, cmd, (unsigned long)argp); 1029 ret = mtd_ioctl(file, cmd, (unsigned long)argp);
1029 } 1030 }
1030 1031
1031 unlock_kernel(); 1032 mutex_unlock(&mtd_mutex);
1032 1033
1033 return ret; 1034 return ret;
1034} 1035}