Skip to contentSkip to conversation

[Fwd: Re: 2.6.11-rc3-mm1]

Fwd: Re: 2.6.11-rc3-mm1 Randy.Dunlap 1 participant 1 message Feb 10, 2005

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

for broader exposure (that linux-acpi:)

-------- Original Message --------
Subject: Re: 2.6.11-rc3-mm1
Date: Wed, 9 Feb 2005 20:12:07 -0800
From: Andrew Morton <[email protected]>
To: Marcos D. Marado Torres <[email protected]>
CC: [email protected], [email protected]
References: <[email protected]> <Pine.LNX.4.61.0502090357060.7433-oe7qfRrRQfcmha6Ds7sm0l6hYfS7NtTn@public.gmane.org>

Quoted 10 lines · Marcos D. Marado Torres

Please add to -mm the patch in attachment, since it solves the old acpi_power_off bug...

...
diff -Nru -p1 linux-2.6.11-rc2-mm1/drivers/base/power/shutdown.c linux-2.6.11-rc2-mm1-mbn1/drivers/base/power/shutdown.c
--- linux-2.6.11-rc2-mm1/drivers/base/power/shutdown.c 2004-12-24 22:35:01.000000000 +0100
+++ linux-2.6.11-rc2-mm1-mbn1/drivers/base/power/shutdown.c 2005-01-26 00:26:54.000000000 +0100
@@ -64,2 +64,9 @@ void device_shutdown(void)

Quoted 7 lines

+#if 1
+ {
+ extern void do_acpi_power_off_prepare(void);
+ do_acpi_power_off_prepare();
+ }
+#endif
+

This of course doesn't compile if CONFIG_ACPI=n. I fixed that up.

Also, having acpi stuff in drivers/base/power/shutdown.c is quite inappropriate.

Also, extern declarations should also not be placed in .c files - they should go into header files which are shared by the definition and all users of the symbol.

(I understand that it's only a "proof of concept" patch, but I thought I'd bitch anyway ;))

So. I'll keep the patch as-is in -mm for now. I've Cc'ed linux-acpi. Perhaps the people there can absorb this and fix it up for real, please?

From: "Marcos D. Marado Torres" <[email protected]>

From: "Barry K. Nathan" <[email protected]>

Quoted 6 lines · Andrew Morton
Quoted 3 lines · Marcos D. Marado Torres

Please add to -mm the patch in attachment, since it solves the old
acpi_power_off bug...

What acpi_power_off bug? And how does it solve it?

Here's the observed bug that the patch is trying to fix:
http://bugme.osdl.org/show_bug.cgi?id=4041

What Marcos posted is a typo-corrected version of Eric Biederman's patch:
http://marc.theaimsgroup.com/?l=linux-kernel&m=110665542929525&w=2

In Eric's own words, the patch "needs some work before it goes into a mainline kernel". AFAICT it's more of a proof-of-concept, just to see if Eric's on the right track...

This is the motivation behind the patch:
http://marc.theaimsgroup.com/?l=linux-kernel&m=110665405402747&w=2

drivers/acpi/sleep/poweroff.c renamed from drivers/acpi/sleep/poweroff.c~acpi_power_off-bug-fix 2005-02-09 19:55:05.000000000 -0800 +21 -2
@@ -7,18 +7,37 @@
 
 #include <linux/pm.h>
 #include <linux/init.h>
+#include <linux/kernel.h>
 #include <acpi/acpi_bus.h>
 #include <linux/sched.h>
 #include "sleep.h"
 
 static void
+acpi_power_off_prepare(void)
+{
+       if (system_state == SYSTEM_POWER_OFF) {
+               acpi_wakeup_gpe_poweroff_prepare();
+               acpi_enter_sleep_state_prep(ACPI_STATE_S5);
+       }
+}
+
+void
+do_acpi_power_off_prepare(void)
+{
+       if (!acpi_disabled) {
+               acpi_power_off_prepare();
+       }
+}
+
+
+static void
 acpi_power_off (void)
 {
 	printk("%s called\n",__FUNCTION__);
+#if 0	/* This should be made redundant by other patches.. */
 	/* Some SMP machines only can poweroff in boot CPU */
 	set_cpus_allowed(current, cpumask_of_cpu(0));
-	acpi_wakeup_gpe_poweroff_prepare();
-	acpi_enter_sleep_state_prep(ACPI_STATE_S5);
+#endif
 	ACPI_DISABLE_IRQS();
 	acpi_enter_sleep_state(ACPI_STATE_S5);
 }
drivers/base/power/shutdown.c renamed from drivers/base/power/shutdown.c~acpi_power_off-bug-fix 2005-02-09 19:55:05.000000000 -0800 +7 -0
diff -puN drivers/base/power/shutdown.c~acpi_power_off-bug-fix drivers/base/power/shutdown.c
@@ -62,6 +62,13 @@ void device_shutdown(void)
 	}
 	up_write(&devices_subsys.rwsem);
 
+#ifdef CONFIG_ACPI
+	{
+		extern void do_acpi_power_off_prepare(void);
+		do_acpi_power_off_prepare();
+	}
+#endif
+
 	sysdev_shutdown();
 }
 

_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 8 lines
~Randy


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click