diff options
Diffstat (limited to 'drivers/mtd/maps/physmap.c')
-rw-r--r-- | drivers/mtd/maps/physmap.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 1db16e549e38..87743661d48e 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -29,7 +29,6 @@ struct physmap_flash_info { | |||
29 | struct map_info map[MAX_RESOURCES]; | 29 | struct map_info map[MAX_RESOURCES]; |
30 | #ifdef CONFIG_MTD_PARTITIONS | 30 | #ifdef CONFIG_MTD_PARTITIONS |
31 | int nr_parts; | 31 | int nr_parts; |
32 | struct mtd_partition *parts; | ||
33 | #endif | 32 | #endif |
34 | }; | 33 | }; |
35 | 34 | ||
@@ -56,14 +55,10 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
56 | for (i = 0; i < MAX_RESOURCES; i++) { | 55 | for (i = 0; i < MAX_RESOURCES; i++) { |
57 | if (info->mtd[i] != NULL) { | 56 | if (info->mtd[i] != NULL) { |
58 | #ifdef CONFIG_MTD_PARTITIONS | 57 | #ifdef CONFIG_MTD_PARTITIONS |
59 | if (info->nr_parts) { | 58 | if (info->nr_parts || physmap_data->nr_parts) |
60 | del_mtd_partitions(info->mtd[i]); | 59 | del_mtd_partitions(info->mtd[i]); |
61 | kfree(info->parts); | 60 | else |
62 | } else if (physmap_data->nr_parts) { | ||
63 | del_mtd_partitions(info->mtd[i]); | ||
64 | } else { | ||
65 | del_mtd_device(info->mtd[i]); | 61 | del_mtd_device(info->mtd[i]); |
66 | } | ||
67 | #else | 62 | #else |
68 | del_mtd_device(info->mtd[i]); | 63 | del_mtd_device(info->mtd[i]); |
69 | #endif | 64 | #endif |
@@ -73,7 +68,12 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
73 | return 0; | 68 | return 0; |
74 | } | 69 | } |
75 | 70 | ||
76 | static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", NULL }; | 71 | static const char *rom_probe_types[] = { |
72 | "cfi_probe", | ||
73 | "jedec_probe", | ||
74 | "qinfo_probe", | ||
75 | "map_rom", | ||
76 | NULL }; | ||
77 | #ifdef CONFIG_MTD_PARTITIONS | 77 | #ifdef CONFIG_MTD_PARTITIONS |
78 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; | 78 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; |
79 | #endif | 79 | #endif |
@@ -86,6 +86,9 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
86 | int err = 0; | 86 | int err = 0; |
87 | int i; | 87 | int i; |
88 | int devices_found = 0; | 88 | int devices_found = 0; |
89 | #ifdef CONFIG_MTD_PARTITIONS | ||
90 | struct mtd_partition *parts; | ||
91 | #endif | ||
89 | 92 | ||
90 | physmap_data = dev->dev.platform_data; | 93 | physmap_data = dev->dev.platform_data; |
91 | if (physmap_data == NULL) | 94 | if (physmap_data == NULL) |
@@ -119,6 +122,7 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
119 | info->map[i].size = dev->resource[i].end - dev->resource[i].start + 1; | 122 | info->map[i].size = dev->resource[i].end - dev->resource[i].start + 1; |
120 | info->map[i].bankwidth = physmap_data->width; | 123 | info->map[i].bankwidth = physmap_data->width; |
121 | info->map[i].set_vpp = physmap_data->set_vpp; | 124 | info->map[i].set_vpp = physmap_data->set_vpp; |
125 | info->map[i].pfow_base = physmap_data->pfow_base; | ||
122 | 126 | ||
123 | info->map[i].virt = devm_ioremap(&dev->dev, info->map[i].phys, | 127 | info->map[i].virt = devm_ioremap(&dev->dev, info->map[i].phys, |
124 | info->map[i].size); | 128 | info->map[i].size); |
@@ -163,9 +167,10 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
163 | goto err_out; | 167 | goto err_out; |
164 | 168 | ||
165 | #ifdef CONFIG_MTD_PARTITIONS | 169 | #ifdef CONFIG_MTD_PARTITIONS |
166 | err = parse_mtd_partitions(info->cmtd, part_probe_types, &info->parts, 0); | 170 | err = parse_mtd_partitions(info->cmtd, part_probe_types, &parts, 0); |
167 | if (err > 0) { | 171 | if (err > 0) { |
168 | add_mtd_partitions(info->cmtd, info->parts, err); | 172 | add_mtd_partitions(info->cmtd, parts, err); |
173 | kfree(parts); | ||
169 | return 0; | 174 | return 0; |
170 | } | 175 | } |
171 | 176 | ||
@@ -251,14 +256,7 @@ static struct platform_driver physmap_flash_driver = { | |||
251 | }; | 256 | }; |
252 | 257 | ||
253 | 258 | ||
254 | #ifdef CONFIG_MTD_PHYSMAP_LEN | 259 | #ifdef CONFIG_MTD_PHYSMAP_COMPAT |
255 | #if CONFIG_MTD_PHYSMAP_LEN != 0 | ||
256 | #warning using PHYSMAP compat code | ||
257 | #define PHYSMAP_COMPAT | ||
258 | #endif | ||
259 | #endif | ||
260 | |||
261 | #ifdef PHYSMAP_COMPAT | ||
262 | static struct physmap_flash_data physmap_flash_data = { | 260 | static struct physmap_flash_data physmap_flash_data = { |
263 | .width = CONFIG_MTD_PHYSMAP_BANKWIDTH, | 261 | .width = CONFIG_MTD_PHYSMAP_BANKWIDTH, |
264 | }; | 262 | }; |
@@ -302,7 +300,7 @@ static int __init physmap_init(void) | |||
302 | int err; | 300 | int err; |
303 | 301 | ||
304 | err = platform_driver_register(&physmap_flash_driver); | 302 | err = platform_driver_register(&physmap_flash_driver); |
305 | #ifdef PHYSMAP_COMPAT | 303 | #ifdef CONFIG_MTD_PHYSMAP_COMPAT |
306 | if (err == 0) | 304 | if (err == 0) |
307 | platform_device_register(&physmap_flash); | 305 | platform_device_register(&physmap_flash); |
308 | #endif | 306 | #endif |
@@ -312,7 +310,7 @@ static int __init physmap_init(void) | |||
312 | 310 | ||
313 | static void __exit physmap_exit(void) | 311 | static void __exit physmap_exit(void) |
314 | { | 312 | { |
315 | #ifdef PHYSMAP_COMPAT | 313 | #ifdef CONFIG_MTD_PHYSMAP_COMPAT |
316 | platform_device_unregister(&physmap_flash); | 314 | platform_device_unregister(&physmap_flash); |
317 | #endif | 315 | #endif |
318 | platform_driver_unregister(&physmap_flash_driver); | 316 | platform_driver_unregister(&physmap_flash_driver); |
@@ -326,8 +324,7 @@ MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); | |||
326 | MODULE_DESCRIPTION("Generic configurable MTD map driver"); | 324 | MODULE_DESCRIPTION("Generic configurable MTD map driver"); |
327 | 325 | ||
328 | /* legacy platform drivers can't hotplug or coldplg */ | 326 | /* legacy platform drivers can't hotplug or coldplg */ |
329 | #ifndef PHYSMAP_COMPAT | 327 | #ifndef CONFIG_MTD_PHYSMAP_COMPAT |
330 | /* work with hotplug and coldplug */ | 328 | /* work with hotplug and coldplug */ |
331 | MODULE_ALIAS("platform:physmap-flash"); | 329 | MODULE_ALIAS("platform:physmap-flash"); |
332 | #endif | 330 | #endif |
333 | |||