Commit f33dabbe authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by David Woodhouse

mtd: nand: register orion_nand using platform_driver_probe()

orion_nand_probe lives in .init.text, so using platform_driver_register to
register it is wrong because binding a device after the init memory is
discarded (e.g.  via sysfs) results in an oops.

As requested by Nicolas Pitre platform_driver_probe is used instead of
moving the probe function to .devinit.text as proposed initially.  This
saves some memory, but devices registered after the driver is probed are
not bound (probably there are none) and binding via sysfs isn't possible.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Lennert Buytenhek <buytenh@marvell.com>
Cc: Saeed Bishara <saeed@marvell.com>
Cc: Joern Engel <joern@logfs.org>
Acked-by: default avatarNicolas Pitre <nico@marvell.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 2eaaa5ff
...@@ -171,7 +171,6 @@ static int __devexit orion_nand_remove(struct platform_device *pdev) ...@@ -171,7 +171,6 @@ static int __devexit orion_nand_remove(struct platform_device *pdev)
} }
static struct platform_driver orion_nand_driver = { static struct platform_driver orion_nand_driver = {
.probe = orion_nand_probe,
.remove = __devexit_p(orion_nand_remove), .remove = __devexit_p(orion_nand_remove),
.driver = { .driver = {
.name = "orion_nand", .name = "orion_nand",
...@@ -181,7 +180,7 @@ static struct platform_driver orion_nand_driver = { ...@@ -181,7 +180,7 @@ static struct platform_driver orion_nand_driver = {
static int __init orion_nand_init(void) static int __init orion_nand_init(void)
{ {
return platform_driver_register(&orion_nand_driver); return platform_driver_probe(&orion_nand_driver, orion_nand_probe);
} }
static void __exit orion_nand_exit(void) static void __exit orion_nand_exit(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment