aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2014-10-28 12:40:41 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-06 18:16:02 -0500
commitc3b50dc219e1437e4dcb6a1639b004648dc29faa (patch)
treefe43f3dc0559b9a4c4f835c88504fa157fdf2869 /drivers/base
parent161d6981096f5700ff5a2618bc9337c157eb717a (diff)
core: platform: let platform_driver_probe initialize module owner
Since commit 9447057eaff8 ("platform_device: use a macro instead of platform_driver_register"), platform_driver_register() always overwrites the .owner field of a platform_driver with THIS_MODULE. This breaks platform_driver_probe() which uses it from within the platform core instead of the module init. Fix it by using a similar #define construct to obtain THIS_MODULE and pass it on later. Reported-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/platform.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index b2afc29403f9..c87a63326871 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -580,9 +580,10 @@ void platform_driver_unregister(struct platform_driver *drv)
580EXPORT_SYMBOL_GPL(platform_driver_unregister); 580EXPORT_SYMBOL_GPL(platform_driver_unregister);
581 581
582/** 582/**
583 * platform_driver_probe - register driver for non-hotpluggable device 583 * __platform_driver_probe - register driver for non-hotpluggable device
584 * @drv: platform driver structure 584 * @drv: platform driver structure
585 * @probe: the driver probe routine, probably from an __init section 585 * @probe: the driver probe routine, probably from an __init section
586 * @module: module which will be the owner of the driver
586 * 587 *
587 * Use this instead of platform_driver_register() when you know the device 588 * Use this instead of platform_driver_register() when you know the device
588 * is not hotpluggable and has already been registered, and you want to 589 * is not hotpluggable and has already been registered, and you want to
@@ -598,8 +599,8 @@ EXPORT_SYMBOL_GPL(platform_driver_unregister);
598 * Returns zero if the driver registered and bound to a device, else returns 599 * Returns zero if the driver registered and bound to a device, else returns
599 * a negative error code and with the driver not registered. 600 * a negative error code and with the driver not registered.
600 */ 601 */
601int __init_or_module platform_driver_probe(struct platform_driver *drv, 602int __init_or_module __platform_driver_probe(struct platform_driver *drv,
602 int (*probe)(struct platform_device *)) 603 int (*probe)(struct platform_device *), struct module *module)
603{ 604{
604 int retval, code; 605 int retval, code;
605 606
@@ -614,7 +615,7 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,
614 615
615 /* temporary section violation during probe() */ 616 /* temporary section violation during probe() */
616 drv->probe = probe; 617 drv->probe = probe;
617 retval = code = platform_driver_register(drv); 618 retval = code = __platform_driver_register(drv, module);
618 619
619 /* 620 /*
620 * Fixup that section violation, being paranoid about code scanning 621 * Fixup that section violation, being paranoid about code scanning
@@ -633,7 +634,7 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,
633 platform_driver_unregister(drv); 634 platform_driver_unregister(drv);
634 return retval; 635 return retval;
635} 636}
636EXPORT_SYMBOL_GPL(platform_driver_probe); 637EXPORT_SYMBOL_GPL(__platform_driver_probe);
637 638
638/** 639/**
639 * platform_create_bundle - register driver and create corresponding device 640 * platform_create_bundle - register driver and create corresponding device