aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdchar.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-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 8bb5e4a66328..000d65ea55a4 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -468,8 +468,7 @@ static int mtd_do_readoob(struct mtd_info *mtd, uint64_t start,
468 return ret; 468 return ret;
469} 469}
470 470
471static int mtd_ioctl(struct inode *inode, struct file *file, 471static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
472 u_int cmd, u_long arg)
473{ 472{
474 struct mtd_file_info *mfi = file->private_data; 473 struct mtd_file_info *mfi = file->private_data;
475 struct mtd_info *mtd = mfi->mtd; 474 struct mtd_info *mtd = mfi->mtd;
@@ -840,6 +839,17 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
840 return ret; 839 return ret;
841} /* memory_ioctl */ 840} /* memory_ioctl */
842 841
842static long mtd_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
843{
844 int ret;
845
846 lock_kernel();
847 ret = mtd_ioctl(file, cmd, arg);
848 unlock_kernel();
849
850 return ret;
851}
852
843#ifdef CONFIG_COMPAT 853#ifdef CONFIG_COMPAT
844 854
845struct mtd_oob_buf32 { 855struct mtd_oob_buf32 {
@@ -854,7 +864,6 @@ struct mtd_oob_buf32 {
854static long mtd_compat_ioctl(struct file *file, unsigned int cmd, 864static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
855 unsigned long arg) 865 unsigned long arg)
856{ 866{
857 struct inode *inode = file->f_path.dentry->d_inode;
858 struct mtd_file_info *mfi = file->private_data; 867 struct mtd_file_info *mfi = file->private_data;
859 struct mtd_info *mtd = mfi->mtd; 868 struct mtd_info *mtd = mfi->mtd;
860 void __user *argp = compat_ptr(arg); 869 void __user *argp = compat_ptr(arg);
@@ -892,7 +901,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
892 break; 901 break;
893 } 902 }
894 default: 903 default:
895 ret = mtd_ioctl(inode, file, cmd, (unsigned long)argp); 904 ret = mtd_ioctl(file, cmd, (unsigned long)argp);
896 } 905 }
897 906
898 unlock_kernel(); 907 unlock_kernel();
@@ -960,7 +969,7 @@ static const struct file_operations mtd_fops = {
960 .llseek = mtd_lseek, 969 .llseek = mtd_lseek,
961 .read = mtd_read, 970 .read = mtd_read,
962 .write = mtd_write, 971 .write = mtd_write,
963 .ioctl = mtd_ioctl, 972 .unlocked_ioctl = mtd_unlocked_ioctl,
964#ifdef CONFIG_COMPAT 973#ifdef CONFIG_COMPAT
965 .compat_ioctl = mtd_compat_ioctl, 974 .compat_ioctl = mtd_compat_ioctl,
966#endif 975#endif