diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-01-06 19:43:44 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2011-01-07 00:36:55 -0500 |
commit | 976513dbfc1547c7b1822566923058655f0c32fd (patch) | |
tree | 561e658e65a0136691cc9faebbe1ddf17a3429d3 | |
parent | 26fcaf60fe3861409eb4c455c5c0d0f00f599b08 (diff) |
PM / ACPI: Move NVS saving and restoring code to drivers/acpi
The saving of the ACPI NVS area during hibernation and suspend and
restoring it during the subsequent resume is entirely specific to
ACPI, so move it to drivers/acpi and drop the CONFIG_SUSPEND_NVS
configuration option which is redundant.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | arch/x86/kernel/e820.c | 1 | ||||
-rw-r--r-- | drivers/acpi/Makefile | 2 | ||||
-rw-r--r-- | drivers/acpi/internal.h | 8 | ||||
-rw-r--r-- | drivers/acpi/nvs.c (renamed from kernel/power/nvs.c) | 0 | ||||
-rw-r--r-- | include/linux/acpi.h | 9 | ||||
-rw-r--r-- | include/linux/suspend.h | 17 | ||||
-rw-r--r-- | kernel/power/Kconfig | 5 | ||||
-rw-r--r-- | kernel/power/Makefile | 1 |
8 files changed, 19 insertions, 24 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 0c2b7ef7a34d..294f26da0c0c 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/bootmem.h> | 14 | #include <linux/bootmem.h> |
15 | #include <linux/pfn.h> | 15 | #include <linux/pfn.h> |
16 | #include <linux/suspend.h> | 16 | #include <linux/suspend.h> |
17 | #include <linux/acpi.h> | ||
17 | #include <linux/firmware-map.h> | 18 | #include <linux/firmware-map.h> |
18 | #include <linux/memblock.h> | 19 | #include <linux/memblock.h> |
19 | 20 | ||
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 3d031d02e54b..9cc9f2c4da79 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -24,7 +24,7 @@ acpi-y += atomicio.o | |||
24 | # sleep related files | 24 | # sleep related files |
25 | acpi-y += wakeup.o | 25 | acpi-y += wakeup.o |
26 | acpi-y += sleep.o | 26 | acpi-y += sleep.o |
27 | acpi-$(CONFIG_ACPI_SLEEP) += proc.o | 27 | acpi-$(CONFIG_ACPI_SLEEP) += proc.o nvs.o |
28 | 28 | ||
29 | 29 | ||
30 | # | 30 | # |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index a212bfeddf8c..7c23b76e8eca 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -82,8 +82,16 @@ extern int acpi_sleep_init(void); | |||
82 | 82 | ||
83 | #ifdef CONFIG_ACPI_SLEEP | 83 | #ifdef CONFIG_ACPI_SLEEP |
84 | int acpi_sleep_proc_init(void); | 84 | int acpi_sleep_proc_init(void); |
85 | int suspend_nvs_alloc(void); | ||
86 | void suspend_nvs_free(void); | ||
87 | int suspend_nvs_save(void); | ||
88 | void suspend_nvs_restore(void); | ||
85 | #else | 89 | #else |
86 | static inline int acpi_sleep_proc_init(void) { return 0; } | 90 | static inline int acpi_sleep_proc_init(void) { return 0; } |
91 | static inline int suspend_nvs_alloc(void) { return 0; } | ||
92 | static inline void suspend_nvs_free(void) {} | ||
93 | static inline int suspend_nvs_save(void) {} | ||
94 | static inline void suspend_nvs_restore(void) {} | ||
87 | #endif | 95 | #endif |
88 | 96 | ||
89 | #endif /* _ACPI_INTERNAL_H_ */ | 97 | #endif /* _ACPI_INTERNAL_H_ */ |
diff --git a/kernel/power/nvs.c b/drivers/acpi/nvs.c index 57c6fabbb6b6..57c6fabbb6b6 100644 --- a/kernel/power/nvs.c +++ b/drivers/acpi/nvs.c | |||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 67c91b4418b0..fa7ed6a983d0 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -254,6 +254,15 @@ void __init acpi_old_suspend_ordering(void); | |||
254 | void __init acpi_nvs_nosave(void); | 254 | void __init acpi_nvs_nosave(void); |
255 | #endif /* CONFIG_PM_SLEEP */ | 255 | #endif /* CONFIG_PM_SLEEP */ |
256 | 256 | ||
257 | #ifdef CONFIG_ACPI_SLEEP | ||
258 | int suspend_nvs_register(unsigned long start, unsigned long size); | ||
259 | #else | ||
260 | static inline int suspend_nvs_register(unsigned long a, unsigned long b) | ||
261 | { | ||
262 | return 0; | ||
263 | } | ||
264 | #endif | ||
265 | |||
257 | struct acpi_osc_context { | 266 | struct acpi_osc_context { |
258 | char *uuid_str; /* uuid string */ | 267 | char *uuid_str; /* uuid string */ |
259 | int rev; | 268 | int rev; |
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index acb7d911bb0c..0e288e3c37be 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -258,23 +258,6 @@ static inline int hibernate(void) { return -ENOSYS; } | |||
258 | static inline bool system_entering_hibernation(void) { return false; } | 258 | static inline bool system_entering_hibernation(void) { return false; } |
259 | #endif /* CONFIG_HIBERNATION */ | 259 | #endif /* CONFIG_HIBERNATION */ |
260 | 260 | ||
261 | #ifdef CONFIG_SUSPEND_NVS | ||
262 | extern int suspend_nvs_register(unsigned long start, unsigned long size); | ||
263 | extern int suspend_nvs_alloc(void); | ||
264 | extern void suspend_nvs_free(void); | ||
265 | extern int suspend_nvs_save(void); | ||
266 | extern void suspend_nvs_restore(void); | ||
267 | #else /* CONFIG_SUSPEND_NVS */ | ||
268 | static inline int suspend_nvs_register(unsigned long a, unsigned long b) | ||
269 | { | ||
270 | return 0; | ||
271 | } | ||
272 | static inline int suspend_nvs_alloc(void) { return 0; } | ||
273 | static inline void suspend_nvs_free(void) {} | ||
274 | static inline int suspend_nvs_save(void) {} | ||
275 | static inline void suspend_nvs_restore(void) {} | ||
276 | #endif /* CONFIG_SUSPEND_NVS */ | ||
277 | |||
278 | #ifdef CONFIG_PM_SLEEP | 261 | #ifdef CONFIG_PM_SLEEP |
279 | void save_processor_state(void); | 262 | void save_processor_state(void); |
280 | void restore_processor_state(void); | 263 | void restore_processor_state(void); |
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index a5aff3ebad38..265729966ece 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -100,13 +100,9 @@ config PM_SLEEP_ADVANCED_DEBUG | |||
100 | depends on PM_ADVANCED_DEBUG | 100 | depends on PM_ADVANCED_DEBUG |
101 | default n | 101 | default n |
102 | 102 | ||
103 | config SUSPEND_NVS | ||
104 | bool | ||
105 | |||
106 | config SUSPEND | 103 | config SUSPEND |
107 | bool "Suspend to RAM and standby" | 104 | bool "Suspend to RAM and standby" |
108 | depends on PM && ARCH_SUSPEND_POSSIBLE | 105 | depends on PM && ARCH_SUSPEND_POSSIBLE |
109 | select SUSPEND_NVS if HAS_IOMEM | ||
110 | default y | 106 | default y |
111 | ---help--- | 107 | ---help--- |
112 | Allow the system to enter sleep states in which main memory is | 108 | Allow the system to enter sleep states in which main memory is |
@@ -140,7 +136,6 @@ config HIBERNATION | |||
140 | depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE | 136 | depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE |
141 | select LZO_COMPRESS | 137 | select LZO_COMPRESS |
142 | select LZO_DECOMPRESS | 138 | select LZO_DECOMPRESS |
143 | select SUSPEND_NVS if HAS_IOMEM | ||
144 | ---help--- | 139 | ---help--- |
145 | Enable the suspend to disk (STD) functionality, which is usually | 140 | Enable the suspend to disk (STD) functionality, which is usually |
146 | called "hibernation" in user interfaces. STD checkpoints the | 141 | called "hibernation" in user interfaces. STD checkpoints the |
diff --git a/kernel/power/Makefile b/kernel/power/Makefile index f9063c6b185d..120a15823325 100644 --- a/kernel/power/Makefile +++ b/kernel/power/Makefile | |||
@@ -10,6 +10,5 @@ obj-$(CONFIG_SUSPEND) += suspend.o | |||
10 | obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o | 10 | obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o |
11 | obj-$(CONFIG_HIBERNATION) += hibernate.o snapshot.o swap.o user.o \ | 11 | obj-$(CONFIG_HIBERNATION) += hibernate.o snapshot.o swap.o user.o \ |
12 | block_io.o | 12 | block_io.o |
13 | obj-$(CONFIG_SUSPEND_NVS) += nvs.o | ||
14 | 13 | ||
15 | obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o | 14 | obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o |