Commit 2a14e541ed87bca0c125b82961ca3c6f808607d2
Committed by
H. Peter Anvin
1 parent
cbf2829b61
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
ACPI: Convert wake_sleep_flags to a value instead of function
With commit a2ef5c4fd44ce3922435139393b89f2cce47f576 "ACPI: Move module parameter gts and bfs to sleep.c" the wake_sleep_flags is required when calling acpi_enter_sleep_state, which means that if there are functions outside the sleep.c code they can't get the wake_sleep_flags values. This converts the function in to a exported value and converts the module config operands to a function. Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Lin Ming <ming.m.lin@intel.com> [v2: Parameters can be turned on/off dynamically] [v3: unsigned char -> u8] [v4: val -> kp->arg] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Link: http://lkml.kernel.org/r/1335150198-21899-2-git-send-email-konrad.wilk@oracle.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Showing 2 changed files with 30 additions and 24 deletions Side-by-side Diff
arch/x86/kernel/acpi/sleep.h
drivers/acpi/sleep.c
... | ... | @@ -28,23 +28,33 @@ |
28 | 28 | #include "internal.h" |
29 | 29 | #include "sleep.h" |
30 | 30 | |
31 | +u8 wake_sleep_flags = ACPI_NO_OPTIONAL_METHODS; | |
31 | 32 | static unsigned int gts, bfs; |
32 | -module_param(gts, uint, 0644); | |
33 | -module_param(bfs, uint, 0644); | |
34 | -MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | |
35 | -MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | |
36 | - | |
37 | -static u8 wake_sleep_flags(void) | |
33 | +static int set_param_wake_flag(const char *val, struct kernel_param *kp) | |
38 | 34 | { |
39 | - u8 flags = ACPI_NO_OPTIONAL_METHODS; | |
35 | + int ret = param_set_int(val, kp); | |
40 | 36 | |
41 | - if (gts) | |
42 | - flags |= ACPI_EXECUTE_GTS; | |
43 | - if (bfs) | |
44 | - flags |= ACPI_EXECUTE_BFS; | |
37 | + if (ret) | |
38 | + return ret; | |
45 | 39 | |
46 | - return flags; | |
40 | + if (kp->arg == (const char *)>s) { | |
41 | + if (gts) | |
42 | + wake_sleep_flags |= ACPI_EXECUTE_GTS; | |
43 | + else | |
44 | + wake_sleep_flags &= ~ACPI_EXECUTE_GTS; | |
45 | + } | |
46 | + if (kp->arg == (const char *)&bfs) { | |
47 | + if (bfs) | |
48 | + wake_sleep_flags |= ACPI_EXECUTE_BFS; | |
49 | + else | |
50 | + wake_sleep_flags &= ~ACPI_EXECUTE_BFS; | |
51 | + } | |
52 | + return ret; | |
47 | 53 | } |
54 | +module_param_call(gts, set_param_wake_flag, param_get_int, >s, 0644); | |
55 | +module_param_call(bfs, set_param_wake_flag, param_get_int, &bfs, 0644); | |
56 | +MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | |
57 | +MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | |
48 | 58 | |
49 | 59 | static u8 sleep_states[ACPI_S_STATE_COUNT]; |
50 | 60 | |
... | ... | @@ -263,7 +273,6 @@ |
263 | 273 | { |
264 | 274 | acpi_status status = AE_OK; |
265 | 275 | u32 acpi_state = acpi_target_sleep_state; |
266 | - u8 flags = wake_sleep_flags(); | |
267 | 276 | int error; |
268 | 277 | |
269 | 278 | ACPI_FLUSH_CPU_CACHE(); |
... | ... | @@ -271,7 +280,7 @@ |
271 | 280 | switch (acpi_state) { |
272 | 281 | case ACPI_STATE_S1: |
273 | 282 | barrier(); |
274 | - status = acpi_enter_sleep_state(acpi_state, flags); | |
283 | + status = acpi_enter_sleep_state(acpi_state, wake_sleep_flags); | |
275 | 284 | break; |
276 | 285 | |
277 | 286 | case ACPI_STATE_S3: |
... | ... | @@ -286,7 +295,7 @@ |
286 | 295 | acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); |
287 | 296 | |
288 | 297 | /* Reprogram control registers and execute _BFS */ |
289 | - acpi_leave_sleep_state_prep(acpi_state, flags); | |
298 | + acpi_leave_sleep_state_prep(acpi_state, wake_sleep_flags); | |
290 | 299 | |
291 | 300 | /* ACPI 3.0 specs (P62) says that it's the responsibility |
292 | 301 | * of the OSPM to clear the status bit [ implying that the |
293 | 302 | |
294 | 303 | |
295 | 304 | |
296 | 305 | |
... | ... | @@ -550,30 +559,27 @@ |
550 | 559 | |
551 | 560 | static int acpi_hibernation_enter(void) |
552 | 561 | { |
553 | - u8 flags = wake_sleep_flags(); | |
554 | 562 | acpi_status status = AE_OK; |
555 | 563 | |
556 | 564 | ACPI_FLUSH_CPU_CACHE(); |
557 | 565 | |
558 | 566 | /* This shouldn't return. If it returns, we have a problem */ |
559 | - status = acpi_enter_sleep_state(ACPI_STATE_S4, flags); | |
567 | + status = acpi_enter_sleep_state(ACPI_STATE_S4, wake_sleep_flags); | |
560 | 568 | /* Reprogram control registers and execute _BFS */ |
561 | - acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); | |
569 | + acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); | |
562 | 570 | |
563 | 571 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
564 | 572 | } |
565 | 573 | |
566 | 574 | static void acpi_hibernation_leave(void) |
567 | 575 | { |
568 | - u8 flags = wake_sleep_flags(); | |
569 | - | |
570 | 576 | /* |
571 | 577 | * If ACPI is not enabled by the BIOS and the boot kernel, we need to |
572 | 578 | * enable it here. |
573 | 579 | */ |
574 | 580 | acpi_enable(); |
575 | 581 | /* Reprogram control registers and execute _BFS */ |
576 | - acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); | |
582 | + acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); | |
577 | 583 | /* Check the hardware signature */ |
578 | 584 | if (facs && s4_hardware_signature != facs->hardware_signature) { |
579 | 585 | printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " |
580 | 586 | |
... | ... | @@ -828,12 +834,10 @@ |
828 | 834 | |
829 | 835 | static void acpi_power_off(void) |
830 | 836 | { |
831 | - u8 flags = wake_sleep_flags(); | |
832 | - | |
833 | 837 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ |
834 | 838 | printk(KERN_DEBUG "%s called\n", __func__); |
835 | 839 | local_irq_disable(); |
836 | - acpi_enter_sleep_state(ACPI_STATE_S5, flags); | |
840 | + acpi_enter_sleep_state(ACPI_STATE_S5, wake_sleep_flags); | |
837 | 841 | } |
838 | 842 | |
839 | 843 | /* |