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>
int (*fill_super)(struct super_block *, void *, int),
struct vfsmount *mnt)
{
int (*fill_super)(struct super_block *, void *, int),
struct vfsmount *mnt)
{
struct block_device *bdev;
struct block_device *bdev;
+ int ret, major;
+#endif
+ int mtdnr;
if (!dev_name)
return -EINVAL;
if (!dev_name)
return -EINVAL;
/* try the old way - the hack where we allowed users to mount
* /dev/mtdblock$(n) but didn't actually _use_ the blockdev
*/
/* try the old way - the hack where we allowed users to mount
* /dev/mtdblock$(n) but didn't actually _use_ the blockdev
*/
DEBUG(1, "MTDSB: lookup_bdev() returned 0\n");
ret = -EINVAL;
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);
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:
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);
if (!(flags & MS_SILENT))
printk(KERN_NOTICE
"MTD: Attempt to mount non-MTD device \"%s\"\n",
dev_name);
- bdput(bdev);
- return ret;
}
EXPORT_SYMBOL_GPL(get_sb_mtd);
}
EXPORT_SYMBOL_GPL(get_sb_mtd);