|
22 | 22 | #define TEST_SUSPEND_SECONDS 10
|
23 | 23 |
|
24 | 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 | 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 | 76 | int status;
|
75 | 77 |
|
76 | 78 | /* this may fail if the RTC hasn't been initialized */
|
| 79 | +repeat: |
77 | 80 | status = rtc_read_time(rtc, &alm.time);
|
78 | 81 | if (status < 0) {
|
79 | 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 | 114 | if (status < 0)
|
112 | 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 | 121 | /* Some platforms can't detect that the alarm triggered the
|
115 | 122 | * wakeup, or (accordingly) disable it after it afterwards.
|
116 | 123 | * It's supposed to give oneshot behavior; cope.
|
@@ -144,16 +151,28 @@ static char warn_bad_state[] __initdata =
|
144 | 151 | static int __init setup_test_suspend(char *value)
|
145 | 152 | {
|
146 | 153 | int i;
|
| 154 | + char *repeat; |
| 155 | + char *suspend_type; |
147 | 156 |
|
148 |
| - /* "=mem" ==> "mem" */ |
| 157 | + /* example : "=mem[,N]" ==> "mem[,N]" */ |
149 | 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 | 169 | for (i = 0; pm_labels[i]; i++)
|
151 |
| - if (!strcmp(pm_labels[i], value)) { |
| 170 | + if (!strcmp(pm_labels[i], suspend_type)) { |
152 | 171 | test_state_label = pm_labels[i];
|
153 | 172 | return 0;
|
154 | 173 | }
|
155 | 174 |
|
156 |
| - printk(warn_bad_state, value); |
| 175 | + printk(warn_bad_state, suspend_type); |
157 | 176 | return 0;
|
158 | 177 | }
|
159 | 178 | __setup("test_suspend", setup_test_suspend);
|
|
0 commit comments