PERFORCE change 126399 for review

Marko Zec zec at FreeBSD.org
Fri Sep 14 01:21:41 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126399

Change 126399 by zec at zec_tpx32 on 2007/09/14 08:20:51

	Hold th Giant across DEVICE_SUSPEND/RESUME in apm_do_suspend()
	since non-MPSAFE drivers need this.  In particular this change
	allows for USB periperals to better survive suspend/resume
	cycles.

Affected files ...

.. //depot/projects/vimage/src/sys/i386/bios/apm.c#2 edit

Differences ...

==== //depot/projects/vimage/src/sys/i386/bios/apm.c#2 (text+ko) ====

@@ -485,7 +485,13 @@
 	apm_op_inprog = 0;
 	sc->suspends = sc->suspend_countdown = 0;
 
+	/*
+	 * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since
+	 * non-MPSAFE drivers need this.
+	 */
+	mtx_lock(&Giant);
 	error = DEVICE_SUSPEND(root_bus);
+	mtx_unlock(&Giant);
 	if (error)
 		return;
 
@@ -496,7 +502,9 @@
 	} else {
 		/* Failure, 'resume' the system again */
 		apm_execute_hook(hook[APM_HOOK_RESUME]);
+		mtx_lock(&Giant);
 		DEVICE_RESUME(root_bus);
+		mtx_unlock(&Giant);
 	}
 	return;
 }
@@ -602,7 +610,9 @@
 
 	sc->suspending = 0;
 	apm_execute_hook(hook[APM_HOOK_RESUME]);
+	mtx_lock(&Giant);
 	DEVICE_RESUME(root_bus);
+	mtx_unlock(&Giant);
 	return;
 }
 


More information about the p4-projects mailing list