Skip to contentSkip to conversation

mtd: Switch to unlocked_ioctl and do BKL in the mtd layer

PATCH New Alan Cox 1 participant 1 message May 22, 2008

Subsystems (2)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 mtd: Switch to unlocked_ioctl and do BKL in the mtd layer

This helps us get to the point of removing ->ioctl and getting drivers fixed.

drivers/mtd/mtdchar.c +12 -3
index 5d3ac51..d2e63fa 100644
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/compatmac.h>
@@ -369,8 +370,7 @@ static int otp_select_filemode(struct mtd_file_info *mfi, int mode)
 # define otp_select_filemode(f,m)	-EOPNOTSUPP
 #endif
 
-static int mtd_ioctl(struct inode *inode, struct file *file,
-		     u_int cmd, u_long arg)
+static long do_mtd_ioctl(struct file *file, u_int cmd, u_long arg)
 {
 	struct mtd_file_info *mfi = file->private_data;
 	struct mtd_info *mtd = mfi->mtd;
@@ -764,12 +764,21 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
 	return ret;
 } /* memory_ioctl */
 
+static long mtd_ioctl(struct file *file, u_int cmd, u_long arg)
+{
+	long ret;
+	lock_kernel();
+	ret = do_mtd_ioctl(file, cmd, arg);
+	unlock_kernel();
+	return ret;
+}
+
 static const struct file_operations mtd_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= mtd_lseek,
 	.read		= mtd_read,
 	.write		= mtd_write,
-	.ioctl		= mtd_ioctl,
+	.unlocked_ioctl	= mtd_ioctl,
 	.open		= mtd_open,
 	.release	= mtd_close,
 };
drivers/mtd/ubi/cdev.c +30 -11

117 lines not on this page · raw message