diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-08-05 19:45:11 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-09-03 19:36:03 -0400 |
commit | bed2b42d9f0b411f384c5619870ab0fea5dd116b (patch) | |
tree | abdfe3a877b5751411ba10d6bf1a57040c56bf73 /drivers/base/platform.c | |
parent | e91c11b1a7f876c6f056d872eb210734150a1795 (diff) |
PM / Runtime: Allow helpers to be called by early platform drivers
Runtime PM helper functions, like pm_runtime_get_sync(), cannot be
called by early platform device drivers, because the devices' power
management locks are not initialized at that time. This is quite
inconvenient, so modify early_platform_add_devices() to initialize
the devices power management locks as appropriate and make sure that
they won't be initialized more than once if an early platform
device is going to be used as a regular one later.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r-- | drivers/base/platform.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index a1a722502587..d51514b79efe 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/pm_runtime.h> | 22 | #include <linux/pm_runtime.h> |
23 | 23 | ||
24 | #include "base.h" | 24 | #include "base.h" |
25 | #include "power/power.h" | ||
25 | 26 | ||
26 | #define to_platform_driver(drv) (container_of((drv), struct platform_driver, \ | 27 | #define to_platform_driver(drv) (container_of((drv), struct platform_driver, \ |
27 | driver)) | 28 | driver)) |
@@ -948,6 +949,7 @@ void __init early_platform_add_devices(struct platform_device **devs, int num) | |||
948 | dev = &devs[i]->dev; | 949 | dev = &devs[i]->dev; |
949 | 950 | ||
950 | if (!dev->devres_head.next) { | 951 | if (!dev->devres_head.next) { |
952 | pm_runtime_early_init(dev); | ||
951 | INIT_LIST_HEAD(&dev->devres_head); | 953 | INIT_LIST_HEAD(&dev->devres_head); |
952 | list_add_tail(&dev->devres_head, | 954 | list_add_tail(&dev->devres_head, |
953 | &early_platform_device_list); | 955 | &early_platform_device_list); |