aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtdchar.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 5b081cb84351..6749c2f96342 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -450,8 +450,7 @@ static int mtd_do_readoob(struct mtd_info *mtd, uint64_t start,
450 return ret; 450 return ret;
451} 451}
452 452
453static int mtd_ioctl(struct inode *inode, struct file *file, 453static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
454 u_int cmd, u_long arg)
455{ 454{
456 struct mtd_file_info *mfi = file->private_data; 455 struct mtd_file_info *mfi = file->private_data;
457 struct mtd_info *mtd = mfi->mtd; 456 struct mtd_info *mtd = mfi->mtd;
@@ -822,6 +821,17 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
822 return ret; 821 return ret;
823} /* memory_ioctl */ 822} /* memory_ioctl */
824 823
824static long mtd_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
825{
826 int ret;
827
828 lock_kernel();
829 ret = mtd_ioctl(file, cmd, arg);
830 unlock_kernel();
831
832 return ret;
833}
834
825#ifdef CONFIG_COMPAT 835#ifdef CONFIG_COMPAT
826 836
827struct mtd_oob_buf32 { 837struct mtd_oob_buf32 {
@@ -836,7 +846,6 @@ struct mtd_oob_buf32 {
836static long mtd_compat_ioctl(struct file *file, unsigned int cmd, 846static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
837 unsigned long arg) 847 unsigned long arg)
838{ 848{
839 struct inode *inode = file->f_path.dentry->d_inode;
840 struct mtd_file_info *mfi = file->private_data; 849 struct mtd_file_info *mfi = file->private_data;
841 struct mtd_info *mtd = mfi->mtd; 850 struct mtd_info *mtd = mfi->mtd;
842 void __user *argp = compat_ptr(arg); 851 void __user *argp = compat_ptr(arg);
@@ -874,7 +883,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
874 break; 883 break;
875 } 884 }
876 default: 885 default:
877 ret = mtd_ioctl(inode, file, cmd, (unsigned long)argp); 886 ret = mtd_ioctl(file, cmd, (unsigned long)argp);
878 } 887 }
879 888
880 unlock_kernel(); 889 unlock_kernel();
@@ -942,7 +951,7 @@ static const struct file_operations mtd_fops = {
942 .llseek = mtd_lseek, 951 .llseek = mtd_lseek,
943 .read = mtd_read, 952 .read = mtd_read,
944 .write = mtd_write, 953 .write = mtd_write,
945 .ioctl = mtd_ioctl, 954 .unlocked_ioctl = mtd_unlocked_ioctl,
946#ifdef CONFIG_COMPAT 955#ifdef CONFIG_COMPAT
947 .compat_ioctl = mtd_compat_ioctl, 956 .compat_ioctl = mtd_compat_ioctl,
948#endif 957#endif