aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2011-06-02 09:59:58 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 08:02:07 -0400
commitd45fd1218897b05dfa977a49f72e6f7bdc3e2471 (patch)
tree253ebd05180f35a27ab2825a023172d35f1f3206 /drivers/mtd/maps
parent6e6e44c8bf73cdbd3600f18cb195fc965c0f1b45 (diff)
mtd: physmap.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. Artem: tweaked the patch Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/physmap.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 2174d103297..66e8200079c 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -27,8 +27,6 @@ struct physmap_flash_info {
27 struct mtd_info *mtd[MAX_RESOURCES]; 27 struct mtd_info *mtd[MAX_RESOURCES];
28 struct mtd_info *cmtd; 28 struct mtd_info *cmtd;
29 struct map_info map[MAX_RESOURCES]; 29 struct map_info map[MAX_RESOURCES];
30 int nr_parts;
31 struct mtd_partition *parts;
32}; 30};
33 31
34static int physmap_flash_remove(struct platform_device *dev) 32static int physmap_flash_remove(struct platform_device *dev)
@@ -46,8 +44,6 @@ static int physmap_flash_remove(struct platform_device *dev)
46 44
47 if (info->cmtd) { 45 if (info->cmtd) {
48 mtd_device_unregister(info->cmtd); 46 mtd_device_unregister(info->cmtd);
49 if (info->nr_parts)
50 kfree(info->parts);
51 if (info->cmtd != info->mtd[0]) 47 if (info->cmtd != info->mtd[0])
52 mtd_concat_destroy(info->cmtd); 48 mtd_concat_destroy(info->cmtd);
53 } 49 }
@@ -175,23 +171,8 @@ static int physmap_flash_probe(struct platform_device *dev)
175 if (err) 171 if (err)
176 goto err_out; 172 goto err_out;
177 173
178 err = parse_mtd_partitions(info->cmtd, part_probe_types, 174 mtd_device_parse_register(info->cmtd, part_probe_types, 0,
179 &info->parts, 0); 175 physmap_data->parts, physmap_data->nr_parts);
180 if (err > 0) {
181 mtd_device_register(info->cmtd, info->parts, err);
182 info->nr_parts = err;
183 return 0;
184 }
185
186 if (physmap_data->nr_parts) {
187 printk(KERN_NOTICE "Using physmap partition information\n");
188 mtd_device_register(info->cmtd, physmap_data->parts,
189 physmap_data->nr_parts);
190 return 0;
191 }
192
193 mtd_device_register(info->cmtd, NULL, 0);
194
195 return 0; 176 return 0;
196 177
197err_out: 178err_out: