mtd: nand: register orion_nand using platform_driver_probe()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Sep 19 14:59:01 EDT 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=f33dabbe79fdf7a8568c65faa1db7794c87ac4d3
Commit:     f33dabbe79fdf7a8568c65faa1db7794c87ac4d3
Parent:     2eaaa5ff87c675aacd3a869fc5fe75a35bbd5278
Author:     Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
AuthorDate: Fri Sep 18 12:51:43 2009 -0700
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sat Sep 19 11:06:30 2009 -0700

    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: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
    Cc: Lennert Buytenhek <buytenh at marvell.com>
    Cc: Saeed Bishara <saeed at marvell.com>
    Cc: Joern Engel <joern at logfs.org>
    Acked-by: Nicolas Pitre <nico at marvell.com>
    Cc: Greg Kroah-Hartman <gregkh at suse.de>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/orion_nand.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index 0d9d4bc..f59c074 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -171,7 +171,6 @@ static int __devexit orion_nand_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver orion_nand_driver = {
-	.probe		= orion_nand_probe,
 	.remove		= __devexit_p(orion_nand_remove),
 	.driver		= {
 		.name	= "orion_nand",
@@ -181,7 +180,7 @@ static struct platform_driver orion_nand_driver = {
 
 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)



More information about the linux-mtd-cvs mailing list