Commit 534e4928 authored by Dmitry Eremin-Solenikov's avatar Dmitry Eremin-Solenikov Committed by Artem Bityutskiy

mtd: gpio-addr-flash.c: use mtd_device_parse_register

Replace 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.
Signed-off-by: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 3d0e9db4
...@@ -187,7 +187,6 @@ static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; ...@@ -187,7 +187,6 @@ static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL };
*/ */
static int __devinit gpio_flash_probe(struct platform_device *pdev) static int __devinit gpio_flash_probe(struct platform_device *pdev)
{ {
int nr_parts;
size_t i, arr_size; size_t i, arr_size;
struct physmap_flash_data *pdata; struct physmap_flash_data *pdata;
struct resource *memory; struct resource *memory;
...@@ -252,20 +251,9 @@ static int __devinit gpio_flash_probe(struct platform_device *pdev) ...@@ -252,20 +251,9 @@ static int __devinit gpio_flash_probe(struct platform_device *pdev)
return -ENXIO; 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment