linux/drivers/base/power
Sakari Ailus a55d55a307 PM: runtime: Add pm_runtime_get_if_active()
[ Upstream commit c111566bea ]

pm_runtime_get_if_in_use() bumps up the PM-runtime usage count if it
is not equal to zero and the device's PM-runtime status is 'active'.
This works for drivers that do not use autoidle, but for those that
do, the function returns zero even when the device is active.

In order to maintain sane device state while the device is powered on
in the hope that it'll be needed, pm_runtime_get_if_active(dev, true)
returns a positive value if the device's PM-runtime status is 'active'
when it is called, in which case it also increments the device's usage
count.

If the second argument of pm_runtime_get_if_active() is 'false', the
function behaves just like pm_runtime_get_if_in_use(), so redefine
the latter as a wrapper around the former.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: 81302b1c7c ("ALSA: hda: Fix unhandled register update during auto-suspend period")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-08-30 16:27:12 +02:00
..
clock_ops.c PM / clk: Remove error message on out-of-memory condition 2019-05-28 19:40:21 +02:00
common.c drivers: base: power: add proper SPDX identifiers on files that did not have them. 2019-04-04 20:03:40 +02:00
domain_governor.c PM: domains: Fix up terminology with parent/child 2023-05-17 11:35:47 +02:00
domain.c PM: domains: fix integer overflow issues in genpd_parse_state() 2023-07-27 08:37:06 +02:00
generic_ops.c drivers: base: power: add proper SPDX identifiers on files that did not have them. 2019-04-04 20:03:40 +02:00
main.c PM: core: keep irq flags in device_pm_check_callbacks() 2022-04-15 14:18:23 +02:00
Makefile PM / wakeup: Show wakeup sources stats in sysfs 2019-08-21 00:20:40 +02:00
power.h PM: sleep: wakeirq: fix wake irq arming 2023-08-11 11:54:00 +02:00
qos.c PM: QoS: Drop frequency QoS types from device PM QoS 2019-10-21 02:05:21 +02:00
runtime.c PM: runtime: Add pm_runtime_get_if_active() 2023-08-30 16:27:12 +02:00
sysfs.c drivers core: Use sysfs_emit and sysfs_emit_at for show(device *...) functions 2022-01-16 09:15:38 +01:00
trace.c PM: base: power: don't try to use non-existing RTC for storing data 2021-09-22 12:26:39 +02:00
wakeirq.c PM: sleep: wakeirq: fix wake irq arming 2023-08-11 11:54:00 +02:00
wakeup_stats.c drivers core: Use sysfs_emit and sysfs_emit_at for show(device *...) functions 2022-01-16 09:15:38 +01:00
wakeup.c PM: s2idle: ACPI: Fix wakeup interrupts handling 2022-02-16 12:52:50 +01:00