Commit 6831c6edc7b272a08dd2a6c71bb183a48fe98ae6
1 parent
e866500247
Exists in
master
and in
4 other branches
PM: Drop pm_flags that is not necessary
The variable pm_flags is used to prevent APM from being enabled along with ACPI, which would lead to problems. However, acpi_init() is always called before apm_init() and after acpi_init() has returned, it is known whether or not ACPI will be used. Namely, if acpi_disabled is not set after acpi_init() has returned, this means that ACPI is enabled. Thus, it is sufficient to check acpi_disabled in apm_init() to prevent APM from being enabled in parallel with ACPI. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Len Brown <len.brown@intel.com>
Showing 5 changed files with 7 additions and 48 deletions Side-by-side Diff
arch/x86/kernel/apm_32.c
... | ... | @@ -227,6 +227,7 @@ |
227 | 227 | #include <linux/suspend.h> |
228 | 228 | #include <linux/kthread.h> |
229 | 229 | #include <linux/jiffies.h> |
230 | +#include <linux/acpi.h> | |
230 | 231 | |
231 | 232 | #include <asm/system.h> |
232 | 233 | #include <asm/uaccess.h> |
233 | 234 | |
... | ... | @@ -2331,12 +2332,11 @@ |
2331 | 2332 | apm_info.disabled = 1; |
2332 | 2333 | return -ENODEV; |
2333 | 2334 | } |
2334 | - if (pm_flags & PM_ACPI) { | |
2335 | + if (!acpi_disabled) { | |
2335 | 2336 | printk(KERN_NOTICE "apm: overridden by ACPI.\n"); |
2336 | 2337 | apm_info.disabled = 1; |
2337 | 2338 | return -ENODEV; |
2338 | 2339 | } |
2339 | - pm_flags |= PM_APM; | |
2340 | 2340 | |
2341 | 2341 | /* |
2342 | 2342 | * Set up the long jump entry point to the APM BIOS, which is called |
... | ... | @@ -2428,7 +2428,6 @@ |
2428 | 2428 | kthread_stop(kapmd_task); |
2429 | 2429 | kapmd_task = NULL; |
2430 | 2430 | } |
2431 | - pm_flags &= ~PM_APM; | |
2432 | 2431 | } |
2433 | 2432 | |
2434 | 2433 | module_init(apm_init); |
drivers/acpi/bus.c
... | ... | @@ -1007,9 +1007,8 @@ |
1007 | 1007 | |
1008 | 1008 | static int __init acpi_init(void) |
1009 | 1009 | { |
1010 | - int result = 0; | |
1010 | + int result; | |
1011 | 1011 | |
1012 | - | |
1013 | 1012 | if (acpi_disabled) { |
1014 | 1013 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); |
1015 | 1014 | return -ENODEV; |
1016 | 1015 | |
1017 | 1016 | |
1018 | 1017 | |
1019 | 1018 | |
... | ... | @@ -1023,29 +1022,18 @@ |
1023 | 1022 | |
1024 | 1023 | init_acpi_device_notify(); |
1025 | 1024 | result = acpi_bus_init(); |
1026 | - | |
1027 | - if (!result) { | |
1028 | - pci_mmcfg_late_init(); | |
1029 | - if (pm_apm_enabled()) { | |
1030 | - printk(KERN_INFO PREFIX | |
1031 | - "APM is already active, exiting\n"); | |
1032 | - disable_acpi(); | |
1033 | - result = -ENODEV; | |
1034 | - } else { | |
1035 | - pm_set_acpi_flag(); | |
1036 | - } | |
1037 | - } else | |
1025 | + if (result) { | |
1038 | 1026 | disable_acpi(); |
1039 | - | |
1040 | - if (acpi_disabled) | |
1041 | 1027 | return result; |
1028 | + } | |
1042 | 1029 | |
1030 | + pci_mmcfg_late_init(); | |
1043 | 1031 | acpi_scan_init(); |
1044 | 1032 | acpi_ec_init(); |
1045 | 1033 | acpi_debugfs_init(); |
1046 | 1034 | acpi_sleep_proc_init(); |
1047 | 1035 | acpi_wakeup_device_init(); |
1048 | - return result; | |
1036 | + return 0; | |
1049 | 1037 | } |
1050 | 1038 | |
1051 | 1039 | subsys_initcall(acpi_init); |
include/linux/pm.h
... | ... | @@ -565,15 +565,6 @@ |
565 | 565 | DPM_ORDER_DEV_LAST, |
566 | 566 | }; |
567 | 567 | |
568 | -/* | |
569 | - * Global Power Management flags | |
570 | - * Used to keep APM and ACPI from both being active | |
571 | - */ | |
572 | -extern unsigned int pm_flags; | |
573 | - | |
574 | -#define PM_APM 1 | |
575 | -#define PM_ACPI 2 | |
576 | - | |
577 | 568 | extern int pm_generic_suspend(struct device *dev); |
578 | 569 | extern int pm_generic_resume(struct device *dev); |
579 | 570 | extern int pm_generic_freeze(struct device *dev); |
include/linux/suspend.h
... | ... | @@ -272,9 +272,6 @@ |
272 | 272 | register_pm_notifier(&fn##_nb); \ |
273 | 273 | } |
274 | 274 | |
275 | -extern bool pm_apm_enabled(void); | |
276 | -extern void pm_set_acpi_flag(void); | |
277 | - | |
278 | 275 | /* drivers/base/power/wakeup.c */ |
279 | 276 | extern bool events_check_enabled; |
280 | 277 | |
... | ... | @@ -294,9 +291,6 @@ |
294 | 291 | } |
295 | 292 | |
296 | 293 | #define pm_notifier(fn, pri) do { (void)(fn); } while (0) |
297 | - | |
298 | -static inline bool pm_apm_enabled(void) { return false; } | |
299 | -static inline void pm_set_acpi_flag(void) {} | |
300 | 294 | |
301 | 295 | static inline bool pm_wakeup_pending(void) { return false; } |
302 | 296 | #endif /* !CONFIG_PM_SLEEP */ |
kernel/power/main.c
... | ... | @@ -19,19 +19,6 @@ |
19 | 19 | |
20 | 20 | #ifdef CONFIG_PM_SLEEP |
21 | 21 | |
22 | -unsigned int pm_flags; | |
23 | -EXPORT_SYMBOL(pm_flags); | |
24 | - | |
25 | -bool pm_apm_enabled(void) | |
26 | -{ | |
27 | - return !!(pm_flags & PM_APM); | |
28 | -} | |
29 | - | |
30 | -void pm_set_acpi_flag(void) | |
31 | -{ | |
32 | - pm_flags |= PM_ACPI; | |
33 | -} | |
34 | - | |
35 | 22 | /* Routines for PM-transition notifications */ |
36 | 23 | |
37 | 24 | static BLOCKING_NOTIFIER_HEAD(pm_chain_head); |