aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-10-29 10:57:20 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-10-29 10:57:20 -0400
commit0d2ef7d73e0b5173af3940139569bebd2375f441 (patch)
treece48e0c9dd216c1c32084c233842918507ee330e /drivers/mtd/maps
parent57725f0a94435355214977bb9b0e5089bba1b173 (diff)
[ARM] Add support for init/exit methods in sa1100 MTD map driver
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/sa1100-flash.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 1920bcbc05d7..50a1d434906a 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -223,7 +223,7 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r
223 return ret; 223 return ret;
224} 224}
225 225
226static void sa1100_destroy(struct sa_info *info) 226static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *plat)
227{ 227{
228 int i; 228 int i;
229 229
@@ -242,6 +242,9 @@ static void sa1100_destroy(struct sa_info *info)
242 for (i = info->num_subdev - 1; i >= 0; i--) 242 for (i = info->num_subdev - 1; i >= 0; i--)
243 sa1100_destroy_subdev(&info->subdev[i]); 243 sa1100_destroy_subdev(&info->subdev[i]);
244 kfree(info); 244 kfree(info);
245
246 if (plat->exit)
247 plat->exit();
245} 248}
246 249
247static struct sa_info *__init 250static struct sa_info *__init
@@ -275,6 +278,12 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat)
275 278
276 memset(info, 0, size); 279 memset(info, 0, size);
277 280
281 if (plat->init) {
282 ret = plat->init();
283 if (ret)
284 goto err;
285 }
286
278 /* 287 /*
279 * Claim and then map the memory regions. 288 * Claim and then map the memory regions.
280 */ 289 */
@@ -336,7 +345,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat)
336 return info; 345 return info;
337 346
338 err: 347 err:
339 sa1100_destroy(info); 348 sa1100_destroy(info, plat);
340 out: 349 out:
341 return ERR_PTR(ret); 350 return ERR_PTR(ret);
342} 351}
@@ -397,8 +406,11 @@ static int __init sa1100_mtd_probe(struct device *dev)
397static int __exit sa1100_mtd_remove(struct device *dev) 406static int __exit sa1100_mtd_remove(struct device *dev)
398{ 407{
399 struct sa_info *info = dev_get_drvdata(dev); 408 struct sa_info *info = dev_get_drvdata(dev);
409 struct flash_platform_data *plat = dev->platform_data;
410
400 dev_set_drvdata(dev, NULL); 411 dev_set_drvdata(dev, NULL);
401 sa1100_destroy(info); 412 sa1100_destroy(info, plat);
413
402 return 0; 414 return 0;
403} 415}
404 416