提交 58456488 编写于 作者: V Vincent Guittot 提交者: Rafael J. Wysocki

PM-runtime: update accounting_timestamp on enable

Initializing accounting_timestamp to something different from 0 during
pm_runtime_init() doesn't make sense and puts an artificial ordering
constraint between timekeeping_init() and pm_runtime_init().

PM-runtime should start time accounting only when it is enabled and
discard the period when disabled.

Set accounting_timestamp to now when enabling PM-runtime.
Suggested-by: N"Rafael J. Wysocki" <rjw@rjwysocki.net>
Signed-off-by: NVincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
[ rjw: Subject & changelog ]
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 40619f7d
......@@ -1309,10 +1309,15 @@ void pm_runtime_enable(struct device *dev)
spin_lock_irqsave(&dev->power.lock, flags);
if (dev->power.disable_depth > 0)
if (dev->power.disable_depth > 0) {
dev->power.disable_depth--;
else
/* About to enable runtime pm, set accounting_timestamp to now */
if (!dev->power.disable_depth)
dev->power.accounting_timestamp = jiffies;
} else {
dev_warn(dev, "Unbalanced %s!\n", __func__);
}
WARN(!dev->power.disable_depth &&
dev->power.runtime_status == RPM_SUSPENDED &&
......@@ -1509,7 +1514,7 @@ void pm_runtime_init(struct device *dev)
dev->power.request_pending = false;
dev->power.request = RPM_REQ_NONE;
dev->power.deferred_resume = false;
dev->power.accounting_timestamp = jiffies;
dev->power.accounting_timestamp = 0;
INIT_WORK(&dev->power.work, pm_runtime_work);
dev->power.timer_expires = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册