summaryrefslogtreecommitdiff
path: root/kernel/power
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2021-09-14 19:23:28 -0700
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-09-15 14:04:04 +0200
commitbfcc1e67ff1e4aa8bfe2ca57f99390fc284c799d (patch)
treec0d4ed0fb9e79751880f9b182a329581f235284b /kernel/power
parent6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f (diff)
PM: sleep: Do not assume that "mem" is always present
An implementation of suspend_ops is allowed to reject the PM_SUSPEND_MEM suspend type from its ->valid() callback, we should not assume that it is always present as this is not a correct reflection of what a firmware interface may support. Fixes: 406e79385f32 ("PM / sleep: System sleep state selection interface rework") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/suspend.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index eb75f394a059..02e306ad8db8 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -171,8 +171,7 @@ static bool valid_state(suspend_state_t state)
void __init pm_states_init(void)
{
- /* "mem" and "freeze" are always present in /sys/power/state. */
- pm_states[PM_SUSPEND_MEM] = pm_labels[PM_SUSPEND_MEM];
+ /* "freeze" is always present in /sys/power/state. */
pm_states[PM_SUSPEND_TO_IDLE] = pm_labels[PM_SUSPEND_TO_IDLE];
/*
* Suspend-to-idle should be supported even without any suspend_ops,
@@ -214,6 +213,7 @@ void suspend_set_ops(const struct platform_suspend_ops *ops)
}
if (valid_state(PM_SUSPEND_MEM)) {
mem_sleep_states[PM_SUSPEND_MEM] = mem_sleep_labels[PM_SUSPEND_MEM];
+ pm_states[PM_SUSPEND_MEM] = pm_labels[PM_SUSPEND_MEM];
if (mem_sleep_default >= PM_SUSPEND_MEM)
mem_sleep_current = PM_SUSPEND_MEM;
}