Messages in this thread | | | From | Kazuki <> | Date | Wed, 8 Feb 2023 23:52:03 +0900 | Subject | Re: s2idle breaks on machines without cpuidle support |
| |
Sent the wrong bit of code, sorry. Correct code is:
static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t n) { suspend_state_t state; int error;
error = pm_autosleep_lock(); if (error) return error;
if (pm_autosleep_state() > PM_SUSPEND_ON) { error = -EBUSY; goto out; }
state = decode_state(buf, n); if (state < PM_SUSPEND_MAX) { if (state == PM_SUSPEND_MEM) state = mem_sleep_current;
error = pm_suspend(state); } else if (state == PM_SUSPEND_MAX) { error = hibernate(); } else { error = -EINVAL; }
out: pm_autosleep_unlock(); return error ? error : n; }
power_attr(state);
| |