Merge branch 'pm-sleep'

Merge fixes related to system sleep for 6.14-rc1:

 - Add missing error handling for syscore_suspend() to the hibernation
   core code (Wentao Liang).

 - Revert a commit that added unused macros (Andy Shevchenko).

 - Synchronize the runtime PM status of devices that were runtime-
   suspended before a system-wide suspend and need to be resumed during
   the subsequent syste-wide resume transition (Rafael Wysocki).

* pm-sleep:
  PM: sleep: core: Synchronize runtime PM status of parents and children
  PM: Revert "Add EXPORT macros for exporting PM functions"
  PM: hibernate: Add error handling for syscore_suspend()
This commit is contained in:
Rafael J. Wysocki
2025-01-30 21:28:16 +01:00
3 changed files with 27 additions and 14 deletions
+20 -9
View File
@@ -656,13 +656,15 @@ static void device_resume_noirq(struct device *dev, pm_message_t state, bool asy
* so change its status accordingly.
*
* Otherwise, the device is going to be resumed, so set its PM-runtime
* status to "active", but do that only if DPM_FLAG_SMART_SUSPEND is set
* to avoid confusing drivers that don't use it.
* status to "active" unless its power.set_active flag is clear, in
* which case it is not necessary to update its PM-runtime status.
*/
if (skip_resume)
if (skip_resume) {
pm_runtime_set_suspended(dev);
else if (dev_pm_skip_suspend(dev))
} else if (dev->power.set_active) {
pm_runtime_set_active(dev);
dev->power.set_active = false;
}
if (dev->pm_domain) {
info = "noirq power domain ";
@@ -1189,18 +1191,24 @@ static pm_message_t resume_event(pm_message_t sleep_state)
return PMSG_ON;
}
static void dpm_superior_set_must_resume(struct device *dev)
static void dpm_superior_set_must_resume(struct device *dev, bool set_active)
{
struct device_link *link;
int idx;
if (dev->parent)
if (dev->parent) {
dev->parent->power.must_resume = true;
if (set_active)
dev->parent->power.set_active = true;
}
idx = device_links_read_lock();
list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node)
list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node) {
link->supplier->power.must_resume = true;
if (set_active)
link->supplier->power.set_active = true;
}
device_links_read_unlock(idx);
}
@@ -1278,8 +1286,11 @@ Skip:
dev->power.may_skip_resume))
dev->power.must_resume = true;
if (dev->power.must_resume)
dpm_superior_set_must_resume(dev);
if (dev->power.must_resume) {
dev->power.set_active = dev->power.set_active ||
dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND);
dpm_superior_set_must_resume(dev, dev->power.set_active);
}
Complete:
complete_all(&dev->power.completion);
+1 -4
View File
@@ -384,12 +384,8 @@ const struct dev_pm_ops name = { \
#ifdef CONFIG_PM
#define _EXPORT_DEV_PM_OPS(name, license, ns) _EXPORT_PM_OPS(name, license, ns)
#define EXPORT_PM_FN_GPL(name) EXPORT_SYMBOL_GPL(name)
#define EXPORT_PM_FN_NS_GPL(name, ns) EXPORT_SYMBOL_NS_GPL(name, "ns")
#else
#define _EXPORT_DEV_PM_OPS(name, license, ns) _DISCARD_PM_OPS(name, license, ns)
#define EXPORT_PM_FN_GPL(name)
#define EXPORT_PM_FN_NS_GPL(name, ns)
#endif
#ifdef CONFIG_PM_SLEEP
@@ -683,6 +679,7 @@ struct dev_pm_info {
bool no_pm_callbacks:1; /* Owned by the PM core */
bool async_in_progress:1; /* Owned by the PM core */
bool must_resume:1; /* Owned by the PM core */
bool set_active:1; /* Owned by the PM core */
bool may_skip_resume:1; /* Set by subsystems */
#else
bool should_wakeup:1;
+6 -1
View File
@@ -608,7 +608,11 @@ int hibernation_platform_enter(void)
local_irq_disable();
system_state = SYSTEM_SUSPEND;
syscore_suspend();
error = syscore_suspend();
if (error)
goto Enable_irqs;
if (pm_wakeup_pending()) {
error = -EAGAIN;
goto Power_up;
@@ -620,6 +624,7 @@ int hibernation_platform_enter(void)
Power_up:
syscore_resume();
Enable_irqs:
system_state = SYSTEM_RUNNING;
local_irq_enable();