Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@pengutronix.de>
Cc: Lennert Buytenhek <buytenh@marvell.com>
Cc: Saeed Bishara <saeed@marvell.com>
Cc: Joern Engel <joern@logfs.org>
Acked-by: Nicolas Pitre <nico@marvell.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Uwe Kleine-König and committed by
David Woodhouse
f33dabbe 2eaaa5ff

+1 -2
+1 -2
drivers/mtd/nand/orion_nand.c
··· 171 171 } 172 172 173 173 static struct platform_driver orion_nand_driver = { 174 - .probe = orion_nand_probe, 175 174 .remove = __devexit_p(orion_nand_remove), 176 175 .driver = { 177 176 .name = "orion_nand", ··· 180 181 181 182 static int __init orion_nand_init(void) 182 183 { 183 - return platform_driver_register(&orion_nand_driver); 184 + return platform_driver_probe(&orion_nand_driver, orion_nand_probe); 184 185 } 185 186 186 187 static void __exit orion_nand_exit(void)