Message ID | 1304692143-22432-10-git-send-email-jamie@jamieiles.com |
---|---|
State | RFC |
Headers | show |
On Fri, 2011-05-06 at 15:29 +0100, Jamie Iles wrote: > If CONFIG_MTD_PARTITION is enabled then take the partitions from the > platform data. > > Cc: David Woodhouse <dwmw2@infradead.org> > Cc: Chuanxiao Dong <chuanxiao.dong@intel.com> > Signed-off-by: Jamie Iles <jamie@jamieiles.com> > --- > drivers/mtd/nand/denali.c | 8 ++++++++ > include/linux/platform_data/denali.h | 6 +++++- > 2 files changed, 13 insertions(+), 1 deletions(-) > > diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c > index c79009f..ae954de 100644 > --- a/drivers/mtd/nand/denali.c > +++ b/drivers/mtd/nand/denali.c > @@ -23,6 +23,7 @@ > #include <linux/mutex.h> > #include <linux/slab.h> > #include <linux/mtd/mtd.h> > +#include <linux/mtd/partitions.h> > #include <linux/module.h> > #include <linux/platform_data/denali.h> > > @@ -1563,7 +1564,14 @@ int denali_init(struct denali_nand_info *denali) > goto failed_req_irq; > } > > +#ifdef CONFIG_MTD_PARTITIONS > + if (pdata && pdata->parts) { > + ret = add_mtd_partitions(&denali->mtd, pdata->parts, > + pdata->nr_parts); > + } else > +#endif /* CONFIG_MTD_PARTITIONS */ > ret = add_mtd_device(&denali->mtd); > + Oops: http://www.linux-mtd.infradead.org/doc/general.html#L_partitions_ban
On Fri, May 06, 2011 at 09:43:17PM +0300, Artem Bityutskiy wrote: > On Fri, 2011-05-06 at 16:18 +0100, Jamie Iles wrote: > > On 6 May 2011 15:33, Artem Bityutskiy <dedekind1@gmail.com> wrote: > > > On Fri, 2011-05-06 at 15:29 +0100, Jamie Iles wrote: > > >> If CONFIG_MTD_PARTITION is enabled then take the partitions from the > > >> platform data. > > >> > > >> Cc: David Woodhouse <dwmw2@infradead.org> > > >> Cc: Chuanxiao Dong <chuanxiao.dong@intel.com> > > >> Signed-off-by: Jamie Iles <jamie@jamieiles.com> > > >> --- > > >> drivers/mtd/nand/denali.c | 8 ++++++++ > > >> include/linux/platform_data/denali.h | 6 +++++- > > >> 2 files changed, 13 insertions(+), 1 deletions(-) > > >> > > >> diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c > > >> index c79009f..ae954de 100644 > > >> --- a/drivers/mtd/nand/denali.c > > >> +++ b/drivers/mtd/nand/denali.c > > >> @@ -23,6 +23,7 @@ > > >> #include <linux/mutex.h> > > >> #include <linux/slab.h> > > >> #include <linux/mtd/mtd.h> > > >> +#include <linux/mtd/partitions.h> > > >> #include <linux/module.h> > > >> #include <linux/platform_data/denali.h> > > >> > > >> @@ -1563,7 +1564,14 @@ int denali_init(struct denali_nand_info *denali) > > >> goto failed_req_irq; > > >> } > > >> > > >> +#ifdef CONFIG_MTD_PARTITIONS > > >> + if (pdata && pdata->parts) { > > >> + ret = add_mtd_partitions(&denali->mtd, pdata->parts, > > >> + pdata->nr_parts); > > >> + } else > > >> +#endif /* CONFIG_MTD_PARTITIONS */ > > >> ret = add_mtd_device(&denali->mtd); > > >> + > > > > > > Oops: > > > http://www.linux-mtd.infradead.org/doc/general.html#L_partitions_ban > > > > Oops indeed. Thanks for pointing that out. Just for my clarification: > > making the denali config select MTD_PARTITIONS for this patch then > > removing the preprocessor garbage and always calling > > add_mtd_partitions would *not* be ok? > > No :-) That's the whole point of the ban - no one wants to clean up the > crap and everyone wants to just get patches in ASAP. OK, I just wanted to make sure that I'd read it properly. > So I suggest you to separate this patch, and make the rest to go in > independently, and then solve the partitions issue separately, if you > have time/will/etc. Will do. I will try and have a look at a proper global fix soon too. > Please, do not remove the mailing list from CC. Sorry, finger trouble! Jamie
diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index c79009f..ae954de 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -23,6 +23,7 @@ #include <linux/mutex.h> #include <linux/slab.h> #include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> #include <linux/module.h> #include <linux/platform_data/denali.h> @@ -1563,7 +1564,14 @@ int denali_init(struct denali_nand_info *denali) goto failed_req_irq; } +#ifdef CONFIG_MTD_PARTITIONS + if (pdata && pdata->parts) { + ret = add_mtd_partitions(&denali->mtd, pdata->parts, + pdata->nr_parts); + } else +#endif /* CONFIG_MTD_PARTITIONS */ ret = add_mtd_device(&denali->mtd); + if (ret) { dev_err(denali->dev, "failed to register MTD: %d\n", ret); goto failed_req_irq; diff --git a/include/linux/platform_data/denali.h b/include/linux/platform_data/denali.h index cfdb775..e9e415b 100644 --- a/include/linux/platform_data/denali.h +++ b/include/linux/platform_data/denali.h @@ -14,8 +14,12 @@ #ifndef __DENALI_PDATA_H__ #define __DENALI_PDATA_H__ +struct mtd_partition; + struct denali_nand_pdata { - int nr_ecc_bits; + int nr_ecc_bits; + const struct mtd_partition *parts; + unsigned int nr_parts; }; #endif /* __DENALI_PDATA_H__ */
If CONFIG_MTD_PARTITION is enabled then take the partitions from the platform data. Cc: David Woodhouse <dwmw2@infradead.org> Cc: Chuanxiao Dong <chuanxiao.dong@intel.com> Signed-off-by: Jamie Iles <jamie@jamieiles.com> --- drivers/mtd/nand/denali.c | 8 ++++++++ include/linux/platform_data/denali.h | 6 +++++- 2 files changed, 13 insertions(+), 1 deletions(-)