diff options
Diffstat (limited to 'drivers/mtd/maps/plat-ram.c')
-rw-r--r-- | drivers/mtd/maps/plat-ram.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index 76a76be5a7bd..9ca1eccba4bc 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c | |||
@@ -94,14 +94,11 @@ static int platram_remove(struct platform_device *pdev) | |||
94 | return 0; | 94 | return 0; |
95 | 95 | ||
96 | if (info->mtd) { | 96 | if (info->mtd) { |
97 | #ifdef CONFIG_MTD_PARTITIONS | 97 | mtd_device_unregister(info->mtd); |
98 | if (info->partitions) { | 98 | if (info->partitions) { |
99 | del_mtd_partitions(info->mtd); | ||
100 | if (info->free_partitions) | 99 | if (info->free_partitions) |
101 | kfree(info->partitions); | 100 | kfree(info->partitions); |
102 | } | 101 | } |
103 | #endif | ||
104 | del_mtd_device(info->mtd); | ||
105 | map_destroy(info->mtd); | 102 | map_destroy(info->mtd); |
106 | } | 103 | } |
107 | 104 | ||
@@ -231,7 +228,6 @@ static int platram_probe(struct platform_device *pdev) | |||
231 | /* check to see if there are any available partitions, or wether | 228 | /* check to see if there are any available partitions, or wether |
232 | * to add this device whole */ | 229 | * to add this device whole */ |
233 | 230 | ||
234 | #ifdef CONFIG_MTD_PARTITIONS | ||
235 | if (!pdata->nr_partitions) { | 231 | if (!pdata->nr_partitions) { |
236 | /* try to probe using the supplied probe type */ | 232 | /* try to probe using the supplied probe type */ |
237 | if (pdata->probes) { | 233 | if (pdata->probes) { |
@@ -239,24 +235,22 @@ static int platram_probe(struct platform_device *pdev) | |||
239 | &info->partitions, 0); | 235 | &info->partitions, 0); |
240 | info->free_partitions = 1; | 236 | info->free_partitions = 1; |
241 | if (err > 0) | 237 | if (err > 0) |
242 | err = add_mtd_partitions(info->mtd, | 238 | err = mtd_device_register(info->mtd, |
243 | info->partitions, err); | 239 | info->partitions, err); |
244 | } | 240 | } |
245 | } | 241 | } |
246 | /* use the static mapping */ | 242 | /* use the static mapping */ |
247 | else | 243 | else |
248 | err = add_mtd_partitions(info->mtd, pdata->partitions, | 244 | err = mtd_device_register(info->mtd, pdata->partitions, |
249 | pdata->nr_partitions); | 245 | pdata->nr_partitions); |
250 | #endif /* CONFIG_MTD_PARTITIONS */ | ||
251 | |||
252 | if (add_mtd_device(info->mtd)) { | ||
253 | dev_err(&pdev->dev, "add_mtd_device() failed\n"); | ||
254 | err = -ENOMEM; | ||
255 | } | ||
256 | |||
257 | if (!err) | 246 | if (!err) |
258 | dev_info(&pdev->dev, "registered mtd device\n"); | 247 | dev_info(&pdev->dev, "registered mtd device\n"); |
259 | 248 | ||
249 | /* add the whole device. */ | ||
250 | err = mtd_device_register(info->mtd, NULL, 0); | ||
251 | if (err) | ||
252 | dev_err(&pdev->dev, "failed to register the entire device\n"); | ||
253 | |||
260 | return err; | 254 | return err; |
261 | 255 | ||
262 | exit_free: | 256 | exit_free: |