android_kernel_motorola_sm6375/drivers/base
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Rafael J. Wysocki 41b5a58878 PM: sleep: Fix handling devices with direct_complete set on errors
[ Upstream commit 03f1444016b71feffa1dfb8a51f15ba592f94b13 ]

When dpm_suspend() fails, some devices with power.direct_complete set
may not have been handled by device_suspend() yet, so runtime PM has
not been disabled for them yet even though power.direct_complete is set.

Since device_resume() expects that runtime PM has been disabled for all
devices with power.direct_complete set, it will attempt to reenable
runtime PM for the devices that have not been processed by device_suspend()
which does not make sense.  Had those devices had runtime PM disabled
before device_suspend() had run, device_resume() would have inadvertently
enable runtime PM for them, but this is not expected to happen because
it would require ->prepare() callbacks to return positive values for
devices with runtime PM disabled, which would be invalid.

In practice, this issue is most likely benign because pm_runtime_enable()
will not allow the "disable depth" counter to underflow, but it causes a
warning message to be printed for each affected device.

To allow device_resume() to distinguish the "direct complete" devices
that have been processed by device_suspend() from those which have not
been handled by it, make device_suspend() set power.is_suspended for
"direct complete" devices.

Next, move the power.is_suspended check in device_resume() before the
power.direct_complete check in it to make it skip the "direct complete"
devices that have not been handled by device_suspend().

This change is based on a preliminary patch from Saravana Kannan.

Fixes: aae4518b31 ("PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily")
Link: https://lore.kernel.org/linux-pm/20241114220921.2529905-2-saravanak@google.com/
Reported-by: Saravana Kannan <saravanak@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Saravana Kannan <saravanak@google.com>
Link: https://patch.msgid.link/12627587.O9o76ZdvQC@rjwysocki.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-04-10 14:29:40 +02:00
..
firmware_loader firmware_loader: Block path traversal 2024-11-08 16:20:33 +01:00
power PM: sleep: Fix handling devices with direct_complete set on errors 2025-04-10 14:29:40 +02:00
regmap regmap-irq: Add missing kfree() 2025-03-13 12:43:16 +01:00
test
arch_topology.c
attribute_container.c
base.h
bus.c driver core: bus: Fix double free in driver API bus_register() 2025-03-13 12:43:20 +01:00
cacheinfo.c
class.c
component.c
container.c
core.c Revert "driver core: Fix uevent_show() vs driver detach race" 2024-11-08 16:20:53 +01:00
cpu.c
dd.c driver core: Release all resources during unbind before updating device links 2023-12-08 08:44:22 +01:00
devcon.c
devcoredump.c devcoredump: Send uevent once devcd is ready 2023-12-13 18:18:18 +01:00
devres.c devres: Initialize an uninitialized struct member 2024-09-12 11:03:54 +02:00
devtmpfs.c
driver.c
firmware.c
hypervisor.c
init.c
isa.c
Kconfig
Makefile
map.c
memory.c
module.c Revert "driver core: Fix uevent_show() vs driver detach race" 2024-11-08 16:20:53 +01:00
node.c
pinctrl.c
platform-msi.c
platform.c
property.c
soc.c
swnode.c software node: Let args be NULL in software_node_get_reference_args 2024-01-25 14:34:31 -08:00
syscore.c
topology.c
transport_class.c