aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>2010-12-14 15:09:40 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2011-01-06 10:18:16 -0500
commit7e95d1f1714cb993bc5b7e3a3d532b715b32d80a (patch)
tree7ba9a6221620274da2b871b07cef891d0e916e32 /drivers/mtd
parent75c52a49630a478ffe9c1473441779676817fce6 (diff)
mtd: nand: ams-delta: convert to platform driver
In its current form, the driver may interfere with different hardware on different boards if built into the kernel, hence is not suitable for inclusion into a defconfig, inteded to be usable with multiple OMAP1 cpu and machine types. Convert it to a platform driver, that should be free from this issue. Created and tested against linux-2.6.37-rc5 on Amstrad Delta. Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/ams-delta.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 2548e1065bf8..7d49f6a6b726 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -4,6 +4,7 @@
4 * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li> 4 * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li>
5 * 5 *
6 * Derived from drivers/mtd/toto.c 6 * Derived from drivers/mtd/toto.c
7 * Converted to platform driver by Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -151,7 +152,7 @@ static int ams_delta_nand_ready(struct mtd_info *mtd)
151/* 152/*
152 * Main initialization routine 153 * Main initialization routine
153 */ 154 */
154static int __init ams_delta_init(void) 155static int __devinit ams_delta_init(struct platform_device *pdev)
155{ 156{
156 struct nand_chip *this; 157 struct nand_chip *this;
157 int err = 0; 158 int err = 0;
@@ -219,20 +220,40 @@ static int __init ams_delta_init(void)
219 return err; 220 return err;
220} 221}
221 222
222module_init(ams_delta_init);
223
224/* 223/*
225 * Clean up routine 224 * Clean up routine
226 */ 225 */
227static void __exit ams_delta_cleanup(void) 226static int __devexit ams_delta_cleanup(struct platform_device *pdev)
228{ 227{
229 /* Release resources, unregister device */ 228 /* Release resources, unregister device */
230 nand_release(ams_delta_mtd); 229 nand_release(ams_delta_mtd);
231 230
232 /* Free the MTD device structure */ 231 /* Free the MTD device structure */
233 kfree(ams_delta_mtd); 232 kfree(ams_delta_mtd);
233
234 return 0;
235}
236
237static struct platform_driver ams_delta_nand_driver = {
238 .probe = ams_delta_init,
239 .remove = __devexit_p(ams_delta_cleanup),
240 .driver = {
241 .name = "ams-delta-nand",
242 .owner = THIS_MODULE,
243 },
244};
245
246static int __init ams_delta_nand_init(void)
247{
248 return platform_driver_register(&ams_delta_nand_driver);
249}
250module_init(ams_delta_nand_init);
251
252static void __exit ams_delta_nand_exit(void)
253{
254 platform_driver_unregister(&ams_delta_nand_driver);
234} 255}
235module_exit(ams_delta_cleanup); 256module_exit(ams_delta_nand_exit);
236 257
237MODULE_LICENSE("GPL"); 258MODULE_LICENSE("GPL");
238MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>"); 259MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>");