Skip to contentSkip to conversation

S3 and swsusp: fixing device_resume order

PATCH Pavel Machek 1 participant 1 message Aug 4, 2002 PCI

lore
Share & tools
lore
#0 lore raw

Hi!

pci driver's resume must not be called during RESUME_POWER_ON because interrupts are still off and i8259A is not initialized [OHCI kills machine in such case, cardbus probably too. PCI drivers just assume initialized interrupts.]

Second hunk fixes device_resume calls to be okay according to documentation. Please apply,
Pavel

drivers/pci/pci-driver.c +5 -1
@@ -90,7 +90,11 @@
 	struct pci_dev * pci_dev = to_pci_dev(dev);
 
 	if (pci_dev->driver) {
-		if (level == RESUME_POWER_ON && pci_dev->driver->resume)
+		/* We may not call PCI drivers resume at
+		   RESUME_POWER_ON because interrupts are not yet
+		   working at that point. Calling resume at
+		   RESUME_RESTORE_STATE seems like solution. */
+		if (level == RESUME_RESTORE_STATE && pci_dev->driver->resume)
 			pci_dev->driver->resume(pci_dev);
 	}
 	return 0;
kernel/suspend.c +2 -2
@@ -619,8 +619,8 @@
 /* Make disk drivers accept operations, again */
 static void drivers_unsuspend(void)
 {
-	device_resume(RESUME_ENABLE);
 	device_resume(RESUME_RESTORE_STATE);
+	device_resume(RESUME_ENABLE);
 }
 
 /* Called from process context */
@@ -647,8 +647,8 @@
 static void drivers_resume(int flags)
 {
 	if (flags & RESUME_PHASE1) {
-		device_resume(RESUME_ENABLE);
 		device_resume(RESUME_RESTORE_STATE);
+		device_resume(RESUME_ENABLE);
 	}
   	if (flags & RESUME_PHASE2) {
 		if(pm_suspend_state) {
Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?