diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-10-29 15:57:20 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-10-29 15:57:20 +0100 |
commit | 0d2ef7d73e0b5173af3940139569bebd2375f441 (patch) | |
tree | ce48e0c9dd216c1c32084c233842918507ee330e /drivers/mtd/maps/sa1100-flash.c | |
parent | 57725f0a94435355214977bb9b0e5089bba1b173 (diff) | |
download | kernel_samsung_aries-0d2ef7d73e0b5173af3940139569bebd2375f441.zip kernel_samsung_aries-0d2ef7d73e0b5173af3940139569bebd2375f441.tar.gz kernel_samsung_aries-0d2ef7d73e0b5173af3940139569bebd2375f441.tar.bz2 |
[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/sa1100-flash.c')
-rw-r--r-- | drivers/mtd/maps/sa1100-flash.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index 1920bcb..50a1d43 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 return ret; } -static void sa1100_destroy(struct sa_info *info) +static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *plat) { int i; @@ -242,6 +242,9 @@ static void sa1100_destroy(struct sa_info *info) for (i = info->num_subdev - 1; i >= 0; i--) sa1100_destroy_subdev(&info->subdev[i]); kfree(info); + + if (plat->exit) + plat->exit(); } static struct sa_info *__init @@ -275,6 +278,12 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat) memset(info, 0, size); + if (plat->init) { + ret = plat->init(); + if (ret) + goto err; + } + /* * Claim and then map the memory regions. */ @@ -336,7 +345,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat) return info; err: - sa1100_destroy(info); + sa1100_destroy(info, plat); out: return ERR_PTR(ret); } @@ -397,8 +406,11 @@ static int __init sa1100_mtd_probe(struct device *dev) static int __exit sa1100_mtd_remove(struct device *dev) { struct sa_info *info = dev_get_drvdata(dev); + struct flash_platform_data *plat = dev->platform_data; + dev_set_drvdata(dev, NULL); - sa1100_destroy(info); + sa1100_destroy(info, plat); + return 0; } |