summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-15 10:15:38 -0600
committerJonathan Corbet <corbet@lwn.net>2008-06-20 14:03:43 -0600
commit72b67048f5dac18fd6494e3d3bff7e54840e8761 (patch)
tree5cafbc58d82544562ee6241f088bf926ef1bbe35 /drivers/mtd
parent6071239ef1947914892601e36785c7b1cf8b7dd4 (diff)
downloadop-kernel-dev-72b67048f5dac18fd6494e3d3bff7e54840e8761.zip
op-kernel-dev-72b67048f5dac18fd6494e3d3bff7e54840e8761.tar.gz
UBI: cdev lock_kernel() pushdown
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/cdev.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 9d6aae5..89193ba 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -39,6 +39,7 @@
#include <linux/stat.h>
#include <linux/ioctl.h>
#include <linux/capability.h>
+#include <linux/smp_lock.h>
#include <mtd/ubi-user.h>
#include <asm/uaccess.h>
#include <asm/div64.h>
@@ -103,9 +104,12 @@ static int vol_cdev_open(struct inode *inode, struct file *file)
struct ubi_volume_desc *desc;
int vol_id = iminor(inode) - 1, mode, ubi_num;
+ lock_kernel();
ubi_num = ubi_major2num(imajor(inode));
- if (ubi_num < 0)
+ if (ubi_num < 0) {
+ unlock_kernel();
return ubi_num;
+ }
if (file->f_mode & FMODE_WRITE)
mode = UBI_READWRITE;
@@ -115,6 +119,7 @@ static int vol_cdev_open(struct inode *inode, struct file *file)
dbg_msg("open volume %d, mode %d", vol_id, mode);
desc = ubi_open_volume(ubi_num, vol_id, mode);
+ unlock_kernel();
if (IS_ERR(desc))
return PTR_ERR(desc);
OpenPOWER on IntegriCloud