* [PATCH/TRIVIAL] mtd: Use MTD_BLOCK_MAJOR instead of the magic number @ 2013-10-08 23:59 Ezequiel Garcia 2013-10-09 1:15 ` Brian Norris 2013-10-10 0:48 ` Brian Norris 0 siblings, 2 replies; 6+ messages in thread From: Ezequiel Garcia @ 2013-10-08 23:59 UTC (permalink / raw) To: linux-mtd; +Cc: trivial, David Woodhouse, Ezequiel Garcia Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> --- drivers/mtd/mtdblock.c | 2 +- drivers/mtd/mtdblock_ro.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c index 2aef5dd..53884cc 100644 --- a/drivers/mtd/mtdblock.c +++ b/drivers/mtd/mtdblock.c @@ -373,7 +373,7 @@ static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev) static struct mtd_blktrans_ops mtdblock_tr = { .name = "mtdblock", - .major = 31, + .major = MTD_BLOCK_MAJOR, .part_bits = 0, .blksize = 512, .open = mtdblock_open, diff --git a/drivers/mtd/mtdblock_ro.c b/drivers/mtd/mtdblock_ro.c index 92759a9..70d27b4 100644 --- a/drivers/mtd/mtdblock_ro.c +++ b/drivers/mtd/mtdblock_ro.c @@ -70,7 +70,7 @@ static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev) static struct mtd_blktrans_ops mtdblock_tr = { .name = "mtdblock", - .major = 31, + .major = MTD_BLOCK_MAJOR, .part_bits = 0, .blksize = 512, .readsect = mtdblock_readsect, -- 1.8.1.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH/TRIVIAL] mtd: Use MTD_BLOCK_MAJOR instead of the magic number 2013-10-08 23:59 [PATCH/TRIVIAL] mtd: Use MTD_BLOCK_MAJOR instead of the magic number Ezequiel Garcia @ 2013-10-09 1:15 ` Brian Norris 2013-10-09 12:02 ` Ezequiel Garcia 2013-10-10 0:48 ` Brian Norris 1 sibling, 1 reply; 6+ messages in thread From: Brian Norris @ 2013-10-09 1:15 UTC (permalink / raw) To: Ezequiel Garcia; +Cc: trivial, linux-mtd@lists.infradead.org, David Woodhouse On Tue, Oct 8, 2013 at 4:59 PM, Ezequiel Garcia <ezequiel.garcia@free-electrons.com> wrote: > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> > --- > drivers/mtd/mtdblock.c | 2 +- > drivers/mtd/mtdblock_ro.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c > index 2aef5dd..53884cc 100644 > --- a/drivers/mtd/mtdblock.c > +++ b/drivers/mtd/mtdblock.c > @@ -373,7 +373,7 @@ static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev) > > static struct mtd_blktrans_ops mtdblock_tr = { > .name = "mtdblock", > - .major = 31, > + .major = MTD_BLOCK_MAJOR, > .part_bits = 0, > .blksize = 512, > .open = mtdblock_open, > diff --git a/drivers/mtd/mtdblock_ro.c b/drivers/mtd/mtdblock_ro.c > index 92759a9..70d27b4 100644 > --- a/drivers/mtd/mtdblock_ro.c > +++ b/drivers/mtd/mtdblock_ro.c > @@ -70,7 +70,7 @@ static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev) > > static struct mtd_blktrans_ops mtdblock_tr = { > .name = "mtdblock", > - .major = 31, > + .major = MTD_BLOCK_MAJOR, > .part_bits = 0, > .blksize = 512, > .readsect = mtdblock_readsect, Patch looks good. I'll probably apply soon. Although I might like to see the following fixed along with it: Why does MTD_BLOCK_MAJOR (and MTD_CHAR_MAJOR) live in include/linux/mtd/mtd.h and not include/uapi/linux/major.h? Brian ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH/TRIVIAL] mtd: Use MTD_BLOCK_MAJOR instead of the magic number 2013-10-09 1:15 ` Brian Norris @ 2013-10-09 12:02 ` Ezequiel Garcia 2013-10-09 17:06 ` Brian Norris 0 siblings, 1 reply; 6+ messages in thread From: Ezequiel Garcia @ 2013-10-09 12:02 UTC (permalink / raw) To: Brian Norris; +Cc: trivial, linux-mtd@lists.infradead.org, David Woodhouse On Tue, Oct 08, 2013 at 06:15:21PM -0700, Brian Norris wrote: > On Tue, Oct 8, 2013 at 4:59 PM, Ezequiel Garcia > <ezequiel.garcia@free-electrons.com> wrote: > > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> > > --- > > drivers/mtd/mtdblock.c | 2 +- > > drivers/mtd/mtdblock_ro.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c > > index 2aef5dd..53884cc 100644 > > --- a/drivers/mtd/mtdblock.c > > +++ b/drivers/mtd/mtdblock.c > > @@ -373,7 +373,7 @@ static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev) > > > > static struct mtd_blktrans_ops mtdblock_tr = { > > .name = "mtdblock", > > - .major = 31, > > + .major = MTD_BLOCK_MAJOR, > > .part_bits = 0, > > .blksize = 512, > > .open = mtdblock_open, > > diff --git a/drivers/mtd/mtdblock_ro.c b/drivers/mtd/mtdblock_ro.c > > index 92759a9..70d27b4 100644 > > --- a/drivers/mtd/mtdblock_ro.c > > +++ b/drivers/mtd/mtdblock_ro.c > > @@ -70,7 +70,7 @@ static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev) > > > > static struct mtd_blktrans_ops mtdblock_tr = { > > .name = "mtdblock", > > - .major = 31, > > + .major = MTD_BLOCK_MAJOR, > > .part_bits = 0, > > .blksize = 512, > > .readsect = mtdblock_readsect, > > Patch looks good. I'll probably apply soon. Although I might like to > see the following fixed along with it: > > Why does MTD_BLOCK_MAJOR (and MTD_CHAR_MAJOR) live in > include/linux/mtd/mtd.h and not include/uapi/linux/major.h? > Ah, nice catch. How about something like this? diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index f9bfe52..9e1471e 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -24,14 +24,12 @@ #include <linux/uio.h> #include <linux/notifier.h> #include <linux/device.h> +#include <linux/major.h> #include <mtd/mtd-abi.h> #include <asm/div64.h> -#define MTD_CHAR_MAJOR 90 -#define MTD_BLOCK_MAJOR 31 - #define MTD_ERASE_PENDING 0x01 #define MTD_ERASING 0x02 #define MTD_ERASE_SUSPEND 0x04 diff --git a/include/uapi/linux/major.h b/include/uapi/linux/major.h index 6a8ca98..620252e 100644 --- a/include/uapi/linux/major.h +++ b/include/uapi/linux/major.h @@ -54,6 +54,7 @@ #define ACSI_MAJOR 28 #define AZTECH_CDROM_MAJOR 29 #define FB_MAJOR 29 /* /dev/fb* framebuffers */ +#define MTD_BLOCK_MAJOR 31 #define CM206_CDROM_MAJOR 32 #define IDE2_MAJOR 33 #define IDE3_MAJOR 34 @@ -105,6 +106,7 @@ #define IDE6_MAJOR 88 #define IDE7_MAJOR 89 #define IDE8_MAJOR 90 +#define MTD_CHAR_MAJOR 90 #define IDE9_MAJOR 91 #define DASD_MAJOR 94 -- If you think this is OK, you can take this patch and I'll cook another one moving MTD_xxx_MAJOR as above. -- Ezequiel García, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH/TRIVIAL] mtd: Use MTD_BLOCK_MAJOR instead of the magic number 2013-10-09 12:02 ` Ezequiel Garcia @ 2013-10-09 17:06 ` Brian Norris 2013-10-09 22:32 ` Ezequiel Garcia 0 siblings, 1 reply; 6+ messages in thread From: Brian Norris @ 2013-10-09 17:06 UTC (permalink / raw) To: Ezequiel Garcia; +Cc: trivial, linux-mtd@lists.infradead.org, David Woodhouse On Wed, Oct 9, 2013 at 5:02 AM, Ezequiel Garcia <ezequiel.garcia@free-electrons.com> wrote: > On Tue, Oct 08, 2013 at 06:15:21PM -0700, Brian Norris wrote: >> Why does MTD_BLOCK_MAJOR (and MTD_CHAR_MAJOR) live in >> include/linux/mtd/mtd.h and not include/uapi/linux/major.h? > > Ah, nice catch. How about something like this? > > diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h > index f9bfe52..9e1471e 100644 > --- a/include/linux/mtd/mtd.h > +++ b/include/linux/mtd/mtd.h > @@ -24,14 +24,12 @@ > #include <linux/uio.h> > #include <linux/notifier.h> > #include <linux/device.h> > +#include <linux/major.h> I think it's a (weak?) style preference that this type of #include just go in the files that need it (there are only a few -- 4 I think?) rather than importing it directly into the mtd.h header for all users. But I don't object strongly. > #include <mtd/mtd-abi.h> > > #include <asm/div64.h> > > -#define MTD_CHAR_MAJOR 90 > -#define MTD_BLOCK_MAJOR 31 > - > #define MTD_ERASE_PENDING 0x01 > #define MTD_ERASING 0x02 > #define MTD_ERASE_SUSPEND 0x04 > diff --git a/include/uapi/linux/major.h b/include/uapi/linux/major.h > index 6a8ca98..620252e 100644 > --- a/include/uapi/linux/major.h > +++ b/include/uapi/linux/major.h > @@ -54,6 +54,7 @@ > #define ACSI_MAJOR 28 > #define AZTECH_CDROM_MAJOR 29 > #define FB_MAJOR 29 /* /dev/fb* framebuffers */ > +#define MTD_BLOCK_MAJOR 31 > #define CM206_CDROM_MAJOR 32 > #define IDE2_MAJOR 33 > #define IDE3_MAJOR 34 > @@ -105,6 +106,7 @@ > #define IDE6_MAJOR 88 > #define IDE7_MAJOR 89 > #define IDE8_MAJOR 90 > +#define MTD_CHAR_MAJOR 90 > #define IDE9_MAJOR 91 > > #define DASD_MAJOR 94 > > -- > > If you think this is OK, you can take this patch and I'll cook > another one moving MTD_xxx_MAJOR as above. Yeah, the original patch here is good. I'll run it through the build tests and then apply it. Feel free to send a proper follow-up with either the diff you just sent or with the #include <linux/major.h> moved into the appropriate .c files. Thanks, Brian ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH/TRIVIAL] mtd: Use MTD_BLOCK_MAJOR instead of the magic number 2013-10-09 17:06 ` Brian Norris @ 2013-10-09 22:32 ` Ezequiel Garcia 0 siblings, 0 replies; 6+ messages in thread From: Ezequiel Garcia @ 2013-10-09 22:32 UTC (permalink / raw) To: Brian Norris; +Cc: trivial, linux-mtd@lists.infradead.org, David Woodhouse On Wed, Oct 09, 2013 at 10:06:49AM -0700, Brian Norris wrote: > On Wed, Oct 9, 2013 at 5:02 AM, Ezequiel Garcia > <ezequiel.garcia@free-electrons.com> wrote: > > On Tue, Oct 08, 2013 at 06:15:21PM -0700, Brian Norris wrote: > >> Why does MTD_BLOCK_MAJOR (and MTD_CHAR_MAJOR) live in > >> include/linux/mtd/mtd.h and not include/uapi/linux/major.h? > > > > Ah, nice catch. How about something like this? > > > > diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h > > index f9bfe52..9e1471e 100644 > > --- a/include/linux/mtd/mtd.h > > +++ b/include/linux/mtd/mtd.h > > @@ -24,14 +24,12 @@ > > #include <linux/uio.h> > > #include <linux/notifier.h> > > #include <linux/device.h> > > +#include <linux/major.h> > > I think it's a (weak?) style preference that this type of #include > just go in the files that need it (there are only a few -- 4 I think?) > rather than importing it directly into the mtd.h header for all users. > But I don't object strongly. > Right. I thought that it would be best (as in less intrusive?) to match the current behavior: mtd.h contains the major number definitions. However, I also prefer to see headers included where they're used, so let me fix a patch and let's see how that works. > > #include <mtd/mtd-abi.h> > > > > #include <asm/div64.h> > > > > -#define MTD_CHAR_MAJOR 90 > > -#define MTD_BLOCK_MAJOR 31 > > - > > #define MTD_ERASE_PENDING 0x01 > > #define MTD_ERASING 0x02 > > #define MTD_ERASE_SUSPEND 0x04 > > diff --git a/include/uapi/linux/major.h b/include/uapi/linux/major.h > > index 6a8ca98..620252e 100644 > > --- a/include/uapi/linux/major.h > > +++ b/include/uapi/linux/major.h > > @@ -54,6 +54,7 @@ > > #define ACSI_MAJOR 28 > > #define AZTECH_CDROM_MAJOR 29 > > #define FB_MAJOR 29 /* /dev/fb* framebuffers */ > > +#define MTD_BLOCK_MAJOR 31 > > #define CM206_CDROM_MAJOR 32 > > #define IDE2_MAJOR 33 > > #define IDE3_MAJOR 34 > > @@ -105,6 +106,7 @@ > > #define IDE6_MAJOR 88 > > #define IDE7_MAJOR 89 > > #define IDE8_MAJOR 90 > > +#define MTD_CHAR_MAJOR 90 > > #define IDE9_MAJOR 91 > > > > #define DASD_MAJOR 94 > > > > -- > > > > If you think this is OK, you can take this patch and I'll cook > > another one moving MTD_xxx_MAJOR as above. > > Yeah, the original patch here is good. I'll run it through the build > tests and then apply it. Feel free to send a proper follow-up with > either the diff you just sent or with the #include <linux/major.h> > moved into the appropriate .c files. > Ok. -- Ezequiel García, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH/TRIVIAL] mtd: Use MTD_BLOCK_MAJOR instead of the magic number 2013-10-08 23:59 [PATCH/TRIVIAL] mtd: Use MTD_BLOCK_MAJOR instead of the magic number Ezequiel Garcia 2013-10-09 1:15 ` Brian Norris @ 2013-10-10 0:48 ` Brian Norris 1 sibling, 0 replies; 6+ messages in thread From: Brian Norris @ 2013-10-10 0:48 UTC (permalink / raw) To: Ezequiel Garcia; +Cc: trivial, linux-mtd, David Woodhouse On Tue, Oct 08, 2013 at 08:59:08PM -0300, Ezequiel Garcia wrote: > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> > --- > drivers/mtd/mtdblock.c | 2 +- > drivers/mtd/mtdblock_ro.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c > index 2aef5dd..53884cc 100644 > --- a/drivers/mtd/mtdblock.c > +++ b/drivers/mtd/mtdblock.c > @@ -373,7 +373,7 @@ static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev) > > static struct mtd_blktrans_ops mtdblock_tr = { > .name = "mtdblock", > - .major = 31, > + .major = MTD_BLOCK_MAJOR, > .part_bits = 0, > .blksize = 512, > .open = mtdblock_open, > diff --git a/drivers/mtd/mtdblock_ro.c b/drivers/mtd/mtdblock_ro.c > index 92759a9..70d27b4 100644 > --- a/drivers/mtd/mtdblock_ro.c > +++ b/drivers/mtd/mtdblock_ro.c > @@ -70,7 +70,7 @@ static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev) > > static struct mtd_blktrans_ops mtdblock_tr = { > .name = "mtdblock", > - .major = 31, > + .major = MTD_BLOCK_MAJOR, > .part_bits = 0, > .blksize = 512, > .readsect = mtdblock_readsect, Pushed to l2-mtd.git. Thanks! Brian ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-10-10 0:48 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-10-08 23:59 [PATCH/TRIVIAL] mtd: Use MTD_BLOCK_MAJOR instead of the magic number Ezequiel Garcia 2013-10-09 1:15 ` Brian Norris 2013-10-09 12:02 ` Ezequiel Garcia 2013-10-09 17:06 ` Brian Norris 2013-10-09 22:32 ` Ezequiel Garcia 2013-10-10 0:48 ` Brian Norris
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox