diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2011-06-02 09:59:59 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-11 08:02:12 -0400 |
commit | f44dcbd06236ecc610bd03abeceac77a21cb019e (patch) | |
tree | b12bc0b5a94d4d9c64ed28ead9bb14f1fa9e51ef /drivers/mtd | |
parent | fbcf62a32be1e897a1d730af430758f881f8ef35 (diff) |
mtd: physmap_of.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 <dedekind1@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/maps/physmap_of.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 55c4e2eefdc..7d65f9d3e69 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
@@ -34,13 +34,10 @@ struct of_flash_list { | |||
34 | 34 | ||
35 | struct of_flash { | 35 | struct of_flash { |
36 | struct mtd_info *cmtd; | 36 | struct mtd_info *cmtd; |
37 | struct mtd_partition *parts; | ||
38 | int list_size; /* number of elements in of_flash_list */ | 37 | int list_size; /* number of elements in of_flash_list */ |
39 | struct of_flash_list list[0]; | 38 | struct of_flash_list list[0]; |
40 | }; | 39 | }; |
41 | 40 | ||
42 | #define OF_FLASH_PARTS(info) ((info)->parts) | ||
43 | |||
44 | static int of_flash_remove(struct platform_device *dev) | 41 | static int of_flash_remove(struct platform_device *dev) |
45 | { | 42 | { |
46 | struct of_flash *info; | 43 | struct of_flash *info; |
@@ -56,11 +53,8 @@ static int of_flash_remove(struct platform_device *dev) | |||
56 | mtd_concat_destroy(info->cmtd); | 53 | mtd_concat_destroy(info->cmtd); |
57 | } | 54 | } |
58 | 55 | ||
59 | if (info->cmtd) { | 56 | if (info->cmtd) |
60 | if (OF_FLASH_PARTS(info)) | ||
61 | kfree(OF_FLASH_PARTS(info)); | ||
62 | mtd_device_unregister(info->cmtd); | 57 | mtd_device_unregister(info->cmtd); |
63 | } | ||
64 | 58 | ||
65 | for (i = 0; i < info->list_size; i++) { | 59 | for (i = 0; i < info->list_size; i++) { |
66 | if (info->list[i].mtd) | 60 | if (info->list[i].mtd) |
@@ -290,16 +284,10 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
290 | 284 | ||
291 | ppdata.of_node = dp; | 285 | ppdata.of_node = dp; |
292 | part_probe_types = of_get_probes(dp); | 286 | part_probe_types = of_get_probes(dp); |
293 | err = parse_mtd_partitions(info->cmtd, part_probe_types, | 287 | mtd_device_parse_register(info->cmtd, part_probe_types, &ppdata, |
294 | &info->parts, &ppdata); | 288 | NULL, 0); |
295 | if (err < 0) { | ||
296 | of_free_probes(part_probe_types); | ||
297 | goto err_out; | ||
298 | } | ||
299 | of_free_probes(part_probe_types); | 289 | of_free_probes(part_probe_types); |
300 | 290 | ||
301 | mtd_device_register(info->cmtd, info->parts, err); | ||
302 | |||
303 | kfree(mtd_list); | 291 | kfree(mtd_list); |
304 | 292 | ||
305 | return 0; | 293 | return 0; |