]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.31/patches.suse/apm_setup_UP.diff
Add a patch to fix Intel E100 wake-on-lan problems.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.suse / apm_setup_UP.diff
CommitLineData
6a930a95
BS
1From: Olaf Dabrunz <od@suse.de>
2Subject: [apm] default to "power_off" when SMP kernel is used on single processor machines
3Reference: SUSE221667
4
5This patch turns on support for the APM power_off function by default when the
6SMP kernel is used on single processor machines.
7
8It is a bit ugly to use a separate variable to make sure the default value is
9only used when needed and the power_off variable is not initialized twice. But
10I did not find a better way to do this with the way the current initialization
11system works.
12
13Signed-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;