2006-03-23 20:02:08

by Herbert Poetzl

[permalink] [raw]
Subject: [PATCH] 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

Signed-off-by: Herbert Poetzl <[email protected]>
Acked-by: Micah Anderson <[email protected]>
Acked-by: Daniel Hokka Zakrisson <[email protected]>
---

--- ./drivers/mtd/devices/blkmtd.c.orig 2006-01-03 17:29:35 +0100
+++ ./drivers/mtd/devices/blkmtd.c 2006-03-23 20:53:58 +0100
@@ -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;


2006-03-23 23:44:23

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] mtd: fix broken name_to_dev_t() declaration

Herbert Poetzl <[email protected]> wrote:
>
> 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.

2006-03-23 23:51:47

by Herbert Poetzl

[permalink] [raw]
Subject: Re: [PATCH] mtd: fix broken name_to_dev_t() declaration

On Thu, Mar 23, 2006 at 03:46:25PM -0800, Andrew Morton wrote:
> Herbert Poetzl <[email protected]> wrote:
> >
> > 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.

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

best,
Herbert