]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/mtd/mtdchar.c
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds
[linux-2.6-omap-h63xx.git] / drivers / mtd / mtdchar.c
index 963840e9b5bf3d25177baa281b3eb70769d69950..bcffeda2df3d680babc66906151dd3641ec57208 100644 (file)
@@ -96,7 +96,7 @@ static int mtd_open(struct inode *inode, struct file *file)
                return -ENODEV;
 
        /* You can't open the RO devices RW */
-       if ((file->f_mode & 2) && (minor & 1))
+       if ((file->f_mode & FMODE_WRITE) && (minor & 1))
                return -EACCES;
 
        lock_kernel();
@@ -114,7 +114,7 @@ static int mtd_open(struct inode *inode, struct file *file)
        }
 
        /* You can't open it RW if it's not a writeable device */
-       if ((file->f_mode & 2) && !(mtd->flags & MTD_WRITEABLE)) {
+       if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) {
                put_mtd_device(mtd);
                ret = -EACCES;
                goto out;
@@ -144,7 +144,7 @@ static int mtd_close(struct inode *inode, struct file *file)
        DEBUG(MTD_DEBUG_LEVEL0, "MTD_close\n");
 
        /* Only sync if opened RW */
-       if ((file->f_mode & 2) && mtd->sync)
+       if ((file->f_mode & FMODE_WRITE) && mtd->sync)
                mtd->sync(mtd);
 
        put_mtd_device(mtd);
@@ -443,7 +443,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
        {
                struct erase_info *erase;
 
-               if(!(file->f_mode & 2))
+               if(!(file->f_mode & FMODE_WRITE))
                        return -EPERM;
 
                erase=kzalloc(sizeof(struct erase_info),GFP_KERNEL);
@@ -497,7 +497,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
                struct mtd_oob_buf __user *user_buf = argp;
                uint32_t retlen;
 
-               if(!(file->f_mode & 2))
+               if(!(file->f_mode & FMODE_WRITE))
                        return -EPERM;
 
                if (copy_from_user(&buf, argp, sizeof(struct mtd_oob_buf)))