Driver core: platform_driver_probe(), can save codespace
This defines a new platform_driver_probe() method allowing the driver's probe() method, and its support code+data, to safely live in __init sections for typical system configurations. Many system-on-chip processors could benefit from this API, to the tune of recovering hundreds to thousands of bytes per driver. That's memory which is currently wasted holding code which can never be called after system startup, yet can not be removed. It can't be removed because of the linkage requirement that pointers to init section code (like, ideally, probe support) must not live in other sections (like driver method tables) after those pointers would be invalid. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
acf02d23b9
commit
c67334fbdf
@@ -58,6 +58,12 @@ struct platform_driver {
|
||||
extern int platform_driver_register(struct platform_driver *);
|
||||
extern void platform_driver_unregister(struct platform_driver *);
|
||||
|
||||
/* non-hotpluggable platform devices may use this so that probe() and
|
||||
* its support may live in __init sections, conserving runtime memory.
|
||||
*/
|
||||
extern int platform_driver_probe(struct platform_driver *driver,
|
||||
int (*probe)(struct platform_device *));
|
||||
|
||||
#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev)
|
||||
#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data))
|
||||
|
||||
|
Reference in New Issue
Block a user