Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Sep 2007 08:21:40 GMT
From:      Marko Zec <zec@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 126399 for review
Message-ID:  <200709140821.l8E8LeLR042407@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=126399

Change 126399 by zec@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;
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709140821.l8E8LeLR042407>