Cleanup of parse/register scenario
Subsystems (5)
cover Cleanup of parse/register scenario
Lots of mtd drivers have more or less the same common logic:
parse partitions, then register them. Currently this ends up with lots of code duplication, each copy having it's own features and bugs. In this patch serie I create a special function (mtd_device_parse_register) which handles all issues with acquiring partition information, registering mtd device(s) and returning correct error code.
The following changes since commit 85bd7e882840f4cb4d213768d252c754f22440ac:
mtd: pxa3xx_nand: Fix blank page ECC mismatch (2011-06-07 15:40:29 +0300)
are available in the git repository at:
git://git.infradead.org/users/dbaryshkov/mtd-cleanup.git mtd-parse-1st
Dmitry Eremin-Solenikov (44):
mtd: add new API for handling MTD registration
mtd: lart.c: use mtd_device_parse_register
mtd: mtd_dataflash.c: use mtd_device_parse_register
mtd: sst25l.c: use mtd_device_parse_register
mtd: bfin-async-flash.c: use mtd_device_parse_register
mtd: dc21285.c: use mtd_device_parse_register
mtd: gpio-addr-flash.c: use mtd_device_parse_register
mtd: h720x-flash.c: use mtd_device_parse_register
mtd: impa7.c: use mtd_device_parse_register
mtd: intel_vr_nor.c: use mtd_device_parse_register
mtd: ixp2000.c: use mtd_device_parse_register
mtd: ixp4xx.c: use mtd_device_parse_register
mtd: lantiq-flash.c: use mtd_device_parse_register
mtd: latch-addr-flash.c: use mtd_device_parse_register
mtd: physmap.c: use mtd_device_parse_register
mtd: plat-ram.c: use mtd_device_parse_register
mtd: pxa2xx-flash.c: use mtd_device_parse_register
mtd: rbtx4939-flash.c: use mtd_device_parse_register
mtd: sa1100-flash.c: use mtd_device_parse_register
mtd: solutionengine.c: use mtd_device_parse_register
mtd: wr_sbc82xx_flash.c: use mtd_device_parse_register
mtd: atmel_nand.c: use mtd_device_parse_register
mtd: bcm_umi_nand.c: use mtd_device_parse_register
mtd: cafe_nand.c: use mtd_device_parse_register
mtd: cmx270_nand.c: use mtd_device_parse_register
mtd: cs553x_nand.c: use mtd_device_parse_register
mtd: davinci_nand.c: use mtd_device_parse_register
mtd: edb7312.c: use mtd_device_parse_register
mtd: fsmc_nand.c: use mtd_device_parse_register
mtd: h1910.c: use mtd_device_parse_register
mtd: jz4740_nand.c: use mtd_device_parse_register
mtd: mxc_nand.c: use mtd_device_parse_register
mtd: omap2.c: use mtd_device_parse_register
mtd: orion_nand.c: use mtd_device_parse_register
mtd: plat_nand.c: use mtd_device_parse_register
mtd: ppchameleonevb.c: use mtd_device_parse_register
mtd: pxa3xx_nand.c: use mtd_device_parse_register
mtd: s3c2410.c: use mtd_device_parse_register
mtd: sharpsl.c: use mtd_device_parse_register
mtd: tmio_nand.c: use mtd_device_parse_register
mtd: txx9ndfmc.c: use mtd_device_parse_register
mtd: onenand/generic.c: use mtd_device_parse_register
mtd: onenand/omap2.c: use mtd_device_parse_register
mtd: onenand/samsung.c: use mtd_device_parse_register
drivers/mtd/devices/lart.c | 12 ++---- drivers/mtd/devices/mtd_dataflash.c | 21 ++--------- drivers/mtd/devices/sst25l.c | 32 ++--------------- drivers/mtd/maps/bfin-async-flash.c | 16 +------- drivers/mtd/maps/dc21285.c | 9 +---- drivers/mtd/maps/gpio-addr-flash.c | 16 +------- drivers/mtd/maps/h720x-flash.c | 21 +---------- drivers/mtd/maps/impa7.c | 25 ++----------- drivers/mtd/maps/intel_vr_nor.c | 6 +--- drivers/mtd/maps/ixp2000.c | 11 +----- drivers/mtd/maps/ixp4xx.c | 29 ++------------- drivers/mtd/maps/lantiq-flash.c | 14 +------ drivers/mtd/maps/latch-addr-flash.c | 21 +---------- drivers/mtd/maps/physmap.c | 23 +----------- drivers/mtd/maps/plat-ram.c | 23 +----------- drivers/mtd/maps/pxa2xx-flash.c | 20 +---------- drivers/mtd/maps/rbtx4939-flash.c | 18 +-------- drivers/mtd/maps/sa1100-flash.c | 30 ++-------------- drivers/mtd/maps/solutionengine.c | 30 ++++------------ drivers/mtd/maps/wr_sbc82xx_flash.c | 30 ++++++---------- drivers/mtd/mtdcore.c | 30 ++++++++++++++++ drivers/mtd/nand/atmel_nand.c | 19 +--------- drivers/mtd/nand/bcm_umi_nand.c | 19 +--------- drivers/mtd/nand/cafe_nand.c | 11 +----- drivers/mtd/nand/cmx270_nand.c | 20 +--------- drivers/mtd/nand/cs553x_nand.c | 7 +--- drivers/mtd/nand/davinci_nand.c | 25 +------------ drivers/mtd/nand/edb7312.c | 17 +-------- drivers/mtd/nand/fsmc_nand.c | 66 +++++------------------------------ drivers/mtd/nand/h1910.c | 15 +------- drivers/mtd/nand/jz4740_nand.c | 11 ++---- drivers/mtd/nand/mxc_nand.c | 15 ++------ drivers/mtd/nand/omap2.c | 10 +---- drivers/mtd/nand/orion_nand.c | 12 +----- drivers/mtd/nand/plat_nand.c | 22 ++---------- drivers/mtd/nand/ppchameleonevb.c | 42 +++++----------------- drivers/mtd/nand/pxa3xx_nand.c | 11 +----- drivers/mtd/nand/s3c2410.c | 18 ++------- drivers/mtd/nand/sharpsl.c | 11 +----- drivers/mtd/nand/tmio_nand.c | 12 ++----- drivers/mtd/nand/txx9ndfmc.c | 7 +--- drivers/mtd/onenand/generic.c | 11 ++---- drivers/mtd/onenand/omap2.c | 13 ++----- drivers/mtd/onenand/samsung.c | 11 ++---- include/linux/mtd/mtd.h | 5 +++ 45 files changed, 163 insertions(+), 684 deletions(-)
PATCH 1/44 mtd: add new API for handling MTD registration
Lots (nearly all) mtd drivers contain nearly the similar code that calls parse_mtd_partitions, provides some platform-default values, if parsing fails, and registers mtd device.
This is an aim to provide single implementation of this scenario:mtd_device_parse_register() which will handle all this parsing and defaults.
--- drivers/mtd/mtdcore.c | 30 ++++++++++++++++++++++++++++++ include/linux/mtd/mtd.h | 5 +++++ 2 files changed, 35 insertions(+), 0 deletions(-)
drivers/mtd/mtdcore.c +30 -0
@@ -451,6 +451,36 @@ int mtd_device_register(struct mtd_info *master, }EXPORT_SYMBOL_GPL (mtd_device_register); +int mtd_device_parse_register (struct mtd_info *mtd, +const char **part_probe_types, +unsigned long origin, +const struct mtd_partition *defparts, +int defnr_parts) +{ +int err; +struct mtd_partition *parts; + + err =parse_mtd_partitions (mtd, part_probe_types, &parts, origin); +if (err <=0 && defnr_parts) { +unsigned long size =sizeof (*parts) * defnr_parts; + err = defnr_parts; + parts =kzalloc (size,GFP_KERNEL ); +memcpy (parts, defparts, size); + } + +if (err >0 ) { + err =add_mtd_partitions (mtd, parts, err); +kfree (parts); + }else { + err =add_mtd_device (mtd); +if (err ==1 ) + err = -ENODEV ; + } + +return err; +} +EXPORT_SYMBOL_GPL (mtd_device_parse_register); +/** * mtd_device_unregister - unregister an existing MTD device. *
include/linux/mtd/mtd.h +5 -0
@@ -327,6 +327,11 @@ struct mtd_partition;extern int mtd_device_register (struct mtd_info *master,const struct mtd_partition *parts,int nr_parts); +extern int mtd_device_parse_register (struct mtd_info *mtd, +const char **part_probe_types, +unsigned long origin, +const struct mtd_partition *defparts, +int defnr_parts);extern int mtd_device_unregister (struct mtd_info *master);extern struct mtd_info *get_mtd_device (struct mtd_info *mtd,int num);extern int __get_mtd_device (struct mtd_info *mtd);
Signature · 1 line
1.7.4.4
Re: [PATCH 01/44] mtd: add new API for handling MTD registration
Hi Dmitry,
This sounds like a good idea. Nitpick inline.
Jamie
Quoted 27 lines · Dmitry Eremin-Solenikov
Lots (nearly all) mtd drivers contain nearly the similar code that calls
parse_mtd_partitions, provides some platform-default values, if parsing fails, and registers mtd device.This is an aim to provide single implementation of this scenario:
mtd_device_parse_register()which will handle all this parsing and defaults.Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- drivers/mtd/mtdcore.c | 30 ++++++++++++++++++++++++++++++ include/linux/mtd/mtd.h | 5 +++++ 2 files changed, 35 insertions(+), 0 deletions(-)drivers/mtd/mtdcore.c +5
-0@@ -451,6 +451,36 @@ int mtd_device_register(struct mtd_info *master, }EXPORT_SYMBOL_GPL (mtd_device_register); +int mtd_device_parse_register (struct mtd_info *mtd, +const char **part_probe_types, +unsigned long origin, +const struct mtd_partition *defparts, +int defnr_parts)
drivers/mtd/mtdcore.c int mtd_device_register(struct mtd_info *master, · line 468
Quoted 10 lines
drivers/mtd/mtdcore.c +10
-0+{ +int err; +struct mtd_partition *parts; + + err =parse_mtd_partitions (mtd, part_probe_types, &parts, origin); +if (err <=0 && defnr_parts) { +unsigned long size =sizeof (*parts) * defnr_parts; + err = defnr_parts; + parts =kzalloc (size,GFP_KERNEL ); +memcpy (parts, defparts, size);
Shouldn't this check the return of kzalloc()? How about using kmemdup() instead of kzalloc() + memcpy()? Also some kernel-doc to describe the search order would be nice.
Jamie
Re: [PATCH 01/44] mtd: add new API for handling MTD registration
Quoted 39 lines · Jamie Iles
Hi Dmitry,
This sounds like a good idea. Nitpick inline.
Jamie
Quoted 32 lines · Dmitry Eremin-Solenikov
Lots (nearly all) mtd drivers contain nearly the similar code that calls
parse_mtd_partitions, provides some platform-default values, if parsing fails, and registers mtd device.This is an aim to provide single implementation of this scenario:
mtd_device_parse_register()which will handle all this parsing and defaults.Signed-off-by Dmitry Eremin-Solenikov<[email protected]>--- drivers/mtd/mtdcore.c | 30 ++++++++++++++++++++++++++++++ include/linux/mtd/mtd.h | 5 +++++ 2 files changed, 35 insertions(+), 0 deletions(-)drivers/mtd/mtdcore.c +10
-0@@ -451,6 +451,36 @@ int mtd_device_register(struct mtd_info *master, }EXPORT_SYMBOL_GPL (mtd_device_register); +int mtd_device_parse_register (struct mtd_info *mtd, +const char **part_probe_types, +unsigned long origin, +const struct mtd_partition *defparts, +int defnr_parts) +{ +int err; +struct mtd_partition *parts; + + err =parse_mtd_partitions (mtd, part_probe_types,&parts, origin);
Quoted 8 lines
drivers/mtd/mtdcore.c int mtd_device_register(struct mtd_info *master, · line 468
Quoted 5 lines
drivers/mtd/mtdcore.c +5
-0+if (err<=0 && defnr_parts) { +unsigned long size =sizeof (*parts) * defnr_parts; + err = defnr_parts; + parts =kzalloc (size,GFP_KERNEL ); +memcpy (parts, defparts, size);Shouldn't this check the return of
kzalloc()? How about usingkmemdup()instead ofkzalloc()+memcpy()?
Good catch! Thank you.
Quoted 1 line
Also some kernel-doc to describe the search order would be nice.
Search order is mainly detailed either by defaults specified in mtdpart.c or by probe types which user specifies.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 01/44] mtd: add new API for handling MTD registration
Quoted 4 lines · Dmitry Eremin-Solenikov
Quoted 1 line
Also some kernel-doc to describe the search order would be nice.
Search order is mainly detailed either by defaults specified in
mtdpart.cor by probe types which user specifies.
I look at the functions and they are difficult to understand. We need to start with good kerneldoc comment for 'parse_mtd_partitions()'. The default behavior has to be well-documented. I'd like to apply this patch, how does it look to you?
Quoted 1 line
From
1606f9966d891cb79bdfb935baf87038a7029198Mon Sep 17 00:00:00 2001
From: Artem Bityutskiy <[email protected]>
Date: Wed, 8 Jun 2011 11:42:27 +0300
Subject: [PATCH] mtd: document parse_mtd_partitions
Add a kerneldoc comment for the 'parse_mtd_partitions()' function - its behavior has changed recently so it is good idea to have it documented.
--- drivers/mtd/mtdpart.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
drivers/mtd/mtdpart.c +22 -0
@@ -725,8 +725,30 @@ int deregister_mtd_parser(struct mtd_part_parser *p) }EXPORT_SYMBOL_GPL (deregister_mtd_parser); +/* +* Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you +* are changing this array! +*/ static const char *default_mtd_part_types[] = {"cmdlinepart" ,NULL }; +/** +* parse_mtd_partitions - parse MTD partitions +* @master: the master partition (describes whole MTD device) +* @types: names of partition parsers to try or %NULL +* @pparts: array of partitions found is returned here +* @origin: MTD device start address (use %0 if unsure) +* +* This function tries to find partition on MTD device @master. It uses MTD +* partition parsers, specified in @types. However, if @types is %NULL, then +* the default list of parsers is used. The default list contains only the +* "cmdlinepart" parser ATM. +* +* This function may return: +* o a negative error code in case of failure +* o zero if no partitions were found +* o a positive number of found partitions, in which case on exit @pparts will +* point to an array containing this number of &struct mtd_info objects. +*/ int parse_mtd_partitions (struct mtd_info *master,const char **types,struct mtd_partition **pparts,unsigned long origin) {
Signature · 6 lines
1.7.2.3 -- Best Regards, Artem Bityutskiy (Артём Битюцкий)
Re: [PATCH 01/44] mtd: add new API for handling MTD registration
Quoted 10 lines · Artem Bityutskiy
Quoted 4 lines · Dmitry Eremin-Solenikov
Quoted 1 line
Also some kernel-doc to describe the search order would be nice.
Search order is mainly detailed either by defaults specified in
mtdpart.cor by probe types which user specifies.I look at the functions and they are difficult to understand. We need to start with good kerneldoc comment for '
parse_mtd_partitions()'. The default behavior has to be well-documented. I'd like to apply this patch, how does it look to you?
Looks good.
Quoted 60 lines
From
1606f9966d891cb79bdfb935baf87038a7029198Mon Sep 17 00:00:00 2001
From: Artem Bityutskiy <[email protected]>
Date: Wed, 8 Jun 2011 11:42:27 +0300
Subject: [PATCH] mtd: documentparse_mtd_partitionsAdd a kerneldoc comment for the '
parse_mtd_partitions()' function - its behavior has changed recently so it is good idea to have it documented.Signed-off-by Artem Bityutskiy <[email protected]>--- drivers/mtd/mtdpart.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)drivers/mtd/mtdpart.c +2
-0@@ -725,8 +725,30 @@ int deregister_mtd_parser(struct mtd_part_parser *p) }EXPORT_SYMBOL_GPL (deregister_mtd_parser); +/* +* Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you
+ * are changing this array!
+ */
static const char *default_mtd_part_types[] = {"cmdlinepart", NULL};+/**
+ *parse_mtd_partitions- parse MTD partitions
+ * @master: the master partition (describes whole MTD device)
+ * @types: names of partition parsers to try or %NULL
+ * @pparts: array of partitions found is returned here
+ * @origin: MTD device start address (use %0 if unsure)
+ *
+ * This function tries to find partition on MTD device @master. It uses MTD
+ * partition parsers, specified in @types. However, if @types is %NULL, then
+ * the default list of parsers is used. The default list contains only the
+ * "cmdlinepart" parser ATM.
+ *
+ * This function may return:
+ * o a negative error code in case of failure
+ * o zero if no partitions were found
+ * o a positive number of found partitions, in which case on exit @pparts will
+ * point to an array containing this number of &structmtd_infoobjects.
+ */
int parse_mtd_partitions(structmtd_info*master, const char **types,
structmtd_partition**pparts, unsigned long origin)
{
--
1.7.2.3--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 01/44] mtd: add new API for handling MTD registration
Quoted 7 lines · Dmitry Eremin-Solenikov
Quoted 6 lines · Artem Bityutskiy
Quoted 4 lines · Dmitry Eremin-Solenikov
Quoted 1 line
Also some kernel-doc to describe the search order would be nice.
Search order is mainly detailed either by defaults specified in
mtdpart.cor by probe types which user specifies.
Quoted 6 lines
Quoted 4 lines
I look at the functions and they are difficult to understand. We need to start with good kerneldoc comment for '
parse_mtd_partitions()'. The default behavior has to be well-documented. I'd like to apply this patch, how does it look to you?Looks good.
OK, pushed to l2-mtd-2.6.git.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
PATCH 1/44 mtd: add new API for handling MTD registration
In reply to Jamie IlesLots (nearly all) mtd drivers contain nearly the similar code that calls parse_mtd_partitions, provides some platform-default values, if parsing fails, and registers mtd device.
This is an aim to provide single implementation of this scenario:mtd_device_parse_register() which will handle all this parsing and defaults.
--- drivers/mtd/mtdcore.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/mtd.h | 5 +++++ 2 files changed, 52 insertions(+), 0 deletions(-)
drivers/mtd/mtdcore.c +47 -0
@@ -452,6 +452,53 @@ int mtd_device_register(struct mtd_info *master,EXPORT_SYMBOL_GPL (mtd_device_register);/** +* mtd_device_parse_register - register an MTD device. +* +* @mtd: the MTD device to register +* @part_probe_types: the list of MTD partition probes to try +* @origin: start address of MTD device. =0 unless you are sure you need this. +* @defparts: default partition information to register. Only valid if +* defnr_parts > 0 +* @defnr_parts: the number of partitions in defparts. If zero then the full +* MTD device is registered if no partition info is found +* +* Extract partition info and register MTD device (partitions or a whole device) +* It calls parse_mtd_partitions(), checks the result. If there were no +* partitions found, it uses default info specified (via defparts/defnr_parts) +* and then registers either partitions, or (if no partitions were +* found/specified) the whow MTD. +*/ +int mtd_device_parse_register (struct mtd_info *mtd, +const char **part_probe_types, +unsigned long origin, +const struct mtd_partition *defparts, +int defnr_parts) +{ +int err; +struct mtd_partition *parts; + + err =parse_mtd_partitions (mtd, part_probe_types, &parts, origin); +if (err <=0 && defnr_parts) { + parts =kmemdup (defparts,sizeof (*parts) * defnr_parts, +GFP_KERNEL ); +if (!parts) + err = -ENOMEM ; + } + +if (err >0 ) { + err =add_mtd_partitions (mtd, parts, err); +kfree (parts); + }else if (err ==0 ) { + err =add_mtd_device (mtd); +if (err ==1 ) + err = -ENODEV ; + } + +return err; +} +EXPORT_SYMBOL_GPL (mtd_device_parse_register); + +/** * mtd_device_unregister - unregister an existing MTD device. * * @master: the MTD device to unregister. This will unregister both the master
include/linux/mtd/mtd.h +5 -0
@@ -327,6 +327,11 @@ struct mtd_partition;extern int mtd_device_register (struct mtd_info *master,const struct mtd_partition *parts,int nr_parts); +extern int mtd_device_parse_register (struct mtd_info *mtd, +const char **part_probe_types, +unsigned long origin, +const struct mtd_partition *defparts, +int defnr_parts);extern int mtd_device_unregister (struct mtd_info *master);extern struct mtd_info *get_mtd_device (struct mtd_info *mtd,int num);extern int __get_mtd_device (struct mtd_info *mtd);
Signature · 1 line
1.7.4.4
Re: [PATCH 01/44] mtd: add new API for handling MTD registration
I agree we need a good comment, but I find this one difficult to follow.
Quoted 2 lines · Dmitry Eremin-Solenikov
/**
+ *mtd_device_parse_register- register an MTD device.
Not just register, it also contains parsing functionality.
Quoted 3 lines
+ *
+ * @mtd: the MTD device to register
+ * @part_probe_types: the list of MTD partition probes to try
Please, name it 'types' to be consistent with 'parse_mtd_partitions()'. Also, you do not say that this can be %NULL. With my patch, you can refer the reader like "see 'parse_mtd_partitions()' for more information'.
Quoted 1 line
+ * @origin: start address of MTD device. =0 unless you are sure you need this.
Try to avoid using dots. Also, constants should be prefixed with %, i.e., use %0.
Quoted 2 lines
+ * @defparts: default partition information to register. Only valid if
+ *defnr_parts> 0
Ditto about a dot, prefix variables with @, i.e., in this case:
@defnr_parts > %0.
Also about naming: why "default"? What is default there? This is more like "alternative, or fall-back" - you first try to detect partition specified in @part_probe_types, if if you fail - you use "alternative" partitions.
Please, rename it.
Quoted 2 lines
+ * @defnr_parts: the number of partitions in defparts. If zero then the full
+ * MTD device is registered if no partition info is found
Ditto.
Quoted 7 lines
+ *
+ * Extract partition info and register MTD device (partitions or a whole device)
+ * It callsparse_mtd_partitions(), checks the result. If there were no
+ * partitions found, it uses default info specified (via defparts/defnr_parts)
+ * and then registers either partitions, or (if no partitions were
+ * found/specified) the whow MTD.
+ */
Sorry, I find this unreadable.
I suggest something like this.
This function aggregates MTD partitions parsing (done by 'parse_mtd_partitions()') and MTD device and partitions registering. It basically follows the most common pattern found in many MTD drivers:
o It first tries to probe partitions on MTD device @mtd using parsers specified in @types (if @types is %NULL, then the default list of parsers is used, see 'parse_mtd_partitions()' for more information).
o If this succeeds, this function registers the found partitions, as well as the whole MTD device @mtd.
o If no partitions were found this function just registers the MTD device @mtd and exits.
Returns zero in case of success and a negative error code in case of failure.
Would you please amend the patch and re-send?
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Re: [PATCH 01/44] mtd: add new API for handling MTD registration
In reply to Dmitry Eremin-SolenikovQuoted 27 lines · Dmitry Eremin-Solenikov
Lots (nearly all) mtd drivers contain nearly the similar code that calls
parse_mtd_partitions, provides some platform-default values, if parsing fails, and registers mtd device.This is an aim to provide single implementation of this scenario:
mtd_device_parse_register()which will handle all this parsing and defaults.Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- drivers/mtd/mtdcore.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/mtd.h | 5 +++++ 2 files changed, 52 insertions(+), 0 deletions(-)drivers/mtd/mtdcore.c +5
-0@@ -452,6 +452,53 @@ int mtd_device_register(struct mtd_info *master,EXPORT_SYMBOL_GPL (mtd_device_register);/** +* mtd_device_parse_register - register an MTD device. +* +* @mtd: the MTD device to register +* @part_probe_types: the list of MTD partition probes to try +* @origin: start address of MTD device. =0 unless you are sure you need this.
drivers/mtd/mtdcore.c int mtd_device_register(struct mtd_info *master, · line 469
Quoted 10 lines
drivers/mtd/mtdcore.c +10
-0+* @defparts: default partition information to register. Only valid if +* defnr_parts > 0 +* @defnr_parts: the number of partitions in defparts. If zero then the full +* MTD device is registered if no partition info is found +* +* Extract partition info and register MTD device (partitions or a whole device) +* It calls parse_mtd_partitions(), checks the result. If there were no +* partitions found, it uses default info specified (via defparts/defnr_parts) +* and then registers either partitions, or (if no partitions were +* found/specified) the whow MTD.
s/whow/whole ?
Quoted 7 lines
drivers/mtd/mtdcore.c +7
-0+*/ +int mtd_device_parse_register (struct mtd_info *mtd, +const char **part_probe_types, +unsigned long origin, +const struct mtd_partition *defparts, +int defnr_parts) +{
drivers/mtd/mtdcore.c int mtd_device_register(struct mtd_info *master, · line 486
Quoted 10 lines
drivers/mtd/mtdcore.c +10
-0+int err; +struct mtd_partition *parts; + + err =parse_mtd_partitions (mtd, part_probe_types, &parts, origin); +if (err <=0 && defnr_parts) { + parts =kmemdup (defparts,sizeof (*parts) * defnr_parts, +GFP_KERNEL ); +if (!parts) + err = -ENOMEM ; + }
I see that some of your patches for drivers (e.g. plat_nand) remove the kfree() of the partitions but this doesn't appear to be handled anywhere else afaict. I don't think this can be done in mtd_device_unregister() as it doesn't have the mtd_partition array so probably needs to remain in the driver.
Jamie
Re: [PATCH 01/44] mtd: add new API for handling MTD registration
Quoted 37 lines · Jamie Iles
Quoted 36 lines · Dmitry Eremin-Solenikov
Lots (nearly all) mtd drivers contain nearly the similar code that calls
parse_mtd_partitions, provides some platform-default values, if parsing fails, and registers mtd device.This is an aim to provide single implementation of this scenario:
mtd_device_parse_register()which will handle all this parsing and defaults.Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- drivers/mtd/mtdcore.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/mtd.h | 5 +++++ 2 files changed, 52 insertions(+), 0 deletions(-)drivers/mtd/mtdcore.c +5
-0@@ -452,6 +452,53 @@ int mtd_device_register(struct mtd_info *master,EXPORT_SYMBOL_GPL (mtd_device_register);/** +* mtd_device_parse_register - register an MTD device. +* +* @mtd: the MTD device to register +* @part_probe_types: the list of MTD partition probes to try +* @origin: start address of MTD device. =0 unless you are sure you need this.
+ * @defparts: default partition information to register. Only valid if
+ *defnr_parts> 0
+ * @defnr_parts: the number of partitions in defparts. If zero then the full
+ * MTD device is registered if no partition info is found
+ *
+ * Extract partition info and register MTD device (partitions or a whole
Quoted 8 lines
Quoted 6 lines
device)
+ * It callsparse_mtd_partitions(), checks the result. If there were no
+ * partitions found, it uses default info specified (via defparts/defnr_parts)
+ * and then registers either partitions, or (if no partitions were
+ * found/specified) the whow MTD.s/whow/whole ?
Yup.
Quoted 15 lines
Quoted 15 lines
+ */
drivers/mtd/mtdcore.c +14
-0+int mtd_device_parse_register (struct mtd_info *mtd, +const char **part_probe_types, +unsigned long origin, +const struct mtd_partition *defparts, +int defnr_parts) +{ +int err; +struct mtd_partition *parts; + + err =parse_mtd_partitions (mtd, part_probe_types, &parts, origin); +if (err <=0 && defnr_parts) { + parts =kmemdup (defparts,sizeof (*parts) * defnr_parts, +GFP_KERNEL ); +if (!parts)
Quoted 8 lines
drivers/mtd/mtdcore.c
Quoted 2 lines
drivers/mtd/mtdcore.c +2
-0+ err = -ENOMEM ; + }I see that some of your patches for drivers (e.g.
plat_nand) remove thekfree()of the partitions but this doesn't appear to be handled anywhere else afaict. I don't think this can be done inmtd_device_unregister()as it doesn't have themtd_partitionarray so probably needs to remain in the driver.
It's handled by kfree right aftert add_mtd_partitions. No mtd partitions information is exported out of mtd_device_parse_register(). In fact I'll have to check if I can remove all <mtd/partitions.h> includes from drivers.
Anyway I'll post a V2 later after fixing issues identified by you and Artem.
Signature · 2 lines
With best wishes Dmitry
PATCH 2/44 mtd: lart.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/devices/lart.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-)
drivers/mtd/devices/lart.c +4 -8
@@ -619,6 +619,10 @@ static struct mtd_partition lart_partitions[] = { .size = INITRD_LEN, /* MTDPART_SIZ_FULL */ } }; +#define NUM_PARTITIONS ARRAY_SIZE(lart_partitions) +#else +#define lart_partitions NULL +#define NUM_PARTITIONS 0#endif static int __init lart_flash_init (void )
@@ -683,23 +687,15 @@ static int __init lart_flash_init (void)#endif #endif -#ifndef HAVE_PARTITIONS - result =mtd_device_register (&mtd,NULL ,0 ); -#else result =mtd_device_register (&mtd, lart_partitions,ARRAY_SIZE (lart_partitions)); -#endif return (result); } static void __exit lart_flash_exit (void) { -#ifndef HAVE_PARTITIONS mtd_device_unregister (&mtd); -#else -mtd_device_unregister (&mtd); -#endif }module_init (lart_flash_init);
Signature · 1 line
1.7.4.4
Re: [PATCH 02/44] mtd: lart.c: use mtd_device_parse_register
Quoted 5 lines · Dmitry Eremin-Solenikov
Replace custom invocations of
parse_mtd_partitionsandmtd_device_registerwith commonmtd_device_parse_registercall. This would bring: standard handling of all errors, fallback to default partitions, etc.Signed-off-by Dmitry Eremin-Solenikov <[email protected]>
Sorry, but the code does not match the description: you do not use 'mtd_device_parse_register(); there.
Quoted 43 lines
--- drivers/mtd/devices/lart.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-)drivers/mtd/devices/lart.c +4
-8@@ -619,6 +619,10 @@ static struct mtd_partition lart_partitions[] = { .size = INITRD_LEN, /* MTDPART_SIZ_FULL */ } }; +#define NUM_PARTITIONS ARRAY_SIZE(lart_partitions) +#else +#define lart_partitions NULL +#define NUM_PARTITIONS 0#endif static int __init lart_flash_init (void )@@ -683,23 +687,15 @@ static int __init lart_flash_init (void)#endif #endif -#ifndef HAVE_PARTITIONS - result =mtd_device_register (&mtd,NULL ,0 ); -#else result =mtd_device_register (&mtd, lart_partitions,ARRAY_SIZE (lart_partitions)); -#endif return (result); } static void __exit lart_flash_exit (void) { -#ifndef HAVE_PARTITIONS mtd_device_unregister (&mtd); -#else -mtd_device_unregister (&mtd); -#endif }module_init (lart_flash_init);
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
PATCH 3/44 mtd: mtd_dataflash.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/devices/mtd_dataflash.c | 21 +++------------------ 1 files changed, 3 insertions(+), 18 deletions(-)
drivers/mtd/devices/mtd_dataflash.c +3 -18
@@ -637,8 +637,6 @@ add_dataflash_otp(struct spi_device *spi, char *name,struct flash_platform_data *pdata = spi->dev.platform_data;char *otp_tag ="" ;int err =0 ; -struct mtd_partition *parts; -int nr_parts =0 ; priv =kzalloc (sizeof *priv,GFP_KERNEL );if (!priv)
@@ -677,23 +675,10 @@ add_dataflash_otp(struct spi_device *spi, char *name, pagesize, otp_tag);dev_set_drvdata (&spi->dev, priv); - nr_parts =parse_mtd_partitions (device,NULL , &parts,0 ); + err =mtd_device_parse_register (device,NULL ,0 , + pdata ? pdata->parts :NULL , + pdata ? pdata->nr_parts :0 ); -if (nr_parts <=0 && pdata && pdata->parts) { - parts = pdata->parts; - nr_parts = pdata->nr_parts; - } - -if (nr_parts >0 ) { - priv->partitioned =1 ; - err =mtd_device_register (device, parts, nr_parts); - goto out; - } - -if (mtd_device_register (device,NULL ,0 ) ==1 ) - err = -ENODEV ; - -out:if (!err)return 0 ;
Signature · 1 line
1.7.4.4
PATCH 4/44 mtd: sst25l.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/devices/sst25l.c | 32 ++++---------------------------- 1 files changed, 4 insertions(+), 28 deletions(-)
drivers/mtd/devices/sst25l.c +4 -28
@@ -53,7 +53,6 @@ struct sst25l_flash {struct mutex lock;struct mtd_info mtd; -int partitioned; };struct flash_info {
@@ -381,8 +380,6 @@ static int __devinit sst25l_probe(struct spi_device *spi)struct sst25l_flash *flash;struct flash_platform_data *data;int ret, i; -struct mtd_partition *parts =NULL ; -int nr_parts =0 ; flash_info =sst25l_match_device (spi);if (!flash_info)
@@ -423,31 +420,10 @@ static int __devinit sst25l_probe(struct spi_device *spi) flash->mtd.numeraseregions); - nr_parts =parse_mtd_partitions (&flash->mtd,NULL , &parts,0 ); - -if (nr_parts <=0 && data && data->parts) { - parts = data->parts; - nr_parts = data->nr_parts; - } - -if (nr_parts >0 ) { -for (i =0 ; i < nr_parts; i++) { -DEBUG (MTD_DEBUG_LEVEL2 ,"partitions[%d] = " -"{.name = %s, .offset = 0x%llx, " -".size = 0x%llx (%lldKiB) }\n" , - i, parts[i].name, - (long long )parts[i].offset, - (long long )parts[i].size, - (long long )(parts[i].size >>10 )); - } - - flash->partitioned =1 ; -return mtd_device_register (&flash->mtd, parts, - nr_parts); - } - - ret =mtd_device_register (&flash->mtd,NULL ,0 ); -if (ret ==1 ) { + ret =mtd_device_parse_register (&flash->mtd,NULL ,0 , + data ? data->parts :NULL , + data ? data->nr_parts :0 ); +if (ret) {kfree (flash);dev_set_drvdata (&spi->dev,NULL );return -ENODEV ;
Signature · 1 line
1.7.4.4
Re: [PATCH 04/44] mtd: sst25l.c: use mtd_device_parse_register
Quoted 14 lines · Dmitry Eremin-Solenikov
Replace custom invocations of
parse_mtd_partitionsandmtd_device_registerwith commonmtd_device_parse_registercall. This would bring: standard handling of all errors, fallback to default partitions, etc.Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- drivers/mtd/devices/sst25l.c | 32 ++++---------------------------- 1 files changed, 4 insertions(+), 28 deletions(-)drivers/mtd/devices/sst25l.c +0
-0
drivers/mtd/devices/sst25l.c struct sst25l_flash { · line 56
Quoted 5 lines
drivers/mtd/devices/sst25l.c +0
-1@@ -53,7 +53,6 @@ struct sst25l_flash {struct mutex lock;struct mtd_info mtd; -int partitioned; };
How about removing the unneeded newline as well? :-)
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
PATCH 5/44 mtd: bfin-async-flash.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/bfin-async-flash.c | 16 ++-------------- 1 files changed, 2 insertions(+), 14 deletions(-)
drivers/mtd/maps/bfin-async-flash.c +2 -14
@@ -41,7 +41,6 @@ struct async_state {uint32_t flash_ambctl0, flash_ambctl1;uint32_t save_ambctl0, save_ambctl1;unsigned long irq_flags; -struct mtd_partition *parts; };static void switch_to_flash (struct async_state *state)
@@ -165,18 +164,8 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev)return -ENXIO ; } - ret =parse_mtd_partitions (state->mtd, part_probe_types, &pdata->parts,0 ); -if (ret >0 ) { - pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n"); -mtd_device_register (state->mtd, pdata->parts, ret); - state->parts = pdata->parts; - }else if (pdata->nr_parts) { - pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n"); -mtd_device_register (state->mtd, pdata->parts, pdata->nr_parts); - }else { - pr_devinit(KERN_NOTICE DRIVER_NAME ": no partition info available, registering whole flash at once\n"); -mtd_device_register (state->mtd,NULL ,0 ); - } +mtd_device_parse_register (state->mtd, part_probe_types,0 , + pdata->parts, pdata->nr_parts);platform_set_drvdata (pdev, state);
@@ -188,7 +177,6 @@ static int __devexit bfin_flash_remove(struct platform_device *pdev)struct async_state *state =platform_get_drvdata (pdev);gpio_free (state->enet_flash_pin);mtd_device_unregister (state->mtd); -kfree (state->parts);map_destroy (state->mtd);kfree (state);return 0 ;
Signature · 1 line
1.7.4.4
Re: [PATCH 05/44] mtd: bfin-async-flash.c: use mtd_device_parse_register
drivers/mtd/maps/bfin-async-flash.c static int __devinit bfin_flash_probe(struct platform_device *pdev) · line 168
Quoted 2 lines · Dmitry Eremin-Solenikov
drivers/mtd/maps/bfin-async-flash.c +2
-0+mtd_device_parse_register (state->mtd, part_probe_types,0 , + pdata->parts, pdata->nr_parts);
How about checking the return code? :-)
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Re: [PATCH 05/44] mtd: bfin-async-flash.c: use mtd_device_parse_register
Quoted 5 lines · Artem Bityutskiy
drivers/mtd/maps/bfin-async-flash.c static int __devinit bfin_flash_probe(struct platform_device *pdev) · line 168
Quoted 2 lines · Dmitry Eremin-Solenikov
drivers/mtd/maps/bfin-async-flash.c +2
-0+mtd_device_parse_register (state->mtd, part_probe_types,0 , + pdata->parts, pdata->nr_parts);How about checking the return code? :-)
Ok, you did not do it because the original function did not do it. Fair enough, this is a separate thing.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Re: [PATCH 05/44] mtd: bfin-async-flash.c: use mtd_device_parse_register
Quoted 9 lines · Artem Bityutskiy
Quoted 5 lines · Artem Bityutskiy
drivers/mtd/maps/bfin-async-flash.c static int __devinit bfin_flash_probe(struct platform_device *pdev) · line 168
Quoted 2 lines · Dmitry Eremin-Solenikov
drivers/mtd/maps/bfin-async-flash.c +2
-0+mtd_device_parse_register (state->mtd, part_probe_types,0 , + pdata->parts, pdata->nr_parts);How about checking the return code? :-)
Ok, you did not do it because the original function did not do it. Fair enough, this is a separate thing.
Nice idea. Making mtd_device_parse_register a __must_check function :)
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 05/44] mtd: bfin-async-flash.c: use mtd_device_parse_register
Quoted 6 lines · Dmitry Eremin-Solenikov
Quoted 5 lines · Artem Bityutskiy
Quoted 4 lines · Artem Bityutskiy
Quoted 2 lines · Dmitry Eremin-Solenikov
drivers/mtd/maps/bfin-async-flash.c +2
-0+mtd_device_parse_register (state->mtd, part_probe_types,0 , + pdata->parts, pdata->nr_parts);
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
How about checking the return code? :-)
Ok, you did not do it because the original function did not do it. Fair enough, this is a separate thing.
Nice idea. Making
mtd_device_parse_registera__must_checkfunction :)
But please, do it as a separate patch.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Re: [PATCH 05/44] mtd: bfin-async-flash.c: use mtd_device_parse_register
Quoted 7 lines · Artem Bityutskiy
Quoted 6 lines · Dmitry Eremin-Solenikov
Quoted 5 lines · Artem Bityutskiy
Quoted 4 lines · Artem Bityutskiy
Quoted 2 lines · Dmitry Eremin-Solenikov
drivers/mtd/maps/bfin-async-flash.c +2
-0+mtd_device_parse_register (state->mtd, part_probe_types,0 , + pdata->parts, pdata->nr_parts);
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
How about checking the return code? :-)
Ok, you did not do it because the original function did not do it. Fair enough, this is a separate thing.
Nice idea. Making
mtd_device_parse_registera__must_checkfunction :)But please, do it as a separate patch.
Why not make it a __must_check from the beginning? And fixup problematic drivers later.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 05/44] mtd: bfin-async-flash.c: use mtd_device_parse_register
Quoted 13 lines · Dmitry Eremin-Solenikov
Quoted 12 lines · Artem Bityutskiy
Quoted 11 lines · Dmitry Eremin-Solenikov
Quoted 9 lines · Artem Bityutskiy
Quoted 5 lines · Artem Bityutskiy
drivers/mtd/maps/bfin-async-flash.c static int __devinit bfin_flash_probe(struct platform_device *pdev) · line 168
Quoted 2 lines · Dmitry Eremin-Solenikov
drivers/mtd/maps/bfin-async-flash.c +2
-0+mtd_device_parse_register (state->mtd, part_probe_types,0 , + pdata->parts, pdata->nr_parts);How about checking the return code? :-)
Ok, you did not do it because the original function did not do it. Fair enough, this is a separate thing.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Nice idea. Making
mtd_device_parse_registera__must_checkfunction :)But please, do it as a separate patch.
Why not make it a
__must_checkfrom the beginning? And fixup problematic drivers later.
Because it is a separate problem and separate set of patches is needed. First, solve one problem, then start solving the other.
Secondly, if someone will later prove that __must_check was a mistake, we can just revert that separate patch.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Re: [PATCH 05/44] mtd: bfin-async-flash.c: use mtd_device_parse_register
Quoted 19 lines · Artem Bityutskiy
Quoted 18 lines · Dmitry Eremin-Solenikov
Quoted 16 lines · Artem Bityutskiy
Quoted 6 lines · Dmitry Eremin-Solenikov
Quoted 5 lines · Artem Bityutskiy
Quoted 4 lines · Artem Bityutskiy
Quoted 2 lines · Dmitry Eremin-Solenikov
(quoted diff) +2
-0+ mtd_device_parse_register(state->mtd, part_probe_types, 0, + pdata->parts, pdata->nr_parts);Quoted 7 lines
Quoted 5 lines
Quoted 1 line
How about checking the return code? :-)
Ok, you did not do it because the original function did not do it. Fair
enough, this is a separate thing.Nice idea. Making
mtd_device_parse_registera__must_checkfunction :)But please, do it as a separate patch.
Quoted 8 lines
Quoted 2 lines
Why not make it a
__must_checkfrom the beginning? And fixup problematic drivers later.Because it is a separate problem and separate set of patches is needed. First, solve one problem, then start solving the other.
Secondly, if someone will later prove that
__must_checkwas a mistake, we can just revert that separate patch.
Roger.
Signature · 2 lines
With best wishes Dmitry
PATCH 6/44 mtd: dc21285.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/dc21285.c | 9 +-------- 1 files changed, 1 insertions(+), 8 deletions(-)
drivers/mtd/maps/dc21285.c +1 -8
@@ -145,14 +145,10 @@ static struct map_info dc21285_map = {/* Partition stuff */ -static struct mtd_partition *dc21285_parts;static const char *probes[] = {"RedBoot" ,"cmdlinepart" ,NULL };static int __init init_dc21285 (void ) { - -int nrparts; -/* Determine bankwidth */ switch (*CSR_SA110_CNTL & (3 <<14 )) {case SA110_CNTL_ROMWIDTH_8 :
@@ -200,8 +196,7 @@ static int __init init_dc21285(void) dc21285_mtd->owner =THIS_MODULE ; - nrparts =parse_mtd_partitions (dc21285_mtd, probes, &dc21285_parts,0 ); -mtd_device_register (dc21285_mtd, dc21285_parts, nrparts); +mtd_device_parse_register (dc21285_mtd, probes,0 ,NULL ,0 );if (machine_is_ebsa285 ()) {/*
@@ -224,8 +219,6 @@ static int __init init_dc21285(void) static void __exit cleanup_dc21285(void) {mtd_device_unregister (dc21285_mtd); -if (dc21285_parts) -kfree (dc21285_parts);map_destroy (dc21285_mtd);iounmap (dc21285_map.virt); }
Signature · 1 line
1.7.4.4
PATCH 7/44 mtd: gpio-addr-flash.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/gpio-addr-flash.c | 16 ++-------------- 1 files changed, 2 insertions(+), 14 deletions(-)
drivers/mtd/maps/gpio-addr-flash.c +2 -14
@@ -187,7 +187,6 @@ static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL };*/ static int __devinit gpio_flash_probe (struct platform_device *pdev) { -int nr_parts;size_t i, arr_size;struct physmap_flash_data *pdata;struct resource *memory;
@@ -252,20 +251,9 @@ static int __devinit gpio_flash_probe(struct platform_device *pdev)return -ENXIO ; } - nr_parts =parse_mtd_partitions (state->mtd, part_probe_types, - &pdata->parts,0 ); -if (nr_parts >0 ) { - pr_devinit(KERN_NOTICE PFX "Using commandline partition definition\n"); -kfree (pdata->parts); - }else if (pdata->nr_parts) { - pr_devinit(KERN_NOTICE PFX "Using board partition definition\n"); - nr_parts = pdata->nr_parts; - }else { - pr_devinit(KERN_NOTICE PFX "no partition info available, registering whole flash at once\n"); - nr_parts =0 ; - } -mtd_device_register (state->mtd, pdata->parts, nr_parts); +mtd_device_parse_register (state->mtd, part_probe_types,0 , + pdata->parts, pdata->nr_parts);return 0 ; }
Signature · 1 line
1.7.4.4
PATCH 8/44 mtd: h720x-flash.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/h720x-flash.c | 21 ++------------------- 1 files changed, 2 insertions(+), 19 deletions(-)
drivers/mtd/maps/h720x-flash.c +2 -19
@@ -58,16 +58,11 @@ static struct mtd_partition h720x_partitions[] = {#define NUM_PARTITIONS ARRAY_SIZE(h720x_partitions) -static int nr_mtd_parts; -static struct mtd_partition *mtd_parts;/* * Initialize FLASH support */ static int __init h720x_mtd_init (void ) { - -char *part_type =NULL ; - h720x_map.virt =ioremap (h720x_map.phys, h720x_map.size);if (!h720x_map.virt) {
@@ -90,16 +85,8 @@ static int __init h720x_mtd_init(void)if (mymtd) { mymtd->owner =THIS_MODULE ; - nr_mtd_parts =parse_mtd_partitions (mymtd,NULL , &mtd_parts,0 ); -if (nr_mtd_parts >0 ) - part_type ="command line" ; -if (nr_mtd_parts <=0 ) { - mtd_parts = h720x_partitions; - nr_mtd_parts =NUM_PARTITIONS ; - part_type ="builtin" ; - } -printk (KERN_INFO "Using %s partition table\n" , part_type); -mtd_device_register (mymtd, mtd_parts, nr_mtd_parts); +mtd_device_parse_register (mymtd,NULL ,0 , + h720x_partitions,NUM_PARTITIONS );return 0 ; }
@@ -118,10 +105,6 @@ static void __exit h720x_mtd_cleanup(void)map_destroy (mymtd); } -/* Free partition info, if commandline partition was used */ -if (mtd_parts && (mtd_parts != h720x_partitions)) -kfree (mtd_parts); -if (h720x_map.virt) {iounmap ((void *)h720x_map.virt); h720x_map.virt =0 ;
Signature · 1 line
1.7.4.4
PATCH 9/44 mtd: impa7.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/impa7.c | 25 +++---------------------- 1 files changed, 3 insertions(+), 22 deletions(-)
drivers/mtd/maps/impa7.c +3 -22
@@ -58,15 +58,10 @@ static struct mtd_partition static_partitions[] = }, }; -static int mtd_parts_nb[NUM_FLASHBANKS ]; -static struct mtd_partition *mtd_parts[NUM_FLASHBANKS ]; - -static int __init init_impa7 (void ) {static const char *rom_probe_types[] =PROBETYPES ;const char **type; -const char *part_type =0 ;int i;static struct {u_long addr;u_long size; } pt[NUM_FLASHBANKS ] = { {WINDOW_ADDR0 ,WINDOW_SIZE0 },
@@ -96,23 +91,9 @@ static int __init init_impa7(void)if (impa7_mtd[i]) { impa7_mtd[i]->owner =THIS_MODULE ; devicesfound++; - mtd_parts_nb[i] =parse_mtd_partitions (impa7_mtd[i], -NULL , - &mtd_parts[i], -0 ); -if (mtd_parts_nb[i] >0 ) { - part_type ="command line" ; - }else { - mtd_parts[i] = static_partitions; - mtd_parts_nb[i] =ARRAY_SIZE (static_partitions); - part_type ="static" ; - } - - printk(KERN_NOTICE MSG_PREFIX -"using %s partition definition\n" , - part_type); -mtd_device_register (impa7_mtd[i], - mtd_parts[i], mtd_parts_nb[i]); +mtd_device_parse_register (impa7_mtd[i],NULL ,0 , + static_partitions, +ARRAY_SIZE (static_partitions)); }else iounmap ((void *)impa7_map[i].virt);
Signature · 1 line
1.7.4.4
PATCH 10/44 mtd: intel_vr_nor.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/intel_vr_nor.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
drivers/mtd/maps/intel_vr_nor.c +1 -5
@@ -44,7 +44,6 @@ struct vr_nor_mtd {void __iomem *csr_base;struct map_info map;struct mtd_info *info; -int nr_parts;struct pci_dev *dev; };
@@ -71,12 +70,9 @@ static void __devexit vr_nor_destroy_partitions(struct vr_nor_mtd *p)static int __devinit vr_nor_init_partitions (struct vr_nor_mtd *p) { -struct mtd_partition *parts; -/* register the flash bank */ /* partition the flash bank */ - p->nr_parts =parse_mtd_partitions (p->info,NULL , &parts,0 ); -return mtd_device_register (p->info, parts, p->nr_parts); +return mtd_device_parse_register (p->info,NULL ,0 ,NULL ,0 ); } static void __devexit vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p)
Signature · 1 line
1.7.4.4
PATCH 11/44 mtd: ixp2000.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/ixp2000.c | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-)
drivers/mtd/maps/ixp2000.c +1 -10
@@ -38,7 +38,6 @@struct ixp2000_flash_info {struct mtd_info *mtd;struct map_info map; -struct mtd_partition *partitions;struct resource *res; };
@@ -125,8 +124,6 @@ static int ixp2000_flash_remove(struct platform_device *dev)if (info->map.map_priv_1)iounmap ((void *) info->map.map_priv_1); -kfree (info->partitions); -if (info->res) {release_resource (info->res);kfree (info->res);
@@ -228,13 +225,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) } info->mtd->owner =THIS_MODULE ; - err =parse_mtd_partitions (info->mtd, probes, &info->partitions,0 ); -if (err >0 ) { - err =mtd_device_register (info->mtd, info->partitions, err); -if (err) -dev_err (&dev->dev,"Could not parse partitions\n" ); - } - + err =mtd_device_parse_register (info->mtd, probes,0 ,NULL ,0 );if (err) goto Error;
Signature · 1 line
1.7.4.4
PATCH 12/44 mtd: ixp4xx.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/ixp4xx.c | 29 ++++------------------------- 1 files changed, 4 insertions(+), 25 deletions(-)
drivers/mtd/maps/ixp4xx.c +4 -25
@@ -145,7 +145,6 @@ static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr)struct ixp4xx_flash_info {struct mtd_info *mtd;struct map_info map; -struct mtd_partition *partitions;struct resource *res; };
@@ -168,8 +167,6 @@ static int ixp4xx_flash_remove(struct platform_device *dev)if (info->map.virt)iounmap (info->map.virt); -kfree (info->partitions); -if (info->res) {release_resource (info->res);kfree (info->res);
@@ -185,8 +182,6 @@ static int ixp4xx_flash_probe(struct platform_device *dev) {struct flash_platform_data *plat = dev->dev.platform_data;struct ixp4xx_flash_info *info; -const char *part_type =NULL ; -int nr_parts =0 ;int err =-1 ;if (!plat)
@@ -252,28 +247,12 @@ static int ixp4xx_flash_probe(struct platform_device *dev)/* Use the fast version */ info->map.write = ixp4xx_write16; - nr_parts =parse_mtd_partitions (info->mtd, probes, &info->partitions, - dev->resource->start); -if (nr_parts >0 ) { - part_type ="dynamic" ; - }else { - info->partitions = plat->parts; - nr_parts = plat->nr_parts; - part_type ="static" ; - } -if (nr_parts ==0 ) -printk (KERN_NOTICE "IXP4xx flash: no partition info " -"available, registering whole flash\n" ); -else -printk (KERN_NOTICE "IXP4xx flash: using %s partition " -"definition\n" , part_type); - - err =mtd_device_register (info->mtd, info->partitions, nr_parts); -if (err) + err =mtd_device_parse_register (info->mtd, probes, dev->resource->start, + plat->parts, plat->nr_parts); +if (err) {printk (KERN_ERR "Could not parse partitions\n" ); - -if (err) goto Error; + }return 0 ;
Signature · 1 line
1.7.4.4
PATCH 13/44 mtd: lantiq-flash.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/lantiq-flash.c | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-)
drivers/mtd/maps/lantiq-flash.c +2 -12
@@ -112,9 +112,7 @@ ltq_mtd_probe(struct platform_device *pdev) {struct physmap_flash_data *ltq_mtd_data =dev_get_platdata (&pdev->dev);struct ltq_mtd *ltq_mtd; -struct mtd_partition *parts;struct resource *res; -int nr_parts =0 ;struct cfi_private *cfi;int err;
@@ -170,16 +168,8 @@ ltq_mtd_probe(struct platform_device *pdev) cfi->addr_unlock1 ^=1 ; cfi->addr_unlock2 ^=1 ; - nr_parts =parse_mtd_partitions (ltq_mtd->mtd,NULL , &parts,0 ); -if (nr_parts >0 ) { -dev_info (&pdev->dev, -"using %d partitions from cmdline" , nr_parts); - }else { - nr_parts = ltq_mtd_data->nr_parts; - parts = ltq_mtd_data->parts; - } - - err =add_mtd_partitions (ltq_mtd->mtd, parts, nr_parts); + err =mtd_device_parse_register (ltq_mtd->mtd,NULL ,0 , + ltq_mtd_data->parts, ltq_mtd_data->nr_parts);if (err) {dev_err (&pdev->dev,"failed to add partitions\n" ); goto err_destroy;
Signature · 1 line
1.7.4.4
PATCH 14/44 mtd: latch-addr-flash.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/latch-addr-flash.c | 21 ++------------------- 1 files changed, 2 insertions(+), 19 deletions(-)
drivers/mtd/maps/latch-addr-flash.c +2 -19
@@ -33,9 +33,6 @@ struct latch_addr_flash_info {/* cache; could be found out of res */ unsigned long win_mask; -int nr_parts; -struct mtd_partition *parts; -spinlock_t lock; };
@@ -110,8 +107,6 @@ static int latch_addr_flash_remove(struct platform_device *dev) latch_addr_data = dev->dev.platform_data;if (info->mtd !=NULL ) { -if (info->nr_parts) -kfree (info->parts);mtd_device_unregister (info->mtd);map_destroy (info->mtd); }
@@ -204,20 +199,8 @@ static int __devinit latch_addr_flash_probe(struct platform_device *dev) } info->mtd->owner =THIS_MODULE ; - err =parse_mtd_partitions (info->mtd,NULL , &info->parts,0 ); -if (err >0 ) { -mtd_device_register (info->mtd, info->parts, err); -return 0 ; - } -if (latch_addr_data->nr_parts) { -pr_notice ("Using latch-addr-flash partition information\n" ); -mtd_device_register (info->mtd, - latch_addr_data->parts, - latch_addr_data->nr_parts); -return 0 ; - } - -mtd_device_register (info->mtd,NULL ,0 ); +mtd_device_parse_register (info->mtd,NULL ,0 , + latch_addr_data->parts, latch_addr_data->nr_parts);return 0 ; iounmap:
Signature · 1 line
1.7.4.4
PATCH 15/44 mtd: physmap.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/physmap.c | 23 ++--------------------- 1 files changed, 2 insertions(+), 21 deletions(-)
drivers/mtd/maps/physmap.c +2 -21
@@ -27,8 +27,6 @@ struct physmap_flash_info {struct mtd_info *mtd[MAX_RESOURCES ];struct mtd_info *cmtd;struct map_info map[MAX_RESOURCES ]; -int nr_parts; -struct mtd_partition *parts; };static int physmap_flash_remove (struct platform_device *dev)
@@ -46,8 +44,6 @@ static int physmap_flash_remove(struct platform_device *dev)if (info->cmtd) {mtd_device_unregister (info->cmtd); -if (info->nr_parts) -kfree (info->parts);if (info->cmtd != info->mtd[0 ])mtd_concat_destroy (info->cmtd); }
@@ -175,23 +171,8 @@ static int physmap_flash_probe(struct platform_device *dev)if (err) goto err_out; - err =parse_mtd_partitions (info->cmtd, part_probe_types, - &info->parts,0 ); -if (err >0 ) { -mtd_device_register (info->cmtd, info->parts, err); - info->nr_parts = err; -return 0 ; - } - -if (physmap_data->nr_parts) { -printk (KERN_NOTICE "Using physmap partition information\n" ); -mtd_device_register (info->cmtd, physmap_data->parts, - physmap_data->nr_parts); -return 0 ; - } - -mtd_device_register (info->cmtd,NULL ,0 ); - +mtd_device_parse_register (info->cmtd, part_probe_types,0 , + physmap_data->parts, physmap_data->nr_parts);return 0 ; err_out:
Signature · 1 line
1.7.4.4
PATCH 16/44 mtd: plat-ram.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/plat-ram.c | 23 ++--------------------- 1 files changed, 2 insertions(+), 21 deletions(-)
drivers/mtd/maps/plat-ram.c +2 -21
@@ -44,8 +44,6 @@ struct platram_info {struct device *dev;struct mtd_info *mtd;struct map_info map; -struct mtd_partition *partitions; -bool free_partitions;struct resource *area;struct platdata_mtd_ram *pdata; };
@@ -95,10 +93,6 @@ static int platram_remove(struct platform_device *pdev)if (info->mtd) {mtd_device_unregister (info->mtd); -if (info->partitions) { -if (info->free_partitions) -kfree (info->partitions); - }map_destroy (info->mtd); }
@@ -228,21 +222,8 @@ static int platram_probe(struct platform_device *pdev)/* check to see if there are any available partitions, or wether * to add this device whole */ -if (!pdata->nr_partitions) { -/* try to probe using the supplied probe type */ -if (pdata->probes) { - err =parse_mtd_partitions (info->mtd, pdata->probes, - &info->partitions,0 ); - info->free_partitions =1 ; -if (err >0 ) - err =mtd_device_register (info->mtd, - info->partitions, err); - } - } -/* use the static mapping */ -else - err =mtd_device_register (info->mtd, pdata->partitions, - pdata->nr_partitions); + err =mtd_device_parse_register (info->mtd, pdata->probes,0 , + pdata->partitions, pdata->nr_partitions);if (!err)dev_info (&pdev->dev,"registered mtd device\n" );
Signature · 1 line
1.7.4.4
PATCH 17/44 mtd: pxa2xx-flash.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/pxa2xx-flash.c | 20 +------------------- 1 files changed, 1 insertions(+), 19 deletions(-)
drivers/mtd/maps/pxa2xx-flash.c +1 -19
@@ -41,8 +41,6 @@ static void pxa2xx_map_inval_cache(struct map_info *map, unsigned long from, }struct pxa2xx_flash_info { -struct mtd_partition *parts; -int nr_parts;struct mtd_info *mtd;struct map_info map; };
@@ -55,9 +53,7 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) {struct flash_platform_data *flash = pdev->dev.platform_data;struct pxa2xx_flash_info *info; -struct mtd_partition *parts;struct resource *res; -int ret =0 ; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!res)
@@ -71,8 +67,6 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) info->map.bankwidth = flash->width; info->map.phys = res->start; info->map.size = res->end - res->start +1 ; - info->parts = flash->parts; - info->nr_parts = flash->nr_parts; info->map.virt =ioremap (info->map.phys, info->map.size);if (!info->map.virt) {
@@ -104,18 +98,7 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) } info->mtd->owner =THIS_MODULE ; - ret =parse_mtd_partitions (info->mtd, probes, &parts,0 ); - -if (ret >0 ) { - info->nr_parts = ret; - info->parts = parts; - } - -if (!info->nr_parts) -printk ("Registering %s as whole device\n" , - info->map.name); - -mtd_device_register (info->mtd, info->parts, info->nr_parts); +mtd_device_parse_register (info->mtd, probes,0 ,NULL ,0 );platform_set_drvdata (pdev, info);return 0 ;
@@ -133,7 +116,6 @@ static int __devexit pxa2xx_flash_remove(struct platform_device *dev)iounmap (info->map.virt);if (info->map.cached)iounmap (info->map.cached); -kfree (info->parts);kfree (info);return 0 ; }
Signature · 1 line
1.7.4.4
PATCH 18/44 mtd: rbtx4939-flash.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/rbtx4939-flash.c | 18 ++---------------- 1 files changed, 2 insertions(+), 16 deletions(-)
drivers/mtd/maps/rbtx4939-flash.c +2 -16
@@ -25,8 +25,6 @@struct rbtx4939_flash_info {struct mtd_info *mtd;struct map_info map; -int nr_parts; -struct mtd_partition *parts; };static int rbtx4939_flash_remove (struct platform_device *dev)
@@ -41,8 +39,6 @@ static int rbtx4939_flash_remove(struct platform_device *dev)if (info->mtd) {struct rbtx4939_flash_data *pdata = dev->dev.platform_data; -if (info->nr_parts) -kfree (info->parts);mtd_device_unregister (info->mtd);map_destroy (info->mtd); }
@@ -106,18 +102,8 @@ static int rbtx4939_flash_probe(struct platform_device *dev) info->mtd->owner =THIS_MODULE ;if (err) goto err_out; - err =parse_mtd_partitions (info->mtd,NULL , &info->parts,0 ); -if (err >0 ) { -mtd_device_register (info->mtd, info->parts, err); - info->nr_parts = err; -return 0 ; - } - -if (pdata->nr_parts) { -pr_notice ("Using rbtx4939 partition information\n" ); -mtd_device_register (info->mtd, pdata->parts, pdata->nr_parts); -return 0 ; - } + err =mtd_device_parse_register (info->mtd,NULL ,0 , + pdata->parts, pdata->nr_parts);mtd_device_register (info->mtd,NULL ,0 );return 0 ;
Signature · 1 line
1.7.4.4
Re: [PATCH 18/44] mtd: rbtx4939-flash.c: use mtd_device_parse_register
Quoted 11 lines · Dmitry Eremin-Solenikov
drivers/mtd/maps/rbtx4939-flash.c +0
-7@@ -106,18 +102,8 @@ static int rbtx4939_flash_probe(struct platform_device *dev) info->mtd->owner =THIS_MODULE ;if (err) goto err_out; - err =parse_mtd_partitions (info->mtd,NULL , &info->parts,0 ); -if (err >0 ) { -mtd_device_register (info->mtd, info->parts, err); - info->nr_parts = err; -return 0 ; - } -
drivers/mtd/maps/rbtx4939-flash.c static int rbtx4939_flash_probe(struct platform_device *dev) · line 109
Quoted 10 lines
drivers/mtd/maps/rbtx4939-flash.c +2
-5-if (pdata->nr_parts) { -pr_notice ("Using rbtx4939 partition information\n" ); -mtd_device_register (info->mtd, pdata->parts, pdata->nr_parts); -return 0 ; - } + err =mtd_device_parse_register (info->mtd,NULL ,0 , + pdata->parts, pdata->nr_parts);mtd_device_register (info->mtd,NULL ,0 );return 0 ;
The last mtd_device_register() call should be removed too?
---
Atsushi Nemoto
Re: [PATCH 18/44] mtd: rbtx4939-flash.c: use mtd_device_parse_register
Quoted 22 lines · Atsushi Nemoto
Quoted 20 lines · Dmitry Eremin-Solenikov
drivers/mtd/maps/rbtx4939-flash.c +2
-12@@ -106,18 +102,8 @@ static int rbtx4939_flash_probe(struct platform_device *dev) info->mtd->owner = THIS_MODULE;if (err) goto err_out; - err =parse_mtd_partitions (info->mtd,NULL , &info->parts,0 ); -if (err >0 ) { -mtd_device_register (info->mtd, info->parts, err); - info->nr_parts = err; -return 0 ; - } - -if (pdata->nr_parts) { -pr_notice ("Using rbtx4939 partition information\n" ); -mtd_device_register (info->mtd, pdata->parts, pdata->nr_parts); -return 0 ; - } + err =mtd_device_parse_register (info->mtd,NULL ,0 , + pdata->parts, pdata->nr_parts);
Quoted 4 lines
Quoted 2 lines
drivers/mtd/maps/rbtx4939-flash.c +0
-0mtd_device_register (info->mtd,NULL ,0 );return 0;
The last
mtd_device_register()call should be removed too?
Good catch, thanks!
Signature · 2 lines
With best wishes Dmitry
PATCH 19/44 mtd: sa1100-flash.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/sa1100-flash.c | 30 +++--------------------------- 1 files changed, 3 insertions(+), 27 deletions(-)
drivers/mtd/maps/sa1100-flash.c +3 -27
@@ -131,10 +131,8 @@ struct sa_subdev_info { };struct sa_info { -struct mtd_partition *parts;struct mtd_info *mtd;int num_subdev; -unsigned int nr_parts;struct sa_subdev_info subdev[0 ]; };
@@ -231,8 +229,6 @@ static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *plamtd_concat_destroy (info->mtd); } -kfree (info->parts); -for (i = info->num_subdev -1 ; i >=0 ; i--)sa1100_destroy_subdev (&info->subdev[i]);kfree (info);
@@ -341,10 +337,8 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };static int __devinit sa1100_mtd_probe (struct platform_device *pdev) {struct flash_platform_data *plat = pdev->dev.platform_data; -struct mtd_partition *parts; -const char *part_type =NULL ;struct sa_info *info; -int err, nr_parts =0 ; +int err;if (!plat)return -ENODEV ;
@@ -358,26 +352,8 @@ static int __devinit sa1100_mtd_probe(struct platform_device *pdev)/* * Partition selection stuff. */ - nr_parts =parse_mtd_partitions (info->mtd, part_probes, &parts,0 ); -if (nr_parts >0 ) { - info->parts = parts; - part_type ="dynamic" ; - }else { - parts = plat->parts; - nr_parts = plat->nr_parts; - part_type ="static" ; - } - -if (nr_parts ==0 ) -printk (KERN_NOTICE "SA1100 flash: no partition info " -"available, registering whole flash\n" ); -else -printk (KERN_NOTICE "SA1100 flash: using %s partition " -"definition\n" , part_type); - -mtd_device_register (info->mtd, parts, nr_parts); - - info->nr_parts = nr_parts; +mtd_device_parse_register (info->mtd, part_probes,0 , + plat->parts, plat->nr_parts);platform_set_drvdata (pdev, info); err =0 ;
Signature · 1 line
1.7.4.4
PATCH 20/44 mtd: solutionengine.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/solutionengine.c | 30 +++++++----------------------- 1 files changed, 7 insertions(+), 23 deletions(-)
drivers/mtd/maps/solutionengine.c +7 -23
@@ -19,8 +19,6 @@static struct mtd_info *flash_mtd;static struct mtd_info *eprom_mtd; -static struct mtd_partition *parsed_parts; -struct map_info soleng_eprom_map = { .name ="Solution Engine EPROM" , .size =0x400000 ,
@@ -51,12 +49,14 @@ static struct mtd_partition superh_se_partitions[] = { .size = MTDPART_SIZ_FULL, } }; +#define NUM_PARTITIONS ARRAY_SIZE(superh_se_partitions) +#else +#define superh_se_partitions NULL +#define NUM_PARTITIONS 0#endif /* CONFIG_MTD_SUPERH_RESERVE */ static int __init init_soleng_maps (void ) { -int nr_parts =0 ; -/* First probe at offset 0 */ soleng_flash_map.phys =0 ; soleng_flash_map.virt = (void __iomem *)P2SEGADDR (0 );
@@ -92,21 +92,8 @@ static int __init init_soleng_maps(void)mtd_device_register (eprom_mtd,NULL ,0 ); } - nr_parts =parse_mtd_partitions (flash_mtd, probes, &parsed_parts,0 ); - -#ifdef CONFIG_MTD_SUPERH_RESERVE -if (nr_parts <=0 ) { -printk (KERN_NOTICE "Using configured partition at 0x%08x.\n" , -CONFIG_MTD_SUPERH_RESERVE ); - parsed_parts = superh_se_partitions; - nr_parts =sizeof (superh_se_partitions)/sizeof (*parsed_parts); - } -#endif /* CONFIG_MTD_SUPERH_RESERVE */ - -if (nr_parts >0 ) -mtd_device_register (flash_mtd, parsed_parts, nr_parts); -else -mtd_device_register (flash_mtd,NULL ,0 ); +mtd_device_parse_register (flash_mtd, probes,0 , + superh_se_partitions,NUM_PARTITIONS );return 0 ; }
@@ -118,10 +105,7 @@ static void __exit cleanup_soleng_maps(void)map_destroy (eprom_mtd); } -if (parsed_parts) -mtd_device_unregister (flash_mtd); -else -mtd_device_unregister (flash_mtd); +mtd_device_unregister (flash_mtd);map_destroy (flash_mtd); }
Signature · 1 line
1.7.4.4
PATCH 21/44 mtd: wr_sbc82xx_flash.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/maps/wr_sbc82xx_flash.c | 30 +++++++++++------------------- 1 files changed, 11 insertions(+), 19 deletions(-)
drivers/mtd/maps/wr_sbc82xx_flash.c +11 -19
@@ -20,7 +20,6 @@#include <asm/immap_cpm2.h> static struct mtd_info *sbcmtd[3 ]; -static struct mtd_partition *sbcmtd_parts[3 ];struct map_info sbc82xx_flash_map[3 ] = { {.name ="Boot flash" },
@@ -101,6 +100,7 @@ static int __init init_sbc82xx_flash(void)for (i=0 ; i<3 ; i++) {int8_t flashcs[3 ] = {0 ,6 ,1 };int nr_parts; +struct mtd_partition *defparts; printk(KERN_NOTICE "PowerQUICC II %s (%ld MiB on CS%d", sbc82xx_flash_map[i].name,
@@ -129,24 +129,20 @@ static int __init init_sbc82xx_flash(void) sbcmtd[i]->owner =THIS_MODULE ; - nr_parts =parse_mtd_partitions (sbcmtd[i], part_probes, - &sbcmtd_parts[i],0 ); -if (nr_parts >0 ) { -mtd_device_register (sbcmtd[i], sbcmtd_parts[i], - nr_parts); -continue ; - } -/* No partitioning detected. Use default */ if (i ==2 ) { -mtd_device_register (sbcmtd[i],NULL ,0 ); + defparts =NULL ; + nr_parts =0 ; }else if (i == bigflash) { -mtd_device_register (sbcmtd[i], bigflash_parts, -ARRAY_SIZE (bigflash_parts)); + defparts = bigflash_parts; + nr_parts =ARRAY_SIZE (bigflash_parts); }else { -mtd_device_register (sbcmtd[i], smallflash_parts, -ARRAY_SIZE (smallflash_parts)); + defparts = smallflash_parts; + nr_parts =ARRAY_SIZE (smallflash_parts); } + +mtd_device_parse_register (sbcmtd[i], part_probes,0 , + defparts, nr_parts); }return 0 ; }
@@ -159,12 +155,8 @@ static void __exit cleanup_sbc82xx_flash(void)if (!sbcmtd[i])continue ; -if (i<2 || sbcmtd_parts[i]) -mtd_device_unregister (sbcmtd[i]); -else -mtd_device_unregister (sbcmtd[i]); +mtd_device_unregister (sbcmtd[i]); -kfree (sbcmtd_parts[i]);map_destroy (sbcmtd[i]);iounmap ((void *)sbc82xx_flash_map[i].virt);
Signature · 1 line
1.7.4.4
PATCH 22/44 mtd: atmel_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/atmel_nand.c | 19 ++----------------- 1 files changed, 2 insertions(+), 17 deletions(-)
drivers/mtd/nand/atmel_nand.c +2 -17
@@ -491,8 +491,6 @@ static int __init atmel_nand_probe(struct platform_device *pdev)struct resource *regs;struct resource *mem;int res; -struct mtd_partition *partitions =NULL ; -int num_partitions =0 ; mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!mem) {
@@ -651,24 +649,11 @@ static int __init atmel_nand_probe(struct platform_device *pdev) } mtd->name ="atmel_nand" ; - num_partitions =parse_mtd_partitions (mtd,NULL , &partitions,0 ); -if (num_partitions <=0 && host->board->parts) { - partitions = host->board->parts; - num_partitions = host->board->num_parts; - } - -if ((!partitions) || (num_partitions ==0 )) { -printk (KERN_ERR "atmel_nand: No partitions defined, or unsupported device.\n" ); - res = -ENXIO ; - goto err_no_partitions; - } - - res =mtd_device_register (mtd, partitions, num_partitions); + res =mtd_device_parse_register (mtd,NULL ,0 , + host->board->parts, host->board->num_parts);if (!res)return res; -err_no_partitions: -nand_release (mtd); err_scan_tail: err_scan_ident: err_no_card:
Signature · 1 line
1.7.4.4
PATCH 23/44 mtd: bcm_umi_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/bcm_umi_nand.c | 19 ++----------------- 1 files changed, 2 insertions(+), 17 deletions(-)
drivers/mtd/nand/bcm_umi_nand.c +2 -17
@@ -489,23 +489,8 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev) }/* Register the partitions */ - { -int nr_partitions; -struct mtd_partition *partition_info; - - board_mtd->name ="bcm_umi-nand" ; - nr_partitions =parse_mtd_partitions (board_mtd,NULL , - &partition_info,0 ); - -if (nr_partitions <=0 ) { -printk (KERN_ERR "BCM UMI NAND: Too few partitions - %d\n" , - nr_partitions); -iounmap (bcm_umi_io_base); -kfree (board_mtd); -return -EIO ; - } -mtd_device_register (board_mtd, partition_info, nr_partitions); - } + board_mtd->name ="bcm_umi-nand" ; +mtd_device_parse_register (board_mtd,NULL ,0 ,NULL ,0 );/* Return happy */ return 0 ;
Signature · 1 line
1.7.4.4
PATCH 24/44 mtd: cafe_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/cafe_nand.c | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-)
drivers/mtd/nand/cafe_nand.c +2 -9
@@ -57,7 +57,6 @@struct cafe_priv {struct nand_chip nand; -struct mtd_partition *parts;struct pci_dev *pdev;void __iomem *mmio;struct rs_control *rs;
@@ -630,8 +629,6 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,struct cafe_priv *cafe;uint32_t ctrl;int err =0 ; -struct mtd_partition *parts; -int nr_parts;/* Very old versions shared the same PCI ident for all three functions on the chip. Verify the class too... */
@@ -804,12 +801,8 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,mtd_device_register (mtd,NULL ,0 ); mtd->name ="cafe_nand" ; - nr_parts =parse_mtd_partitions (mtd, part_probes, &parts,0 ); -if (nr_parts >0 ) { - cafe->parts = parts; -dev_info (&cafe->pdev->dev,"%d partitions found\n" , nr_parts); -mtd_device_register (mtd, parts, nr_parts); - } +mtd_device_parse_register (mtd, part_probes,0 ,NULL ,0 ); + goto out; out_irq:
Signature · 1 line
1.7.4.4
PATCH 25/44 mtd: cmx270_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/cmx270_nand.c | 20 ++------------------ 1 files changed, 2 insertions(+), 18 deletions(-)
drivers/mtd/nand/cmx270_nand.c +2 -18
@@ -149,9 +149,6 @@ static int cmx270_device_ready(struct mtd_info *mtd)static int __init cmx270_init (void ) {struct nand_chip *this; -const char *part_type; -struct mtd_partition *mtd_parts; -int mtd_parts_nb =0 ;int ret;if (!(machine_is_armcore () &&cpu_is_pxa27x ()))
@@ -220,22 +217,9 @@ static int __init cmx270_init(void) goto err_scan; } - mtd_parts_nb =parse_mtd_partitions (cmx270_nand_mtd,NULL , - &mtd_parts,0 ); -if (mtd_parts_nb >0 ) - part_type ="command line" ; -else - mtd_parts_nb =0 ; - -if (!mtd_parts_nb) { - mtd_parts = partition_info; - mtd_parts_nb =NUM_PARTITIONS ; - part_type ="static" ; - } -/* Register the partitions */ -pr_notice ("Using %s partition definition\n" , part_type); - ret =mtd_device_register (cmx270_nand_mtd, mtd_parts, mtd_parts_nb); + ret =mtd_device_parse_register (cmx270_nand_mtd,NULL ,0 , + partition_info,NUM_PARTITIONS );if (ret) goto err_scan;
Signature · 1 line
1.7.4.4
PATCH 26/44 mtd: cs553x_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/cs553x_nand.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
drivers/mtd/nand/cs553x_nand.c +2 -5
@@ -283,8 +283,6 @@ static int __init cs553x_init(void)int err = -ENXIO ;int i;uint64_t val; -int mtd_parts_nb =0 ; -struct mtd_partition *mtd_parts =NULL ;/* If the CPU isn't a Geode GX or LX, abort */ if (!is_geode ())
@@ -316,9 +314,8 @@ static int __init cs553x_init(void)if (cs553x_mtd[i]) {/* If any devices registered, return success. Else the last error. */ - mtd_parts_nb =parse_mtd_partitions (cs553x_mtd[i],NULL , &mtd_parts,0 ); -mtd_device_register (cs553x_mtd[i], mtd_parts, - mtd_parts_nb); +mtd_device_parse_register (cs553x_mtd[i],NULL ,0 , +NULL ,0 ); err =0 ; } }
Signature · 1 line
1.7.4.4
Re: [PATCH 26/44] mtd: cs553x_nand.c: use mtd_device_parse_register
Quoted 3 lines · Dmitry Eremin-Solenikov
+ mtd_device_parse_register(cs553x_mtd[i], NULL,
0,
+ NULL, 0);
You do not need 2 lines here.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Re: [PATCH 26/44] mtd: cs553x_nand.c: use mtd_device_parse_register
Quoted 6 lines · Artem Bityutskiy
Quoted 3 lines · Dmitry Eremin-Solenikov
+ mtd_device_parse_register(cs553x_mtd[i], NULL,
0,
+ NULL, 0);You do not need 2 lines here.
84 syms.
Signature · 2 lines
With best wishes Dmitry
PATCH 27/44 mtd: davinci_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/davinci_nand.c | 25 ++----------------------- 1 files changed, 2 insertions(+), 23 deletions(-)
drivers/mtd/nand/davinci_nand.c +2 -23
@@ -57,7 +57,6 @@ struct davinci_nand_info {struct device *dev;struct clk *clk; -bool partitioned;bool is_readmode;
@@ -530,8 +529,6 @@ static int __init nand_davinci_probe(struct platform_device *pdev)int ret;uint32_t val;nand_ecc_modes_t ecc_mode; -struct mtd_partition *mtd_parts =NULL ; -int mtd_parts_nb =0 ;/* insist on board-specific configuration */ if (!pdata)
@@ -753,26 +750,8 @@ syndrome_done:if (ret <0 ) goto err_scan; - mtd_parts_nb =parse_mtd_partitions (&info->mtd,NULL , &mtd_parts,0 ); - -if (mtd_parts_nb <=0 ) { - mtd_parts = pdata->parts; - mtd_parts_nb = pdata->nr_parts; - } - -/* Register any partitions */ -if (mtd_parts_nb >0 ) { - ret =mtd_device_register (&info->mtd, mtd_parts, - mtd_parts_nb); -if (ret ==0 ) - info->partitioned = true; - } - -/* If there's no partition info, just package the whole chip -* as a single MTD device. -*/ -if (!info->partitioned) - ret =mtd_device_register (&info->mtd,NULL ,0 ) ? -ENODEV :0 ; + ret =mtd_device_parse_register (&info->mtd,NULL ,0 , + pdata->parts, pdata->nr_parts);if (ret <0 ) goto err_scan;
Signature · 1 line
1.7.4.4
PATCH 28/44 mtd: edb7312.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/edb7312.c | 17 ++--------------- 1 files changed, 2 insertions(+), 15 deletions(-)
drivers/mtd/nand/edb7312.c +2 -15
@@ -104,9 +104,6 @@ static int ep7312_device_ready(struct mtd_info *mtd)static int __init ep7312_init (void ) {struct nand_chip *this; -const char *part_type =0 ; -int mtd_parts_nb =0 ; -struct mtd_partition *mtd_parts =0 ;void __iomem *ep7312_fio_base;/* Allocate memory for MTD device structure and private data */
@@ -156,20 +153,10 @@ static int __init ep7312_init(void)return -ENXIO ; } ep7312_mtd->name ="edb7312-nand" ; - mtd_parts_nb =parse_mtd_partitions (ep7312_mtd,NULL , &mtd_parts,0 ); -if (mtd_parts_nb >0 ) - part_type ="command line" ; -else - mtd_parts_nb =0 ; -if (mtd_parts_nb ==0 ) { - mtd_parts = partition_info; - mtd_parts_nb =NUM_PARTITIONS ; - part_type ="static" ; - }/* Register the partitions */ -printk (KERN_NOTICE "Using %s partition definition\n" , part_type); -mtd_device_register (ep7312_mtd, mtd_parts, mtd_parts_nb); +mtd_device_register (ep7312_mtd,NULL ,0 , + partition_info,NUM_PARTITIONS );/* Return happy */ return 0 ;
Signature · 1 line
1.7.4.4
Re: [PATCH 28/44] mtd: edb7312.c: use mtd_device_parse_register
drivers/mtd/nand/edb7312.c static int __init ep7312_init(void) · line 159
Quoted 3 lines · Dmitry Eremin-Solenikov
drivers/mtd/nand/edb7312.c +2
-1-mtd_device_register (ep7312_mtd, mtd_parts, mtd_parts_nb); +mtd_device_register (ep7312_mtd,NULL ,0 , + partition_info,NUM_PARTITIONS );
And probably here?
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Re: [PATCH 28/44] mtd: edb7312.c: use mtd_device_parse_register
Quoted 6 lines · Artem Bityutskiy
drivers/mtd/nand/edb7312.c static int __init ep7312_init(void) · line 159
Quoted 3 lines · Dmitry Eremin-Solenikov
drivers/mtd/nand/edb7312.c +2
-1-mtd_device_register (ep7312_mtd, mtd_parts, mtd_parts_nb); +mtd_device_register (ep7312_mtd,NULL ,0 , + partition_info,NUM_PARTITIONS );And probably here?
82 syms
Signature · 2 lines
With best wishes Dmitry
PATCH 29/44 mtd: fsmc_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/fsmc_nand.c | 66 ++++++------------------------------------ 1 files changed, 9 insertions(+), 57 deletions(-)
drivers/mtd/nand/fsmc_nand.c +9 -57
@@ -146,7 +146,7 @@ static struct mtd_partition partition_info_16KB_blk[] = { { .name = "Root File System", .offset = 0x460000, - .size = 0, + .size = MTDPART_SIZ_FULL, }, };
@@ -173,7 +173,7 @@ static struct mtd_partition partition_info_128KB_blk[] = { { .name = "Root File System", .offset = 0x800000, - .size = 0, + .size = MTDPART_SIZ_FULL, }, };
@@ -184,8 +184,6 @@ static struct mtd_partition partition_info_128KB_blk[] = {* @pid: Part ID on the AMBA PrimeCell format * @mtd: MTD info for a NAND flash. * @nand: Chip related info for a NAND flash. -* @partitions: Partition info for a NAND Flash. -* @nr_partitions: Total number of partition of a NAND flash. * * @ecc_place: ECC placing locations in oobfree type format. * @bank: Bank number for probed device.
@@ -200,8 +198,6 @@ struct fsmc_nand_data {u32 pid;struct mtd_info mtd;struct nand_chip nand; -struct mtd_partition *partitions; -unsigned int nr_partitions;struct fsmc_eccplace *ecc_place;unsigned int bank;
@@ -717,57 +713,13 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)* Check for partition info passed */ host->mtd.name ="nand" ; - host->nr_partitions =parse_mtd_partitions (&host->mtd,NULL , - &host->partitions,0 ); -if (host->nr_partitions <=0 ) { -/* -* Check if partition info passed via command line -*/ -if (pdata->partitions) { - host->partitions = pdata->partitions; - host->nr_partitions = pdata->nr_partitions; - }else { -struct mtd_partition *partition; -int i; - -/* Select the default partitions info */ -switch (host->mtd.size) { -case 0x01000000 : -case 0x02000000 : -case 0x04000000 : - host->partitions = partition_info_16KB_blk; - host->nr_partitions = -sizeof (partition_info_16KB_blk) / -sizeof (struct mtd_partition ); -break ; -case 0x08000000 : -case 0x10000000 : -case 0x20000000 : -case 0x40000000 : - host->partitions = partition_info_128KB_blk; - host->nr_partitions = -sizeof (partition_info_128KB_blk) / -sizeof (struct mtd_partition ); -break ; -default : - ret = -ENXIO ; -pr_err ("Unsupported NAND size\n" ); - goto err_probe; - } - - partition = host->partitions; -for (i =0 ; i < host->nr_partitions; i++, partition++) { -if (partition->size ==0 ) { - partition->size = host->mtd.size - - partition->offset; -break ; - } - } - } - } - - ret =mtd_device_register (&host->mtd, host->partitions, - host->nr_partitions); + ret = mtd_device_parse_register(&host->mtd, NULL, 0, + host->mtd.size <= 0x04000000 ? + partition_info_16KB_blk : + partition_info_128KB_blk, + host->mtd.size <= 0x04000000 ? + ARRAY_SIZE(partition_info_16KB_blk) : + ARRAY_SIZE(partition_info_128KB_blk), if (ret) goto err_probe;
Signature · 1 line
1.7.4.4
PATCH 30/44 mtd: h1910.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/h1910.c | 15 ++------------- 1 files changed, 2 insertions(+), 13 deletions(-)
drivers/mtd/nand/h1910.c +2 -13
@@ -81,9 +81,6 @@ static int h1910_device_ready(struct mtd_info *mtd)static int __init h1910_init (void ) {struct nand_chip *this; -const char *part_type =0 ; -int mtd_parts_nb =0 ; -struct mtd_partition *mtd_parts =0 ;void __iomem *nandaddr;if (!machine_is_h1900 ())
@@ -136,18 +133,10 @@ static int __init h1910_init(void)iounmap ((void *)nandaddr);return -ENXIO ; } - mtd_parts_nb =parse_mtd_partitions (h1910_nand_mtd,NULL , &mtd_parts,0 ); -if (mtd_parts_nb >0 ) - part_type ="command line" ; -else { - mtd_parts = partition_info; - mtd_parts_nb =NUM_PARTITIONS ; - part_type ="static" ; - }/* Register the partitions */ -printk (KERN_NOTICE "Using %s partition definition\n" , part_type); -mtd_device_register (h1910_nand_mtd, mtd_parts, mtd_parts_nb); +mtd_device_parse_register (h1910_nand_mtd,NULL ,0 , + partition_info,NUM_PARTITIONS );/* Return happy */ return 0 ;
Signature · 1 line
1.7.4.4
PATCH 31/44 mtd: jz4740_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/jz4740_nand.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-)
drivers/mtd/nand/jz4740_nand.c +3 -8
@@ -295,8 +295,6 @@ static int __devinit jz_nand_probe(struct platform_device *pdev)struct nand_chip *chip;struct mtd_info *mtd;struct jz_nand_platform_data *pdata = pdev->dev.platform_data; -struct mtd_partition *partition_info; -int num_partitions =0 ; nand =kzalloc (sizeof (*nand),GFP_KERNEL );if (!nand) {
@@ -369,12 +367,9 @@ static int __devinit jz_nand_probe(struct platform_device *pdev) goto err_gpio_free; } - num_partitions =parse_mtd_partitions (mtd,NULL , &partition_info,0 ); -if (num_partitions <=0 && pdata) { - num_partitions = pdata->num_partitions; - partition_info = pdata->partitions; - } - ret =mtd_device_register (mtd, partition_info, num_partitions); + ret =mtd_device_parse_register (mtd,NULL ,0 , + pdata ? pdata->partitions :NULL , + pdata ? pdata->num_partitions :0 );if (ret) {dev_err (&pdev->dev,"Failed to add mtd device\n" );
Signature · 1 line
1.7.4.4
PATCH 32/44 mtd: mxc_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/mxc_nand.c | 15 +++------------ 1 files changed, 3 insertions(+), 12 deletions(-)
drivers/mtd/nand/mxc_nand.c +3 -12
@@ -143,7 +143,6 @@struct mxc_nand_host {struct mtd_info mtd;struct nand_chip nand; -struct mtd_partition *parts;struct device *dev;void *spare0;
@@ -1044,7 +1043,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)struct mxc_nand_platform_data *pdata = pdev->dev.platform_data;struct mxc_nand_host *host;struct resource *res; -int err =0 ,__maybe_unused nr_parts =0 ; +int err =0 ;struct nand_ecclayout *oob_smallpage, *oob_largepage;/* Allocate memory for MTD device structure and private data */
@@ -1231,16 +1230,8 @@ static int __init mxcnd_probe(struct platform_device *pdev) }/* Register the partitions */ - nr_parts = -parse_mtd_partitions (mtd, part_probes, &host->parts,0 ); -if (nr_parts >0 ) -mtd_device_register (mtd, host->parts, nr_parts); -else if (pdata->parts) -mtd_device_register (mtd, pdata->parts, pdata->nr_parts); -else { -pr_info ("Registering %s as whole device\n" , mtd->name); -mtd_device_register (mtd,NULL ,0 ); - } +mtd_device_parse_register (mtd, part_probes,0 , + pdata->parts, pdata->nr_parts);platform_set_drvdata (pdev, host);
Signature · 1 line
1.7.4.4
PATCH 33/44 mtd: omap2.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/omap2.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-)
drivers/mtd/nand/omap2.c +2 -8
@@ -112,7 +112,6 @@ struct omap_nand_info {struct nand_hw_control controller;struct omap_nand_platform_data *pdata;struct mtd_info mtd; -struct mtd_partition *parts;struct nand_chip nand;struct platform_device *pdev;
@@ -1101,13 +1100,8 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) goto out_release_mem_region; } - err =parse_mtd_partitions (&info->mtd,NULL , &info->parts,0 ); -if (err >0 ) -mtd_device_register (&info->mtd, info->parts, err); -else if (pdata->parts) -mtd_device_register (&info->mtd, pdata->parts, pdata->nr_parts); -else -mtd_device_register (&info->mtd,NULL ,0 ); +mtd_device_parse_register (&info->mtd,NULL ,0 , + pdata->parts, pdata->nr_parts);platform_set_drvdata (pdev, &info->mtd);
Signature · 1 line
1.7.4.4
PATCH 34/44 mtd: orion_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/orion_nand.c | 12 ++---------- 1 files changed, 2 insertions(+), 10 deletions(-)
drivers/mtd/nand/orion_nand.c +2 -10
@@ -79,8 +79,6 @@ static int __init orion_nand_probe(struct platform_device *pdev)struct resource *res;void __iomem *io_base;int ret =0 ; -struct mtd_partition *partitions =NULL ; -int num_part =0 ; nc =kzalloc (sizeof (struct nand_chip ) +sizeof (struct mtd_info ),GFP_KERNEL );if (!nc) {
@@ -131,14 +129,8 @@ static int __init orion_nand_probe(struct platform_device *pdev) } mtd->name ="orion_nand" ; - num_part =parse_mtd_partitions (mtd,NULL , &partitions,0 ); -/* If cmdline partitions have been passed, let them be used */ -if (num_part <=0 ) { - num_part = board->nr_parts; - partitions = board->parts; - } - - ret =mtd_device_register (mtd, partitions, num_part); + ret =mtd_device_parse_register (mtd,NULL ,0 , + board->parts, board->nr_parts);if (ret) {nand_release (mtd); goto no_dev;
Signature · 1 line
1.7.4.4
PATCH 35/44 mtd: plat_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/plat_nand.c | 22 +++------------------- 1 files changed, 3 insertions(+), 19 deletions(-)
drivers/mtd/nand/plat_nand.c +3 -19
@@ -21,8 +21,6 @@ struct plat_nand_data {struct nand_chip chip;struct mtd_info mtd;void __iomem *io_base; -int nr_parts; -struct mtd_partition *parts; };/*
@@ -99,21 +97,9 @@ static int __devinit plat_nand_probe(struct platform_device *pdev) goto out; } -if (pdata->chip.part_probe_types) { - err =parse_mtd_partitions (&data->mtd, - pdata->chip.part_probe_types, - &data->parts,0 ); -if (err >0 ) { -mtd_device_register (&data->mtd, data->parts, err); -return 0 ; - } - } -if (pdata->chip.partitions) { - data->parts = pdata->chip.partitions; - err =mtd_device_register (&data->mtd, data->parts, - pdata->chip.nr_partitions); - }else - err =mtd_device_register (&data->mtd,NULL ,0 ); + err =mtd_device_parse_register (&data->mtd, + pdata->chip.part_probe_types,0 , + pdata->chip.partitions, pdata->chip.nr_partitions);if (!err)return err;
@@ -143,8 +129,6 @@ static int __devexit plat_nand_remove(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );nand_release (&data->mtd); -if (data->parts && data->parts != pdata->chip.partitions) -kfree (data->parts);if (pdata->ctrl.remove) pdata->ctrl.remove (pdev);iounmap (data->io_base);
Signature · 1 line
1.7.4.4
PATCH 36/44 mtd: ppchameleonevb.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/ppchameleonevb.c | 42 ++++++++---------------------------- 1 files changed, 10 insertions(+), 32 deletions(-)
drivers/mtd/nand/ppchameleonevb.c +10 -32
@@ -191,9 +191,6 @@ static int ppchameleonevb_device_ready(struct mtd_info *minfo)static int __init ppchameleonevb_init (void ) {struct nand_chip *this; -const char *part_type =0 ; -int mtd_parts_nb =0 ; -struct mtd_partition *mtd_parts =0 ;void __iomem *ppchameleon_fio_base;void __iomem *ppchameleonevb_fio_base;
@@ -276,24 +273,13 @@ static int __init ppchameleonevb_init(void)#endif ppchameleon_mtd->name ="ppchameleon-nand" ; - mtd_parts_nb =parse_mtd_partitions (ppchameleon_mtd,NULL , &mtd_parts,0 ); -if (mtd_parts_nb >0 ) - part_type ="command line" ; -else - mtd_parts_nb =0 ; - -if (mtd_parts_nb ==0 ) { -if (ppchameleon_mtd->size ==NAND_SMALL_SIZE ) - mtd_parts = partition_info_me; -else - mtd_parts = partition_info_hi; - mtd_parts_nb =NUM_PARTITIONS ; - part_type ="static" ; - }/* Register the partitions */ -printk (KERN_NOTICE "Using %s partition definition\n" , part_type); -mtd_device_register (ppchameleon_mtd, mtd_parts, mtd_parts_nb); +mtd_device_parse_register (ppchameleon_mtd,NULL ,0 , + ppchameleon_mtd->size ==NAND_SMALL_SIZE ? + partition_info_me : + partition_info_hi, +NUM_PARTITIONS ); nand_evb_init:/****************************
@@ -377,21 +363,13 @@ static int __init ppchameleonevb_init(void) } ppchameleonevb_mtd->name =NAND_EVB_MTD_NAME ; - mtd_parts_nb =parse_mtd_partitions (ppchameleonevb_mtd,NULL , &mtd_parts,0 ); -if (mtd_parts_nb >0 ) - part_type ="command line" ; -else - mtd_parts_nb =0 ; - -if (mtd_parts_nb ==0 ) { - mtd_parts = partition_info_evb; - mtd_parts_nb =NUM_PARTITIONS ; - part_type ="static" ; - }/* Register the partitions */ -printk (KERN_NOTICE "Using %s partition definition\n" , part_type); -mtd_device_register (ppchameleonevb_mtd, mtd_parts, mtd_parts_nb); +mtd_device_parse_register (ppchameleonevb_mtd,NULL ,0 , + ppchameleon_mtd->size ==NAND_SMALL_SIZE ? + partition_info_me : + partition_info_hi, +NUM_PARTITIONS );/* Return happy */ return 0 ;
Signature · 1 line
1.7.4.4
PATCH 37/44 mtd: pxa3xx_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/pxa3xx_nand.c | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-)
drivers/mtd/nand/pxa3xx_nand.c +2 -9
@@ -1133,8 +1133,6 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) {struct pxa3xx_nand_platform_data *pdata;struct pxa3xx_nand_info *info; -struct mtd_partition *parts; -int nr_parts; pdata = pdev->dev.platform_data;if (!pdata) {
@@ -1152,13 +1150,8 @@ static int pxa3xx_nand_probe(struct platform_device *pdev)return -ENODEV ; } - - nr_parts =parse_mtd_partitions (info->mtd,NULL , &parts,0 ); - -if (nr_parts) -return mtd_device_register (info->mtd, parts, nr_parts); - -return mtd_device_register (info->mtd, pdata->parts, pdata->nr_parts); +return mtd_device_parse_register (info->mtd,NULL ,0 , + pdata->parts, pdata->nr_parts); }#ifdef CONFIG_PM
Signature · 1 line
1.7.4.4
PATCH 38/44 mtd: s3c2410.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/s3c2410.c | 18 ++++-------------- 1 files changed, 4 insertions(+), 14 deletions(-)
drivers/mtd/nand/s3c2410.c +4 -14
@@ -748,21 +748,11 @@ static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info,struct s3c2410_nand_mtd *mtd, struct s3c2410_nand_set *set) { - struct mtd_partition *part_info; -int nr_part =0 ; + if (set) + mtd->mtd.name = set->name; -if (set ==NULL ) -return mtd_device_register (&mtd->mtd,NULL ,0 ); - - mtd->mtd.name = set->name; - nr_part =parse_mtd_partitions (&mtd->mtd,NULL , &part_info,0 ); - -if (nr_part <=0 && set->nr_partitions >0 ) { - nr_part = set->nr_partitions; - part_info = set->partitions; - } - -return mtd_device_register (&mtd->mtd, part_info, nr_part); +return mtd_device_parse_register (&mtd->mtd,NULL ,0 , + set->partitions, set->nr_partitions); }/**
Signature · 1 line
1.7.4.4
PATCH 39/44 mtd: sharpsl.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/sharpsl.c | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-)
drivers/mtd/nand/sharpsl.c +2 -9
@@ -109,8 +109,6 @@ static int sharpsl_nand_calculate_ecc(struct mtd_info *mtd, const u_char * dat,static int __devinit sharpsl_nand_probe (struct platform_device *pdev) {struct nand_chip *this; -struct mtd_partition *sharpsl_partition_info; -int nr_partitions;struct resource *r;int err =0 ;struct sharpsl_nand *sharpsl;
@@ -182,14 +180,9 @@ static int __devinit sharpsl_nand_probe(struct platform_device *pdev)/* Register the partitions */ sharpsl->mtd.name ="sharpsl-nand" ; - nr_partitions =parse_mtd_partitions (&sharpsl->mtd,NULL , &sharpsl_partition_info,0 ); -if (nr_partitions <=0 ) { - nr_partitions = data->nr_partitions; - sharpsl_partition_info = data->partitions; - } - err =mtd_device_register (&sharpsl->mtd, sharpsl_partition_info, - nr_partitions); + err =mtd_device_parse_register (&sharpsl->mtd,NULL ,0 , + data->partitions, data->nr_partitions);if (err) goto err_add;
Signature · 1 line
1.7.4.4
PATCH 40/44 mtd: tmio_nand.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/tmio_nand.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-)
drivers/mtd/nand/tmio_nand.c +3 -9
@@ -378,8 +378,6 @@ static int tmio_probe(struct platform_device *dev)struct tmio_nand *tmio;struct mtd_info *mtd;struct nand_chip *nand_chip; -struct mtd_partition *parts; -int nbparts =0 ;int retval;if (data ==NULL )
@@ -458,13 +456,9 @@ static int tmio_probe(struct platform_device *dev) goto err_scan; }/* Register the partitions */ - nbparts =parse_mtd_partitions (mtd,NULL , &parts,0 ); -if (nbparts <=0 && data) { - parts = data->partition; - nbparts = data->num_partitions; - } - - retval =mtd_device_register (mtd, parts, nbparts); + retval =mtd_device_register (mtd,NULL ,0 , + data ? data->partition :NULL , + data ? data->num_partitions :0 );if (!retval)return retval;
Signature · 1 line
1.7.4.4
PATCH 41/44 mtd: txx9ndfmc.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/nand/txx9ndfmc.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/mtd/nand/txx9ndfmc.c +1 -6
@@ -74,7 +74,6 @@ struct txx9ndfmc_drvdata {unsigned char hold;/* in gbusclock */ unsigned char spw;/* in gbusclock */ struct nand_hw_control hw_control; -struct mtd_partition *parts[MAX_TXX9NDFMC_DEV ]; };static struct platform_device *mtd_to_platdev (struct mtd_info *mtd)
@@ -332,7 +331,6 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)struct txx9ndfmc_priv *txx9_priv;struct nand_chip *chip;struct mtd_info *mtd; -int nr_parts;if (!(plat->ch_mask & (1 << i)))continue ;
@@ -392,9 +390,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev) } mtd->name = txx9_priv->mtdname; - nr_parts =parse_mtd_partitions (mtd,NULL , - &drvdata->parts[i],0 ); -mtd_device_register (mtd, drvdata->parts[i], nr_parts); +mtd_device_parse_register (mtd,NULL ,0 ,NULL ,0 ); drvdata->mtds[i] = mtd; }
@@ -420,7 +416,6 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev) txx9_priv = chip->priv;nand_release (mtd); -kfree (drvdata->parts[i]);kfree (txx9_priv->mtdname);kfree (txx9_priv); }
Signature · 1 line
1.7.4.4
PATCH 42/44 mtd: onenand/generic.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/onenand/generic.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-)
drivers/mtd/onenand/generic.c +3 -8
@@ -32,7 +32,6 @@struct onenand_info {struct mtd_info mtd; -struct mtd_partition *parts;struct onenand_chip onenand; };
@@ -71,13 +70,9 @@ static int __devinit generic_onenand_probe(struct platform_device *pdev) goto out_iounmap; } - err =parse_mtd_partitions (&info->mtd,NULL , &info->parts,0 ); -if (err >0 ) -mtd_device_register (&info->mtd, info->parts, err); -else if (err <=0 && pdata && pdata->parts) -mtd_device_register (&info->mtd, pdata->parts, pdata->nr_parts); -else - err =mtd_device_register (&info->mtd,NULL ,0 ); + err =mtd_device_parse_register (&info->mtd,NULL ,0 , + pdata ? pdata->parts :NULL , + pdata ? pdata->nr_parts :0 );platform_set_drvdata (pdev, info);
Signature · 1 line
1.7.4.4
PATCH 43/44 mtd: onenand/omap2.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/onenand/omap2.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-)
drivers/mtd/onenand/omap2.c +3 -10
@@ -57,7 +57,6 @@ struct omap2_onenand {unsigned long phys_base;int gpio_irq;struct mtd_info mtd; -struct mtd_partition *parts;struct onenand_chip onenand;struct completion irq_done;struct completion dma_done;
@@ -752,13 +751,9 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)if ((r =onenand_scan (&c->mtd,1 )) <0 ) goto err_release_regulator; - r =parse_mtd_partitions (&c->mtd,NULL , &c->parts,0 ); -if (r >0 ) - r =mtd_device_register (&c->mtd, c->parts, r); -else if (pdata->parts !=NULL ) - r =mtd_device_register (&c->mtd, pdata->parts, pdata->nr_parts); -else - r =mtd_device_register (&c->mtd,NULL ,0 ); + r =mtd_device_parse_register (&info->mtd,NULL ,0 , + pdata ? pdata->parts :NULL , + pdata ? pdata->nr_parts :0 );if (r) goto err_release_onenand;
@@ -785,7 +780,6 @@ err_release_mem_region: err_free_cs:gpmc_cs_free (c->gpmc_cs); err_kfree: -kfree (c->parts);kfree (c);return r;
@@ -808,7 +802,6 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev)iounmap (c->onenand.base);release_mem_region (c->phys_base,ONENAND_IO_SIZE );gpmc_cs_free (c->gpmc_cs); -kfree (c->parts);kfree (c);return 0 ;
Signature · 1 line
1.7.4.4
PATCH 44/44 mtd: onenand/samsung.c: use mtd_device_parse_register
In reply to Dmitry Eremin-SolenikovReplace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc.
--- drivers/mtd/onenand/samsung.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-)
drivers/mtd/onenand/samsung.c +3 -8
@@ -147,7 +147,6 @@ struct s3c_onenand {struct resource *dma_res;unsigned long phys_base;struct completion complete; -struct mtd_partition *parts; };#define CMD_MAP_00 (dev, addr) (dev->cmd_map(MAP_00, ((addr) << 1)))
@@ -1015,13 +1014,9 @@ static int s3c_onenand_probe(struct platform_device *pdev)if (s3c_read_reg (MEM_CFG_OFFSET ) &ONENAND_SYS_CFG1_SYNC_READ )dev_info (&onenand->pdev->dev,"OneNAND Sync. Burst Read enabled\n" ); - err =parse_mtd_partitions (mtd,NULL , &onenand->parts,0 ); -if (err >0 ) -mtd_device_register (mtd, onenand->parts, err); -else if (err <=0 && pdata && pdata->parts) -mtd_device_register (mtd, pdata->parts, pdata->nr_parts); -else - err =mtd_device_register (mtd,NULL ,0 ); + err =mtd_device_parse_register (&info->mtd,NULL ,0 , + pdata ? pdata->parts :NULL , + pdata ? pdata->nr_parts :0 );platform_set_drvdata (pdev, mtd);
Signature · 1 line
1.7.4.4
Quoted 8 lines · Dmitry Eremin-Solenikov
Lots of mtd drivers have more or less the same common logic:
parse partitions, then register them. Currently this ends up with lots of code duplication, each copy having it's own features and bugs. In this patch serie I create a special function (mtd_device_parse_register) which handles all issues with acquiring partition information, registering mtd device(s) and returning correct error code.
Quoted 6 lines
The following changes since commit
85bd7e882840f4cb4d213768d252c754f22440ac:mtd:
pxa3xx_nand: Fix blank page ECC mismatch (2011-06-07 15:40:29 +0300)are available in the git repository at:
git://git.infradead.org/users/dbaryshkov/mtd-cleanup.gitmtd-parse-1st
Dmitry, the patch-set is a great clean-up! Could you please address few nit-picks I sent and also go through your patches and join the unnecessary 2 lines in your 'mtd_device_parse_register()' invocations? I think I can see several of them.
I mean,
mtd_device_parse_register(x, y, z,
a, b)
should become
mtd_device_parse_register(x, y, z, a, b)
if this fits 80 characters.
Thanks!
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)