[MTD] Fix !CONFIG_BLOCK compile for mtdsuper.c

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, August 4, 2008 - 10:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f1136d...
Commit:     f1136d022af8f07a97f59c6d07483bdb82ffbd8e
Parent:     759da9267177e5005c8f21e11d29d26f4f459744
Author:     David Woodhouse <David.Woodhouse@intel.com>
AuthorDate: Sat Aug 2 00:01:21 2008 +0100
Committer:  David Woodhouse <David.Woodhouse@intel.com>
CommitDate: Sat Aug 2 07:52:39 2008 +0100

    [MTD] Fix !CONFIG_BLOCK compile for mtdsuper.c
    
    As reported by Adrian Bunk, commit d5686b444ff3f72808d2b3fbd58672a86cdf38e7
    (switch mtd and dm-table to lookup_bdev()) causes the following compile
    error with CONFIG_BLOCK=n:
    
      CC      drivers/mtd/mtdsuper.o
    drivers/mtd/mtdsuper.c: In function `get_sb_mtd':
    drivers/mtd/mtdsuper.c:184: error: implicit declaration of function 'lookup_bdev'
    drivers/mtd/mtdsuper.c:184: warning: assignment makes pointer from integer without a cast
    drivers/mtd/mtdsuper.c:197: error: implicit declaration of function 'bdput'
    make[3]: *** [drivers/mtd/mtdsuper.o] Error 1
    
    Fix it by putting the block device lookup inside #ifdef CONFIG_BLOCK
    
    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
 drivers/mtd/mtdsuper.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index 9b6af7e..00d46e1 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -125,8 +125,11 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
 	       int (*fill_super)(struct super_block *, void *, int),
 	       struct vfsmount *mnt)
 {
+#ifdef CONFIG_BLOCK
 	struct block_device *bdev;
-	int mtdnr, ret;
+	int ret, major;
+#endif
+	int mtdnr;
 
 	if (!dev_name)
 		return -EINVAL;
@@ -178,6 +181,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
 		}
 	}
 
+#ifdef CONFIG_BLOCK
 	/* try the old way - the hack where we allowed users to mount
 	 * /dev/mtdblock$(n) but didn't actually _use_ the blockdev
 	 */
@@ -190,22 +194,25 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
 	DEBUG(1, "MTDSB: lookup_bdev() returned 0\n");
 
 	ret = -EINVAL;
-	if (MAJOR(bdev->bd_dev) != MTD_BLOCK_MAJOR)
-		goto not_an_MTD_device;
 
+	major = MAJOR(bdev->bd_dev);
 	mtdnr = MINOR(bdev->bd_dev);
 	bdput(bdev);
 
+	if (major != MTD_BLOCK_MAJOR)
+		goto not_an_MTD_device;
+
 	return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
 			     mnt);
 
 not_an_MTD_device:
+#endif /* CONFIG_BLOCK */
+
 	if (!(flags & MS_SILENT))
 		printk(KERN_NOTICE
 		       "MTD: Attempt to mount non-MTD device \"%s\"\n",
 		       dev_name);
-	bdput(bdev);
-	return ret;
+	return -EINVAL;
 }
 
 EXPORT_SYMBOL_GPL(get_sb_mtd);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[MTD] Fix !CONFIG_BLOCK compile for mtdsuper.c, Linux Kernel Mailing ..., (Mon Aug 4, 10:59 am)