PM / runtime: Add new helper for conditional usage count incrementation
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 17 Dec 2015 01:54:26 +0000 (02:54 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 21 Dec 2015 02:11:12 +0000 (03:11 +0100)
commita436b6a19f57656a6557439523923d89eb4a880d
tree62637a13b7721a775f8aa2af4554c9fc3069f595
parentd89d7ff9edf58cbf8ad0f490694b2edea8eb3a39
PM / runtime: Add new helper for conditional usage count incrementation

Introduce a new runtime PM function, pm_runtime_get_if_in_use(),
that will increment the device's runtime PM usage counter and
return 1 if its status is RPM_ACTIVE and its usage counter
is greater than 0 at the same time (0 will be returned otherwise).

This is useful for things that should only be done if the device
is active (from the runtime PM perspective) and used by somebody
(as indicated by the usage counter) already and they are not worth
bothering otherwise.

Requested-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Documentation/power/runtime_pm.txt
drivers/base/power/runtime.c
include/linux/pm_runtime.h