1 From: Olaf Dabrunz <od@suse.de>
2 Subject: [apm] default to "power_off" when SMP kernel is used on single processor machines
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.
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
13 Signed-off-by: Olaf Dabrunz <od@suse.de>
16 arch/x86/kernel/apm_32.c | 15 ++++++++++++++-
17 1 file changed, 14 insertions(+), 1 deletion(-)
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;
25 +static int power_off_set;
27 static int power_off = 1;
29 @@ -1797,6 +1798,14 @@ static int apm(void *unused)
34 + if (!power_off_set) {
35 + power_off = (num_online_cpus() == 1);
36 + /* remember not to initialize (with default value) again */
41 /* Install our power off handler.. */
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)
47 if ((strncmp(str, "power-off", 9) == 0) ||
48 - (strncmp(str, "power_off", 9) == 0))
49 + (strncmp(str, "power_off", 9) == 0)) {
55 if (strncmp(str, "smp", 3) == 0) {