Skip to contentSkip to conversation

2.6.7-rc1-mm1: revert leave-runtime-suspended-devices-off-at-system-resume.patch

DISCUSSION Applied Felipe Alfaro Solana 3 participants 6 messages May 27, 2004 – May 28, 2004

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

Andrew,

2.6.7-rc-mm1 includes "leave-runtime-suspended-devices-off-at-system-resume" which causes mayor problems when used on my ACPI laptop. After resuming from S3 (STR), both the CardBus and UHCI-HCD bridges won't come up from suspension, rendering them completely unusable: neither my CardBus NIC, nor my USB mouse are recognized or functional.

I can easily see this by looking at my Microsoft Intellimouse Explorer optical mouse: the lights at the bottom of the mouse (used by the optical sensors) are turned off, which means the device is not being detected by the USB subsystem.

This behavior causes problems at system shutdown. The system hangs when the rc.d scripts start stopping "hotplug". The system will hang at that point without making any further progress since both the CardBus and USB sybsystems are literally "frozen" (and I can't unload their modules by hand).

Reverting "leave-runtime-suspend-devices-off-at-system-resume.patch" fixes the problem for me.

Thanks.

#1 lore raw
Quoted 7 lines · Felipe Alfaro Solana

2.6.7-rc-mm1 includes "leave-runtime-suspended-devices-off-at-system-resume" which causes mayor problems when used on my ACPI laptop. After resuming from S3 (STR), both the CardBus and UHCI-HCD bridges won't come up from suspension, rendering them completely unusable: neither my CardBus NIC, nor my USB mouse are recognized or functional.

Aargh, USB drivers appear to be the only drivers to modify that field, I didn't catch that, sorry. The following patch against 2.6.6 adds a new field for "previous state", so that drivers that modify their own dev->power.power_state during the suspend callback will be resumed. Can send a patch to fix 2.6.7-rc1-mm1 if desired.

drivers/base/power/suspend.c +3 -1
@@ -39,7 +39,9 @@
 {
 	int error = 0;
 
-	if (dev->bus && dev->bus->suspend)
+	dev->power.prev_state = dev->power.power_state;
+
+	if (dev->bus && dev->bus->suspend && ! dev->power.power_state)
 		error = dev->bus->suspend(dev,state);
 
 	if (!error) {
drivers/base/power/resume.c +4 -1
@@ -35,7 +35,10 @@
 		struct list_head * entry = dpm_off.next;
 		struct device * dev = to_device(entry);
 		list_del_init(entry);
-		resume_device(dev);
+
+		if (! dev->power.prev_state)
+			resume_device(dev);
+
 		list_add_tail(entry,&dpm_active);
 	}
 }
include/linux/pm.h +1 -0
@@ -231,6 +231,7 @@
 struct dev_pm_info {
 #ifdef	CONFIG_PM
 	u32			power_state;
+	u32			prev_state;
 	u8			* saved_state;
 	atomic_t		pm_users;
 	struct device		* pm_parent;
Signature · 1 line
Todd
#2 lore raw
Quoted 7 lines · Todd Poynor
Quoted 6 lines

2.6.7-rc-mm1 includes "leave-runtime-suspended-devices-off-at-system-resume" which causes mayor problems when used on my ACPI laptop. After resuming from S3 (STR), both the CardBus and UHCI-HCD bridges won't come up from suspension, rendering them completely unusable: neither my CardBus NIC, nor my USB mouse are recognized or functional.

Quoted 5 lines

Aargh, USB drivers appear to be the only drivers to modify that field, I didn't catch that, sorry. The following patch against 2.6.6 adds a new field for "previous state", so that drivers that modify their own dev->power.power_state during the suspend callback will be resumed. Can send a patch to fix 2.6.7-rc1-mm1 if desired.

I would like to see the patch against 2.6.7-rc1-mm1. Thanks!

#3 lore raw

A patch to fix my previous leave-runtime-suspended-devices-off-at-system-resume patch; the new changes save a copy of power.power_state in order to know whether to resume a device, independently of mods to that field by a driver suspend routine. This fixes 2.6.7-rc1-mm1 in the same fashion as the updated 2.6.6 patch sent previously. Thanks -- Todd

drivers/base/power/suspend.c +2 -0
@@ -39,6 +39,8 @@
 {
 	int error = 0;
 
+	dev->power.prev_state = dev->power.power_state;
+
 	if (dev->bus && dev->bus->suspend && !dev->power.power_state)
 		error = dev->bus->suspend(dev,state);
 
drivers/base/power/resume.c +1 -1
@@ -36,7 +36,7 @@
 		struct device * dev = to_device(entry);
 		list_del_init(entry);
 
-		if (!dev->power.power_state)
+		if (!dev->power.prev_state)
 			resume_device(dev);
 
 		list_add_tail(entry,&dpm_active);
include/linux/pm.h +1 -0
@@ -231,6 +231,7 @@
 struct dev_pm_info {
 	u32			power_state;
 #ifdef	CONFIG_PM
+	u32			prev_state;
 	u8			* saved_state;
 	atomic_t		pm_users;
 	struct device		* pm_parent;
Applied
#4 lore raw
Quoted 6 lines · Todd Poynor

A patch to fix my previous leave-runtime-suspended-devices-off-at-system-resume patch; the new changes save a copy of power.power_state in order to know whether to resume a device, independently of mods to that field by a driver suspend routine. This fixes 2.6.7-rc1-mm1 in the same fashion as the updated 2.6.6 patch sent previously. Thanks -- Todd

Applied to my trees, thanks.

greg k-h

#5 lore raw
In reply to Todd Poynor
Quoted 6 lines · Todd Poynor

A patch to fix my previous leave-runtime-suspended-devices-off-at-system-resume patch; the new changes save a copy of power.power_state in order to know whether to resume a device, independently of mods to that field by a driver suspend routine. This fixes 2.6.7-rc1-mm1 in the same fashion as the updated 2.6.6 patch sent previously. Thanks -- Todd

This one works flawlessly.
Thanks!