]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/mtd/mtdchar.c
Merge git://git.infradead.org/mtd-2.6
[mv-sheeva.git] / drivers / mtd / mtdchar.c
index c27e65e3e291a8b287c2e7561a4cd74aa976cbc5..a825002123c84bc0a24ce26e00400be277b09c22 100644 (file)
@@ -1,5 +1,19 @@
 /*
- * Character-device access to raw MTD devices.
+ * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
 
@@ -19,7 +33,6 @@
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
-#include <linux/mtd/compatmac.h>
 
 #include <asm/uaccess.h>
 
@@ -464,8 +477,7 @@ static int mtd_do_readoob(struct mtd_info *mtd, uint64_t start,
        return ret;
 }
 
-static int mtd_ioctl(struct inode *inode, struct file *file,
-                    u_int cmd, u_long arg)
+static int 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;
@@ -850,6 +862,17 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
        return ret;
 } /* memory_ioctl */
 
+static long mtd_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
+{
+       int ret;
+
+       lock_kernel();
+       ret = mtd_ioctl(file, cmd, arg);
+       unlock_kernel();
+
+       return ret;
+}
+
 #ifdef CONFIG_COMPAT
 
 struct mtd_oob_buf32 {
@@ -864,7 +887,6 @@ struct mtd_oob_buf32 {
 static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
        unsigned long arg)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
        struct mtd_file_info *mfi = file->private_data;
        struct mtd_info *mtd = mfi->mtd;
        void __user *argp = compat_ptr(arg);
@@ -902,7 +924,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
                break;
        }
        default:
-               ret = mtd_ioctl(inode, file, cmd, (unsigned long)argp);
+               ret = mtd_ioctl(file, cmd, (unsigned long)argp);
        }
 
        unlock_kernel();
@@ -995,7 +1017,7 @@ static const struct file_operations mtd_fops = {
        .llseek         = mtd_lseek,
        .read           = mtd_read,
        .write          = mtd_write,
-       .ioctl          = mtd_ioctl,
+       .unlocked_ioctl = mtd_unlocked_ioctl,
 #ifdef CONFIG_COMPAT
        .compat_ioctl   = mtd_compat_ioctl,
 #endif