aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2011-06-02 09:59:30 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 08:02:06 -0400
commitcd3aafd0bd3ad383fd43196bc8dcac2edfec95c2 (patch)
tree0a75eb4fb831d8d5646c668877ce400ff02cdf53
parent81939afce261694f8e91a71e2cc7c817c13c57fd (diff)
mtd: bfin-async-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: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--drivers/mtd/maps/bfin-async-flash.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c
index 67815eed2f00..6d6b2b5674ee 100644
--- a/drivers/mtd/maps/bfin-async-flash.c
+++ b/drivers/mtd/maps/bfin-async-flash.c
@@ -41,7 +41,6 @@ struct async_state {
41 uint32_t flash_ambctl0, flash_ambctl1; 41 uint32_t flash_ambctl0, flash_ambctl1;
42 uint32_t save_ambctl0, save_ambctl1; 42 uint32_t save_ambctl0, save_ambctl1;
43 unsigned long irq_flags; 43 unsigned long irq_flags;
44 struct mtd_partition *parts;
45}; 44};
46 45
47static void switch_to_flash(struct async_state *state) 46static void switch_to_flash(struct async_state *state)
@@ -165,18 +164,8 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev)
165 return -ENXIO; 164 return -ENXIO;
166 } 165 }
167 166
168 ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); 167 mtd_device_parse_register(state->mtd, part_probe_types, 0,
169 if (ret > 0) { 168 pdata->parts, pdata->nr_parts);
170 pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n");
171 mtd_device_register(state->mtd, pdata->parts, ret);
172 state->parts = pdata->parts;
173 } else if (pdata->nr_parts) {
174 pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n");
175 mtd_device_register(state->mtd, pdata->parts, pdata->nr_parts);
176 } else {
177 pr_devinit(KERN_NOTICE DRIVER_NAME ": no partition info available, registering whole flash at once\n");
178 mtd_device_register(state->mtd, NULL, 0);
179 }
180 169
181 platform_set_drvdata(pdev, state); 170 platform_set_drvdata(pdev, state);
182 171
@@ -188,7 +177,6 @@ static int __devexit bfin_flash_remove(struct platform_device *pdev)
188 struct async_state *state = platform_get_drvdata(pdev); 177 struct async_state *state = platform_get_drvdata(pdev);
189 gpio_free(state->enet_flash_pin); 178 gpio_free(state->enet_flash_pin);
190 mtd_device_unregister(state->mtd); 179 mtd_device_unregister(state->mtd);
191 kfree(state->parts);
192 map_destroy(state->mtd); 180 map_destroy(state->mtd);
193 kfree(state); 181 kfree(state);
194 return 0; 182 return 0;