mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
device_prepare() blocks runtime PM for a device with runtime PM disabled
before invoking its system-sleep ->prepare() callback. For a device that
has never enabled runtime PM, this changes dev->power.last_status from
RPM_INVALID to RPM_BLOCKED.
If the callback returns an error, dpm_prepare() does not move the device
to dpm_prepared_list. Consequently, the recovery path through
dpm_complete() never calls device_complete() for the failing device.
The error path drops the runtime PM usage reference, but does not clear
RPM_BLOCKED. A later legitimate pm_runtime_enable() then reports:
Attempt to enable runtime PM when it is blocked
before clearing the stale state.
Call pm_runtime_unblock() on the prepare error path before dropping the
runtime PM reference, matching the cleanup performed by device_complete().
The issue was reproduced with a platform test device whose ->prepare()
callback returns -EIO while runtime PM has never been enabled. Before
the fix, last_status remained RPM_BLOCKED after the failed suspend and
the first pm_runtime_enable() produced the warning above. With the fix,
last_status is restored to RPM_INVALID and the warning is absent.
Fixes:
|
||
|---|---|---|
| .. | ||
| clock_ops.c | ||
| common.c | ||
| generic_ops.c | ||
| main.c | ||
| Makefile | ||
| power.h | ||
| qos-test.c | ||
| qos.c | ||
| runtime-test.c | ||
| runtime.c | ||
| sysfs.c | ||
| trace.c | ||
| wakeirq.c | ||
| wakeup_stats.c | ||
| wakeup.c | ||