diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2008-08-01 19:01:21 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2008-08-02 02:52:39 -0400 |
commit | f1136d022af8f07a97f59c6d07483bdb82ffbd8e (patch) | |
tree | 459531ff8179263f50494ab040070ea609ebb5ff | |
parent | 759da9267177e5005c8f21e11d29d26f4f459744 (diff) |
[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>
-rw-r--r-- | 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 9b6af7e74a65..00d46e137b2a 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, | |||
125 | int (*fill_super)(struct super_block *, void *, int), | 125 | int (*fill_super)(struct super_block *, void *, int), |
126 | struct vfsmount *mnt) | 126 | struct vfsmount *mnt) |
127 | { | 127 | { |
128 | #ifdef CONFIG_BLOCK | ||
128 | struct block_device *bdev; | 129 | struct block_device *bdev; |
129 | int mtdnr, ret; | 130 | int ret, major; |
131 | #endif | ||
132 | int mtdnr; | ||
130 | 133 | ||
131 | if (!dev_name) | 134 | if (!dev_name) |
132 | return -EINVAL; | 135 | return -EINVAL; |
@@ -178,6 +181,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags, | |||
178 | } | 181 | } |
179 | } | 182 | } |
180 | 183 | ||
184 | #ifdef CONFIG_BLOCK | ||
181 | /* try the old way - the hack where we allowed users to mount | 185 | /* try the old way - the hack where we allowed users to mount |
182 | * /dev/mtdblock$(n) but didn't actually _use_ the blockdev | 186 | * /dev/mtdblock$(n) but didn't actually _use_ the blockdev |
183 | */ | 187 | */ |
@@ -190,22 +194,25 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags, | |||
190 | DEBUG(1, "MTDSB: lookup_bdev() returned 0\n"); | 194 | DEBUG(1, "MTDSB: lookup_bdev() returned 0\n"); |
191 | 195 | ||
192 | ret = -EINVAL; | 196 | ret = -EINVAL; |
193 | if (MAJOR(bdev->bd_dev) != MTD_BLOCK_MAJOR) | ||
194 | goto not_an_MTD_device; | ||
195 | 197 | ||
198 | major = MAJOR(bdev->bd_dev); | ||
196 | mtdnr = MINOR(bdev->bd_dev); | 199 | mtdnr = MINOR(bdev->bd_dev); |
197 | bdput(bdev); | 200 | bdput(bdev); |
198 | 201 | ||
202 | if (major != MTD_BLOCK_MAJOR) | ||
203 | goto not_an_MTD_device; | ||
204 | |||
199 | return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, | 205 | return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, |
200 | mnt); | 206 | mnt); |
201 | 207 | ||
202 | not_an_MTD_device: | 208 | not_an_MTD_device: |
209 | #endif /* CONFIG_BLOCK */ | ||
210 | |||
203 | if (!(flags & MS_SILENT)) | 211 | if (!(flags & MS_SILENT)) |
204 | printk(KERN_NOTICE | 212 | printk(KERN_NOTICE |
205 | "MTD: Attempt to mount non-MTD device \"%s\"\n", | 213 | "MTD: Attempt to mount non-MTD device \"%s\"\n", |
206 | dev_name); | 214 | dev_name); |
207 | bdput(bdev); | 215 | return -EINVAL; |
208 | return ret; | ||
209 | } | 216 | } |
210 | 217 | ||
211 | EXPORT_SYMBOL_GPL(get_sb_mtd); | 218 | EXPORT_SYMBOL_GPL(get_sb_mtd); |