Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Nov 1997 11:27:46 -0700 (MST)
From:      Nate Williams <nate@mt.sri.com>
To:        mobile@freebsd.org, jdp@polstra.com
Subject:   Suspend failure error handling
Message-ID:  <199711011827.LAA29865@rocky.mt.sri.com>

next in thread | raw e-mail | index | archive | help
As John noted earlier, if suspend fails (due to promiscous cards or
whatever) the system is hosed up.  Try this patch, which was much
simpler to implement than I anticipated, and also hopefully works.
Unfortunately, I don't have my laptop here, so I can't test it
personally, but it's pretty basic.

This patch should be applicable to both -current and -stable, since the
code in both is pretty similar (I think???).

# cd sys/i386/apm
# patch < email
# cd /sys/compile/KERNE
# make && make install



Nate
----------
Index: apm.c
===================================================================
RCS file: /home/CVS/src/sys/i386/apm/apm.c,v
retrieving revision 1.49
diff -b -u -r1.49 apm.c
--- apm.c	1996/09/07 17:41:22	1.49
+++ apm.c	1997/11/01 18:24:16
@@ -397,13 +397,13 @@
 {
 	struct apm_softc *sc = &apm_softc;
 
-	if (!sc)
-		return;
-
-	if (sc->initialized) {
+	if (sc && sc->initialized) {
 		apm_execute_hook(hook[APM_HOOK_SUSPEND]);
-		apm_suspend_system(sc);
+		if (apm_suspend_system(sc) == 0)
 		apm_processevent(sc);
+		else
+			/* Failed, resume everything */
+			apm_execute_hook(hook[APM_HOOK_RESUME]);
 	}
 }
 
@@ -412,12 +412,8 @@
 {
 	struct apm_softc *sc = &apm_softc;
 
-	if (!sc)
-		return;
-
-	if (sc->initialized) {
+	if (sc && sc->initialized)
 		apm_execute_hook(hook[APM_HOOK_RESUME]);
-	}
 }
 
 



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