[PATCH] mtd: unify mtd partition/device registration

Andrew Morton akpm at linux-foundation.org
Fri Nov 14 16:39:53 EST 2008


On Wed, 12 Nov 2008 18:38:53 -0500
Mike Frysinger <vapier at 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 at 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 at mba.ocn.ne.jp>
Cc: David Woodhouse <dwmw2 at infradead.org>
Cc: Mike Frysinger <vapier at gentoo.org>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
---

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

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
_




More information about the linux-mtd mailing list