]>
Commit | Line | Data |
---|---|---|
4d1e5b62 AF |
1 | From: Olaf Dabrunz <od@suse.de> |
2 | Subject: [apm] default to "power_off" when SMP kernel is used on single processor machines | |
3 | Reference: SUSE221667 | |
4 | ||
5 | This patch turns on support for the APM power_off function by default when the | |
6 | SMP kernel is used on single processor machines. | |
7 | ||
8 | It is a bit ugly to use a separate variable to make sure the default value is | |
9 | only used when needed and the power_off variable is not initialized twice. But | |
10 | I did not find a better way to do this with the way the current initialization | |
11 | system works. | |
12 | ||
13 | Signed-off-by: Olaf Dabrunz <od@suse.de> | |
14 | ||
15 | ||
16 | arch/x86/kernel/apm_32.c | 15 ++++++++++++++- | |
17 | 1 file changed, 14 insertions(+), 1 deletion(-) | |
18 | ||
19 | --- a/arch/x86/kernel/apm_32.c | |
20 | +++ b/arch/x86/kernel/apm_32.c | |
21 | @@ -389,6 +389,7 @@ static int smp __read_mostly; | |
22 | static int apm_disabled = -1; | |
23 | #ifdef CONFIG_SMP | |
24 | static int power_off; | |
25 | +static int power_off_set; | |
26 | #else | |
27 | static int power_off = 1; | |
28 | #endif | |
29 | @@ -1797,6 +1798,14 @@ static int apm(void *unused) | |
30 | } | |
31 | } | |
32 | ||
33 | +#ifdef CONFIG_SMP | |
34 | + if (!power_off_set) { | |
35 | + power_off = (num_online_cpus() == 1); | |
36 | + /* remember not to initialize (with default value) again */ | |
37 | + power_off_set = 1; | |
38 | + } | |
39 | +#endif | |
40 | + | |
41 | /* Install our power off handler.. */ | |
42 | if (power_off) | |
43 | pm_power_off = apm_power_off; | |
44 | @@ -1840,8 +1849,12 @@ static int __init apm_setup(char *str) | |
45 | if (strncmp(str, "debug", 5) == 0) | |
46 | debug = !invert; | |
47 | if ((strncmp(str, "power-off", 9) == 0) || | |
48 | - (strncmp(str, "power_off", 9) == 0)) | |
49 | + (strncmp(str, "power_off", 9) == 0)) { | |
50 | power_off = !invert; | |
51 | +#ifdef CONFIG_SMP | |
52 | + power_off_set = 1; | |
53 | +#endif | |
54 | + } | |
55 | if (strncmp(str, "smp", 3) == 0) { | |
56 | smp = !invert; | |
57 | idle_threshold = 100; |