Skip to contentSkip to conversation

mtd: fix broken name_to_dev_t() declaration

PATCH In review Herbert Poetzl 2 participants 3 messages Mar 23, 2006 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: fix broken name_to_dev_t() declaration

Hi Andrew! Folks!

drivers/mtd/devices/blkmtd.c uses a local declaration of name_to_dev_t() which is inconsistant with the real one. the following patch fixes this by removing the local declaration and including mount.h instead

this patch was originally done by Micah Anderson.

best,
Herbert

---

drivers/mtd/devices/blkmtd.c renamed from drivers/mtd/devices/blkmtd.c.orig +1 -2
@@ -28,6 +28,7 @@
 #include <linux/pagemap.h>
 #include <linux/list.h>
 #include <linux/init.h>
+#include <linux/mount.h>
 #include <linux/mtd/mtd.h>
 
 
@@ -614,8 +615,6 @@ static struct mtd_erase_region_info *cal
 }
 
 
-extern dev_t __init name_to_dev_t(const char *line);
-
 static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size)
 {
 	struct block_device *bdev;
#1 lore raw
Quoted 5 lines · Herbert Poetzl

drivers/mtd/devices/blkmtd.c uses a local declaration of name_to_dev_t() which is inconsistant with the real one. the following patch fixes this by removing the local declaration and including mount.h instead

OK..

Does that name_to_dev_t() call actually work? In my experience, name_to_dev_t() just doesn't work if called at times other than during early boot.

#ifdef MODULE
	mode = (readonly) ? O_RDONLY : O_RDWR;
	bdev = open_bdev_excl(devname, mode, NULL);
#else
	mode = (readonly) ? FMODE_READ : FMODE_WRITE;
	bdev = open_by_devnum(name_to_dev_t(devname), mode);

#endif

OK, I guess it still works at initcall-time. Still, the code is a bit, err, innovative.

#2 lore raw
Quoted 19 lines · Andrew Morton
Quoted 5 lines · Herbert Poetzl

drivers/mtd/devices/blkmtd.c uses a local declaration of name_to_dev_t() which is inconsistant with the real one. the following patch fixes this by removing the local declaration and including mount.h instead

OK..

Does that name_to_dev_t() call actually work? In my experience, name_to_dev_t() just doesn't work if called at times other than during early boot.

#ifdef MODULE
	mode = (readonly) ? O_RDONLY : O_RDWR;
	bdev = open_bdev_excl(devname, mode, NULL);
#else
	mode = (readonly) ? FMODE_READ : FMODE_WRITE;
	bdev = open_by_devnum(name_to_dev_t(devname), mode);
Quoted 4 lines

#endif

OK, I guess it still works at initcall-time. Still, the code is a bit, err, innovative.

ah, well, I was not judging the mtd code ...
just fixing an issue which popped up :)

best,
Herbert