summaryrefslogtreecommitdiffstats
path: root/kernel/power/suspend_test.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-15 22:02:11 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-21 13:41:33 +0200
commitd431cbc53cb787a7f82d7d2fe0af65156db4d27a (patch)
treed97b5744f4eae1bfa41ab2cc16820173ffc3aef2 /kernel/power/suspend_test.c
parent9a3c4145af32125c5ee39c0272662b47307a8323 (diff)
downloadtalos-obmc-linux-d431cbc53cb787a7f82d7d2fe0af65156db4d27a.tar.gz
talos-obmc-linux-d431cbc53cb787a7f82d7d2fe0af65156db4d27a.zip
PM / sleep: Simplify sleep states sysfs interface code
Simplify the sleep states sysfs interface /sys/power/state code by redefining pm_states[] as an array of pointers to constant strings such that only the entries corresponding to valid states are set. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/power/suspend_test.c')
-rw-r--r--kernel/power/suspend_test.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c
index 269b097e78ea..2f524928b6aa 100644
--- a/kernel/power/suspend_test.c
+++ b/kernel/power/suspend_test.c
@@ -92,13 +92,13 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)
}
if (state == PM_SUSPEND_MEM) {
- printk(info_test, pm_states[state].label);
+ printk(info_test, pm_states[state]);
status = pm_suspend(state);
if (status == -ENODEV)
state = PM_SUSPEND_STANDBY;
}
if (state == PM_SUSPEND_STANDBY) {
- printk(info_test, pm_states[state].label);
+ printk(info_test, pm_states[state]);
status = pm_suspend(state);
}
if (status < 0)
@@ -141,8 +141,8 @@ static int __init setup_test_suspend(char *value)
/* "=mem" ==> "mem" */
value++;
for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++)
- if (!strcmp(pm_states[i].label, value)) {
- test_state = pm_states[i].state;
+ if (!strcmp(pm_states[i], value)) {
+ test_state = i;
return 0;
}
@@ -162,8 +162,8 @@ static int __init test_suspend(void)
/* PM is initialized by now; is that state testable? */
if (test_state == PM_SUSPEND_ON)
goto done;
- if (!pm_states[test_state].state) {
- printk(warn_bad_state, pm_states[test_state].label);
+ if (!pm_states[test_state]) {
+ printk(warn_bad_state, pm_states[test_state]);
goto done;
}
OpenPOWER on IntegriCloud