Commit a2ef5c4fd44ce3922435139393b89f2cce47f576

Authored by Lin Ming
Committed by Len Brown
1 parent 8a73b17e4c

ACPI: Move module parameter gts and bfs to sleep.c

Move linux specific module parameter gts and bfs out of ACPICA core
code to sleep.c.

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

Showing 2 changed files with 31 additions and 20 deletions Side-by-side Diff

drivers/acpi/acpica/hwesleep.c
... ... @@ -44,17 +44,10 @@
44 44  
45 45 #include <acpi/acpi.h>
46 46 #include "accommon.h"
47   -#include <linux/module.h>
48 47  
49 48 #define _COMPONENT ACPI_HARDWARE
50 49 ACPI_MODULE_NAME("hwesleep")
51 50  
52   -static unsigned int gts, bfs;
53   -module_param(gts, uint, 0644);
54   -module_param(bfs, uint, 0644);
55   -MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
56   -MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
57   -
58 51 /*******************************************************************************
59 52 *
60 53 * FUNCTION: acpi_hw_execute_sleep_method
... ... @@ -75,12 +68,6 @@
75 68 acpi_status status;
76 69  
77 70 ACPI_FUNCTION_TRACE(hw_execute_sleep_method);
78   -
79   - if (!ACPI_STRCMP(METHOD_PATHNAME__GTS, method_pathname) && !gts)
80   - return_VOID;
81   -
82   - if (!ACPI_STRCMP(METHOD_PATHNAME__BFS, method_pathname) && !bfs)
83   - return_VOID;
84 71  
85 72 /* One argument, integer_argument; No return value expected */
86 73  
drivers/acpi/sleep.c
... ... @@ -17,6 +17,7 @@
17 17 #include <linux/suspend.h>
18 18 #include <linux/reboot.h>
19 19 #include <linux/acpi.h>
  20 +#include <linux/module.h>
20 21  
21 22 #include <asm/io.h>
22 23  
... ... @@ -26,6 +27,24 @@
26 27 #include "internal.h"
27 28 #include "sleep.h"
28 29  
  30 +static unsigned int gts, bfs;
  31 +module_param(gts, uint, 0644);
  32 +module_param(bfs, uint, 0644);
  33 +MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
  34 +MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
  35 +
  36 +static u8 wake_sleep_flags(void)
  37 +{
  38 + u8 flags = ACPI_NO_OPTIONAL_METHODS;
  39 +
  40 + if (gts)
  41 + flags |= ACPI_EXECUTE_GTS;
  42 + if (bfs)
  43 + flags |= ACPI_EXECUTE_BFS;
  44 +
  45 + return flags;
  46 +}
  47 +
29 48 static u8 sleep_states[ACPI_S_STATE_COUNT];
30 49  
31 50 static void acpi_sleep_tts_switch(u32 acpi_state)
... ... @@ -243,6 +262,7 @@
243 262 {
244 263 acpi_status status = AE_OK;
245 264 u32 acpi_state = acpi_target_sleep_state;
  265 + u8 flags = wake_sleep_flags();
246 266 int error;
247 267  
248 268 ACPI_FLUSH_CPU_CACHE();
... ... @@ -250,8 +270,7 @@
250 270 switch (acpi_state) {
251 271 case ACPI_STATE_S1:
252 272 barrier();
253   - status = acpi_enter_sleep_state(acpi_state,
254   - ACPI_NO_OPTIONAL_METHODS);
  273 + status = acpi_enter_sleep_state(acpi_state, flags);
255 274 break;
256 275  
257 276 case ACPI_STATE_S3:
... ... @@ -266,7 +285,7 @@
266 285 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);
267 286  
268 287 /* Reprogram control registers and execute _BFS */
269   - acpi_leave_sleep_state_prep(acpi_state, ACPI_NO_OPTIONAL_METHODS);
  288 + acpi_leave_sleep_state_prep(acpi_state, flags);
270 289  
271 290 /* ACPI 3.0 specs (P62) says that it's the responsibility
272 291 * of the OSPM to clear the status bit [ implying that the
273 292  
274 293  
275 294  
276 295  
... ... @@ -530,27 +549,30 @@
530 549  
531 550 static int acpi_hibernation_enter(void)
532 551 {
  552 + u8 flags = wake_sleep_flags();
533 553 acpi_status status = AE_OK;
534 554  
535 555 ACPI_FLUSH_CPU_CACHE();
536 556  
537 557 /* This shouldn't return. If it returns, we have a problem */
538   - status = acpi_enter_sleep_state(ACPI_STATE_S4, ACPI_NO_OPTIONAL_METHODS);
  558 + status = acpi_enter_sleep_state(ACPI_STATE_S4, flags);
539 559 /* Reprogram control registers and execute _BFS */
540   - acpi_leave_sleep_state_prep(ACPI_STATE_S4, ACPI_NO_OPTIONAL_METHODS);
  560 + acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags);
541 561  
542 562 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
543 563 }
544 564  
545 565 static void acpi_hibernation_leave(void)
546 566 {
  567 + u8 flags = wake_sleep_flags();
  568 +
547 569 /*
548 570 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
549 571 * enable it here.
550 572 */
551 573 acpi_enable();
552 574 /* Reprogram control registers and execute _BFS */
553   - acpi_leave_sleep_state_prep(ACPI_STATE_S4, ACPI_NO_OPTIONAL_METHODS);
  575 + acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags);
554 576 /* Check the hardware signature */
555 577 if (facs && s4_hardware_signature != facs->hardware_signature) {
556 578 printk(KERN_EMERG "ACPI: Hardware changed while hibernated, "
557 579  
... ... @@ -771,10 +793,12 @@
771 793  
772 794 static void acpi_power_off(void)
773 795 {
  796 + u8 flags = wake_sleep_flags();
  797 +
774 798 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
775 799 printk(KERN_DEBUG "%s called\n", __func__);
776 800 local_irq_disable();
777   - acpi_enter_sleep_state(ACPI_STATE_S5, ACPI_NO_OPTIONAL_METHODS);
  801 + acpi_enter_sleep_state(ACPI_STATE_S5, flags);
778 802 }
779 803  
780 804 /*