Skip to content

Commit a01e0f4

Browse files
committed
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()
2 parents 14ee7df + 3775fc5 commit a01e0f4

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

drivers/base/power/main.c

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -656,13 +656,15 @@ static void device_resume_noirq(struct device *dev, pm_message_t state, bool asy
656656
* so change its status accordingly.
657657
*
658658
* Otherwise, the device is going to be resumed, so set its PM-runtime
659-
* status to "active", but do that only if DPM_FLAG_SMART_SUSPEND is set
660-
* to avoid confusing drivers that don't use it.
659+
* status to "active" unless its power.set_active flag is clear, in
660+
* which case it is not necessary to update its PM-runtime status.
661661
*/
662-
if (skip_resume)
662+
if (skip_resume) {
663663
pm_runtime_set_suspended(dev);
664-
else if (dev_pm_skip_suspend(dev))
664+
} else if (dev->power.set_active) {
665665
pm_runtime_set_active(dev);
666+
dev->power.set_active = false;
667+
}
666668

667669
if (dev->pm_domain) {
668670
info = "noirq power domain ";
@@ -1189,18 +1191,24 @@ static pm_message_t resume_event(pm_message_t sleep_state)
11891191
return PMSG_ON;
11901192
}
11911193

1192-
static void dpm_superior_set_must_resume(struct device *dev)
1194+
static void dpm_superior_set_must_resume(struct device *dev, bool set_active)
11931195
{
11941196
struct device_link *link;
11951197
int idx;
11961198

1197-
if (dev->parent)
1199+
if (dev->parent) {
11981200
dev->parent->power.must_resume = true;
1201+
if (set_active)
1202+
dev->parent->power.set_active = true;
1203+
}
11991204

12001205
idx = device_links_read_lock();
12011206

1202-
list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node)
1207+
list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node) {
12031208
link->supplier->power.must_resume = true;
1209+
if (set_active)
1210+
link->supplier->power.set_active = true;
1211+
}
12041212

12051213
device_links_read_unlock(idx);
12061214
}
@@ -1278,8 +1286,11 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state, bool asy
12781286
dev->power.may_skip_resume))
12791287
dev->power.must_resume = true;
12801288

1281-
if (dev->power.must_resume)
1282-
dpm_superior_set_must_resume(dev);
1289+
if (dev->power.must_resume) {
1290+
dev->power.set_active = dev->power.set_active ||
1291+
dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND);
1292+
dpm_superior_set_must_resume(dev, dev->power.set_active);
1293+
}
12831294

12841295
Complete:
12851296
complete_all(&dev->power.completion);

include/linux/pm.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,8 @@ const struct dev_pm_ops name = { \
384384

385385
#ifdef CONFIG_PM
386386
#define _EXPORT_DEV_PM_OPS(name, license, ns) _EXPORT_PM_OPS(name, license, ns)
387-
#define EXPORT_PM_FN_GPL(name) EXPORT_SYMBOL_GPL(name)
388-
#define EXPORT_PM_FN_NS_GPL(name, ns) EXPORT_SYMBOL_NS_GPL(name, "ns")
389387
#else
390388
#define _EXPORT_DEV_PM_OPS(name, license, ns) _DISCARD_PM_OPS(name, license, ns)
391-
#define EXPORT_PM_FN_GPL(name)
392-
#define EXPORT_PM_FN_NS_GPL(name, ns)
393389
#endif
394390

395391
#ifdef CONFIG_PM_SLEEP
@@ -683,6 +679,7 @@ struct dev_pm_info {
683679
bool no_pm_callbacks:1; /* Owned by the PM core */
684680
bool async_in_progress:1; /* Owned by the PM core */
685681
bool must_resume:1; /* Owned by the PM core */
682+
bool set_active:1; /* Owned by the PM core */
686683
bool may_skip_resume:1; /* Set by subsystems */
687684
#else
688685
bool should_wakeup:1;

kernel/power/hibernate.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,11 @@ int hibernation_platform_enter(void)
608608

609609
local_irq_disable();
610610
system_state = SYSTEM_SUSPEND;
611-
syscore_suspend();
611+
612+
error = syscore_suspend();
613+
if (error)
614+
goto Enable_irqs;
615+
612616
if (pm_wakeup_pending()) {
613617
error = -EAGAIN;
614618
goto Power_up;
@@ -620,6 +624,7 @@ int hibernation_platform_enter(void)
620624

621625
Power_up:
622626
syscore_resume();
627+
Enable_irqs:
623628
system_state = SYSTEM_RUNNING;
624629
local_irq_enable();
625630

0 commit comments

Comments
 (0)