Skip to contentSkip to conversation

Don't "lose" devices on suspend on failure

PATCH In review Benjamin Herrenschmidt 2 participants 2 messages May 31, 2005 – Jun 1, 2005

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

PATCH 1/1 Don't "lose" devices on suspend on failure

Hi !

I think we need this patch or we might "lose" devices to the dpm_irq_off list if a failure occurs during the suspend process.

Patrick, Greg, your opinion ?

drivers/base/power/suspend.c +12 -1
Index: linux-work/drivers/base/power/suspend.c
===================================================================
@@ -113,8 +113,19 @@
 		put_device(dev);
 	}
 	up(&dpm_list_sem);
-	if (error)
+	if (error) {
+		/* we failed... before resuming, bring back devices from
+		 * dpm_off_irq list back to main dpm_off list, we do want
+		 * to call resume() on them, in case they partially suspended
+		 * despite returning -EAGAIN
+		 */
+		while (!list_empty(&dpm_off_irq)) {
+			struct list_head * entry = dpm_off_irq.next;
+			list_del(entry);
+			list_add(entry, &dpm_off);
+		}
 		dpm_resume();
+	}
 	up(&dpm_sem);
 	return error;
 }
#1 lore raw
Quoted 6 lines · Benjamin Herrenschmidt

Hi !

I think we need this patch or we might "lose" devices to the dpm_irq_off list if a failure occurs during the suspend process.

Patrick, Greg, your opinion ?

Looks fine to me, I've added it to my tree.

thanks,

greg k-h