diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-09-25 23:34:46 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2010-10-17 01:57:44 +0200 |
commit | 4769373ca2c8d0b999749a070c48fd8648888831 (patch) | |
tree | 62ec8eed1390d3fd9f9eb6cf979037ca316bf625 | |
parent | 69d44ffbd772bede8c2a6d182e6e14f94826520b (diff) | |
download | blackbird-op-linux-4769373ca2c8d0b999749a070c48fd8648888831.tar.gz blackbird-op-linux-4769373ca2c8d0b999749a070c48fd8648888831.zip |
PM / Runtime: Move code in drivers/base/power/runtime.c
This patch (as1421) moves the PM runtime accounting subroutines up to
the beginning of runtime.c, taking them out of the middle of the
functions that do the actual work. No operational changes.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r-- | drivers/base/power/runtime.c | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index e9520ad2d716..ec08f1ae63f1 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -15,6 +15,44 @@ static int __pm_request_idle(struct device *dev); static int __pm_request_resume(struct device *dev); /** + * update_pm_runtime_accounting - Update the time accounting of power states + * @dev: Device to update the accounting for + * + * In order to be able to have time accounting of the various power states + * (as used by programs such as PowerTOP to show the effectiveness of runtime + * PM), we need to track the time spent in each state. + * update_pm_runtime_accounting must be called each time before the + * runtime_status field is updated, to account the time in the old state + * correctly. + */ +void update_pm_runtime_accounting(struct device *dev) +{ + unsigned long now = jiffies; + int delta; + + delta = now - dev->power.accounting_timestamp; + + if (delta < 0) + delta = 0; + + dev->power.accounting_timestamp = now; + + if (dev->power.disable_depth > 0) + return; + + if (dev->power.runtime_status == RPM_SUSPENDED) + dev->power.suspended_jiffies += delta; + else + dev->power.active_jiffies += delta; +} + +static void __update_runtime_status(struct device *dev, enum rpm_status status) +{ + update_pm_runtime_accounting(dev); + dev->power.runtime_status = status; +} + +/** * pm_runtime_deactivate_timer - Deactivate given device's suspend timer. * @dev: Device to handle. */ @@ -123,45 +161,6 @@ int pm_runtime_idle(struct device *dev) } EXPORT_SYMBOL_GPL(pm_runtime_idle); - -/** - * update_pm_runtime_accounting - Update the time accounting of power states - * @dev: Device to update the accounting for - * - * In order to be able to have time accounting of the various power states - * (as used by programs such as PowerTOP to show the effectiveness of runtime - * PM), we need to track the time spent in each state. - * update_pm_runtime_accounting must be called each time before the - * runtime_status field is updated, to account the time in the old state - * correctly. - */ -void update_pm_runtime_accounting(struct device *dev) -{ - unsigned long now = jiffies; - int delta; - - delta = now - dev->power.accounting_timestamp; - - if (delta < 0) - delta = 0; - - dev->power.accounting_timestamp = now; - - if (dev->power.disable_depth > 0) - return; - - if (dev->power.runtime_status == RPM_SUSPENDED) - dev->power.suspended_jiffies += delta; - else - dev->power.active_jiffies += delta; -} - -static void __update_runtime_status(struct device *dev, enum rpm_status status) -{ - update_pm_runtime_accounting(dev); - dev->power.runtime_status = status; -} - /** * __pm_runtime_suspend - Carry out run-time suspend of given device. * @dev: Device to suspend. |