Patchwork mtd: unify mtd partition/device registration

login
register
mail settings
Submitter Andrew Morton
Date Nov. 14, 2008, 9:39 p.m.
Message ID <20081114133953.bb65b2ad.akpm@linux-foundation.org>
Download mbox | patch
Permalink /patch/8828/
State New, archived
Headers show

Comments

Andrew Morton - Nov. 14, 2008, 9:39 p.m.
On Wed, 12 Nov 2008 18:38:53 -0500
Mike Frysinger <vapier@gentoo.org> wrote:

> +int parse_mtd(struct mtd_info *mtd, const char **probe_types,
> +              struct mtd_partition *parts, int nr_parts)
> +{
> +#ifdef CONFIG_MTD_PARTITIONS
> +	const char *default_part_probe_types[] = {
> +		"cmdlinepart",
> +		"RedBoot",
> +		NULL
> +	};
> +	int ret;
> +
> +	if (!probe_types)
> +		probe_types = default_part_probe_types;
> +
> +	ret = parse_mtd_partitions(mtd, probe_types, &parts, 0);
> +	if (ret > 0) {
> +		ret = add_mtd_partitions(mtd, parts, ret);
> +		kfree(parts);
> +		return ret;
> +	} else if (nr_parts)
> +		return add_mtd_partitions(mtd, parts, nr_parts);
> +#endif
> +
> +	return add_mtd_device(mtd);
> +}

look:

From: Andrew Morton <akpm@linux-foundation.org>

          text    data     bss     dec     hex filename
before:   2488      88     132    2708     a94 drivers/mtd/mtdcore.o
after:    2456     100     132    2688     a80 drivers/mtd/mtdcore.o

Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/mtd/mtdcore.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff -puN drivers/mtd/mtdcore.c~mtd-unify-mtd-partition-device-registration-fix drivers/mtd/mtdcore.c
--- a/drivers/mtd/mtdcore.c~mtd-unify-mtd-partition-device-registration-fix
+++ a/drivers/mtd/mtdcore.c
@@ -306,7 +306,7 @@  int parse_mtd(struct mtd_info *mtd, cons
               struct mtd_partition *parts, int nr_parts)
 {
 #ifdef CONFIG_MTD_PARTITIONS
-	const char *default_part_probe_types[] = {
+	static const char *default_part_probe_types[] = {
 		"cmdlinepart",
 		"RedBoot",
 		NULL