diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/power/suspend_test.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c index 379f36de348a..084452e34a12 100644 --- a/kernel/power/suspend_test.c +++ b/kernel/power/suspend_test.c | |||
| @@ -22,6 +22,8 @@ | |||
| 22 | #define TEST_SUSPEND_SECONDS 10 | 22 | #define TEST_SUSPEND_SECONDS 10 |
| 23 | 23 | ||
| 24 | static unsigned long suspend_test_start_time; | 24 | static unsigned long suspend_test_start_time; |
| 25 | static u32 test_repeat_count_max = 1; | ||
| 26 | static u32 test_repeat_count_current; | ||
| 25 | 27 | ||
| 26 | void suspend_test_start(void) | 28 | void suspend_test_start(void) |
| 27 | { | 29 | { |
| @@ -74,6 +76,7 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state) | |||
| 74 | int status; | 76 | int status; |
| 75 | 77 | ||
| 76 | /* this may fail if the RTC hasn't been initialized */ | 78 | /* this may fail if the RTC hasn't been initialized */ |
| 79 | repeat: | ||
| 77 | status = rtc_read_time(rtc, &alm.time); | 80 | status = rtc_read_time(rtc, &alm.time); |
| 78 | if (status < 0) { | 81 | if (status < 0) { |
| 79 | printk(err_readtime, dev_name(&rtc->dev), status); | 82 | printk(err_readtime, dev_name(&rtc->dev), status); |
| @@ -111,6 +114,10 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state) | |||
| 111 | if (status < 0) | 114 | if (status < 0) |
| 112 | printk(err_suspend, status); | 115 | printk(err_suspend, status); |
| 113 | 116 | ||
| 117 | test_repeat_count_current++; | ||
| 118 | if (test_repeat_count_current < test_repeat_count_max) | ||
| 119 | goto repeat; | ||
| 120 | |||
| 114 | /* Some platforms can't detect that the alarm triggered the | 121 | /* Some platforms can't detect that the alarm triggered the |
| 115 | * wakeup, or (accordingly) disable it after it afterwards. | 122 | * wakeup, or (accordingly) disable it after it afterwards. |
| 116 | * It's supposed to give oneshot behavior; cope. | 123 | * It's supposed to give oneshot behavior; cope. |
| @@ -144,16 +151,28 @@ static char warn_bad_state[] __initdata = | |||
| 144 | static int __init setup_test_suspend(char *value) | 151 | static int __init setup_test_suspend(char *value) |
| 145 | { | 152 | { |
| 146 | int i; | 153 | int i; |
| 154 | char *repeat; | ||
| 155 | char *suspend_type; | ||
| 147 | 156 | ||
| 148 | /* "=mem" ==> "mem" */ | 157 | /* example : "=mem[,N]" ==> "mem[,N]" */ |
| 149 | value++; | 158 | value++; |
| 159 | suspend_type = strsep(&value, ","); | ||
| 160 | if (!suspend_type) | ||
| 161 | return 0; | ||
| 162 | |||
| 163 | repeat = strsep(&value, ","); | ||
| 164 | if (repeat) { | ||
| 165 | if (kstrtou32(repeat, 0, &test_repeat_count_max)) | ||
| 166 | return 0; | ||
| 167 | } | ||
| 168 | |||
| 150 | for (i = 0; pm_labels[i]; i++) | 169 | for (i = 0; pm_labels[i]; i++) |
| 151 | if (!strcmp(pm_labels[i], value)) { | 170 | if (!strcmp(pm_labels[i], suspend_type)) { |
| 152 | test_state_label = pm_labels[i]; | 171 | test_state_label = pm_labels[i]; |
| 153 | return 0; | 172 | return 0; |
| 154 | } | 173 | } |
| 155 | 174 | ||
| 156 | printk(warn_bad_state, value); | 175 | printk(warn_bad_state, suspend_type); |
| 157 | return 0; | 176 | return 0; |
| 158 | } | 177 | } |
| 159 | __setup("test_suspend", setup_test_suspend); | 178 | __setup("test_suspend", setup_test_suspend); |
