diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-10-11 11:41:19 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-10-11 11:41:19 -0700 |
commit | 4af6600fd793023c01634cca5abfe4a2b707788f (patch) | |
tree | 9e3a830d7782512b492011932ddd789d13a900c4 /kernel/power/suspend_test.c | |
parent | 447a8b858e4bda41c394b1bc7fdbc9dc0bdf44f6 (diff) | |
parent | 68da166491655bc54051bf04c78ce648e2e33508 (diff) | |
download | op-kernel-dev-4af6600fd793023c01634cca5abfe4a2b707788f.zip op-kernel-dev-4af6600fd793023c01634cca5abfe4a2b707788f.tar.gz |
Merge branch 'next' into for-linus
Prepare second round of input updates for 3.18.
Diffstat (limited to 'kernel/power/suspend_test.c')
-rw-r--r-- | kernel/power/suspend_test.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c index 2f524928..bd91bc1 100644 --- a/kernel/power/suspend_test.c +++ b/kernel/power/suspend_test.c @@ -129,20 +129,20 @@ static int __init has_wakealarm(struct device *dev, const void *data) * at startup time. They're normally disabled, for faster boot and because * we can't know which states really work on this particular system. */ -static suspend_state_t test_state __initdata = PM_SUSPEND_ON; +static const char *test_state_label __initdata; static char warn_bad_state[] __initdata = KERN_WARNING "PM: can't test '%s' suspend state\n"; static int __init setup_test_suspend(char *value) { - suspend_state_t i; + int i; /* "=mem" ==> "mem" */ value++; - for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++) - if (!strcmp(pm_states[i], value)) { - test_state = i; + for (i = 0; pm_labels[i]; i++) + if (!strcmp(pm_labels[i], value)) { + test_state_label = pm_labels[i]; return 0; } @@ -158,13 +158,21 @@ static int __init test_suspend(void) struct rtc_device *rtc = NULL; struct device *dev; + suspend_state_t test_state; /* PM is initialized by now; is that state testable? */ - if (test_state == PM_SUSPEND_ON) - goto done; - if (!pm_states[test_state]) { - printk(warn_bad_state, pm_states[test_state]); - goto done; + if (!test_state_label) + return 0; + + for (test_state = PM_SUSPEND_MIN; test_state < PM_SUSPEND_MAX; test_state++) { + const char *state_label = pm_states[test_state]; + + if (state_label && !strcmp(test_state_label, state_label)) + break; + } + if (test_state == PM_SUSPEND_MAX) { + printk(warn_bad_state, test_state_label); + return 0; } /* RTCs have initialized by now too ... can we use one? */ @@ -173,13 +181,12 @@ static int __init test_suspend(void) rtc = rtc_class_open(dev_name(dev)); if (!rtc) { printk(warn_no_rtc); - goto done; + return 0; } /* go for it */ test_wakealarm(rtc, test_state); rtc_class_close(rtc); -done: return 0; } late_initcall(test_suspend); |