Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jan 2000 13:30:54 +0000 (GMT)
From:      Nick Hibma <n_hibma@webweaving.org>
To:        FreeBSD CURRENT Mailing List <current@FreeBSD.ORG>
Subject:   APM still ignoring DEVICE_SUSPEND errors
Message-ID:  <Pine.BSF.4.20.0001231408180.4623-200000@localhost>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]

The following patch fixes two things: First, DEVICE_SUSPEND errors are
no longer ignored. Since we have defaults for methods we should no
longer ignore these errors. Also, DEVICE_RESUME wasn't done when the
apm_suspend_system event failed.

Second, in the ordering of DEVICE_* and apm_hook_* is not symmetric for
suspend and resume. The patch reverses the resume case as well to be

	apm_hook_resume(...)
	DEVICE_RESUME(root)

Send me some feedback on this. I've mailed the people mentioned in the
head of the file, but so far got no response. I would like to make sure
we get this right when USB devices are used. Some of them don't suspend
and the suspend should be refused in that case.

Nick

--
n_hibma@webweaving.org
n_hibma@freebsd.org                                          USB project
http://www.etla.net/~n_hibma/


[-- Attachment #2 --]
--- /usr/src/sys/i386/apm/apm.c	Thu Dec  2 03:13:00 1999
+++ /heidi/usr/current/src/sys/i386/apm/apm.c	Sun Jan 23 14:07:49 2000
@@ -473,19 +473,19 @@
 
 	if (sc->initialized) {
 		error = DEVICE_SUSPEND(root_bus);
-		/*
-		 * XXX Shouldn't ignore the error like this, but should
-		 * instead fix the newbus code.  Until that happens,
-		 * I'm doing this to get suspend working again.
-		 */
-		if (error)
-			printf("DEVICE_SUSPEND error %d, ignored\n", error);
-		apm_execute_hook(hook[APM_HOOK_SUSPEND]);
-		if (apm_suspend_system(PMST_SUSPEND) == 0)
-			apm_processevent();
-		else
-			/* Failure, 'resume' the system again */
-			apm_execute_hook(hook[APM_HOOK_RESUME]);
+		if (error) {
+			printf("Suspend failed, error %d\n", error);
+			DEVICE_RESUME(root_bus);
+		} else {
+			apm_execute_hook(hook[APM_HOOK_SUSPEND]);
+			if (apm_suspend_system(PMST_SUSPEND) == 0)
+				apm_processevent();
+			else {
+				/* Failure, 'resume' the system again */
+				apm_execute_hook(hook[APM_HOOK_RESUME]);
+				DEVICE_RESUME(root_bus);
+			}
+		}
 	}
 }
 
@@ -593,8 +593,8 @@
 		return;
 
 	if (sc->initialized) {
-		DEVICE_RESUME(root_bus);
 		apm_execute_hook(hook[APM_HOOK_RESUME]);
+		DEVICE_RESUME(root_bus);
 	}
 }
 

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.20.0001231408180.4623-200000>