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.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -171,8 +171,7 @@ static bool valid_state(suspend_state_t state) · 170 unmodified lines | ||
| 171 | 171 | |
| 172 | 172 | void __init pm_states_init(void) |
| 173 | 173 | { |
| 174 | − /* "mem" and "freeze" are always present in /sys/power/state. */ | |
| 175 | − pm_states[PM_SUSPEND_MEM] = pm_labels[PM_SUSPEND_MEM]; | |
| 174 | + /* "freeze" is always present in /sys/power/state. */ | |
| 176 | 175 | pm_states[PM_SUSPEND_TO_IDLE] = pm_labels[PM_SUSPEND_TO_IDLE]; |
| 177 | 176 | /* |
| 178 | 177 | * 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) · 35 unmodified lines | ||
| 214 | 213 | } |
| 215 | 214 | if (valid_state(PM_SUSPEND_MEM)) { |
| 216 | 215 | mem_sleep_states[PM_SUSPEND_MEM] = mem_sleep_labels[PM_SUSPEND_MEM]; |
| 216 | + pm_states[PM_SUSPEND_MEM] = pm_labels[PM_SUSPEND_MEM]; | |
| 217 | 217 | if (mem_sleep_default >= PM_SUSPEND_MEM) |
| 218 | 218 | mem_sleep_current = PM_SUSPEND_MEM; |
| 219 | 219 | } |