mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
Merge branches 'pm-apm' and 'pm-sleep'
* pm-apm: x86, apm: Remove unused variable * pm-sleep: PM / sleep: Move platform suspend operations to separate functions PM / sleep: Simplify sleep states sysfs interface code
This commit is contained in:
commit
bb1c095f73
4 changed files with 108 additions and 84 deletions
|
@ -296,8 +296,8 @@ static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
|
|||
suspend_state_t i;
|
||||
|
||||
for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++)
|
||||
if (pm_states[i].state)
|
||||
s += sprintf(s,"%s ", pm_states[i].label);
|
||||
if (pm_states[i])
|
||||
s += sprintf(s,"%s ", pm_states[i]);
|
||||
|
||||
#endif
|
||||
if (hibernation_available())
|
||||
|
@ -311,8 +311,7 @@ static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
|
|||
static suspend_state_t decode_state(const char *buf, size_t n)
|
||||
{
|
||||
#ifdef CONFIG_SUSPEND
|
||||
suspend_state_t state = PM_SUSPEND_MIN;
|
||||
struct pm_sleep_state *s;
|
||||
suspend_state_t state;
|
||||
#endif
|
||||
char *p;
|
||||
int len;
|
||||
|
@ -325,10 +324,12 @@ static suspend_state_t decode_state(const char *buf, size_t n)
|
|||
return PM_SUSPEND_MAX;
|
||||
|
||||
#ifdef CONFIG_SUSPEND
|
||||
for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++)
|
||||
if (s->state && len == strlen(s->label)
|
||||
&& !strncmp(buf, s->label, len))
|
||||
return s->state;
|
||||
for (state = PM_SUSPEND_MIN; state < PM_SUSPEND_MAX; state++) {
|
||||
const char *label = pm_states[state];
|
||||
|
||||
if (label && len == strlen(label) && !strncmp(buf, label, len))
|
||||
return state;
|
||||
}
|
||||
#endif
|
||||
|
||||
return PM_SUSPEND_ON;
|
||||
|
@ -446,8 +447,8 @@ static ssize_t autosleep_show(struct kobject *kobj,
|
|||
|
||||
#ifdef CONFIG_SUSPEND
|
||||
if (state < PM_SUSPEND_MAX)
|
||||
return sprintf(buf, "%s\n", pm_states[state].state ?
|
||||
pm_states[state].label : "error");
|
||||
return sprintf(buf, "%s\n", pm_states[state] ?
|
||||
pm_states[state] : "error");
|
||||
#endif
|
||||
#ifdef CONFIG_HIBERNATION
|
||||
return sprintf(buf, "disk\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue