Module Name:    src
Committed By:   jdc
Date:           Mon Dec 12 18:28:34 UTC 2011

Modified Files:
        src/sys/dev/ic: isp_netbsd.c

Log Message:
Fix:
  panic: kernel diagnostic assertion "usec >= 0 && usec < 1000000" failed: file 
"/usr/src/sys/kern/subr_time.c", line 92
by using timeradd(), rather than our own code, in the timeout calculating
loop.  Idea from joerg@.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/ic/isp_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/isp_netbsd.c
diff -u src/sys/dev/ic/isp_netbsd.c:1.84 src/sys/dev/ic/isp_netbsd.c:1.85
--- src/sys/dev/ic/isp_netbsd.c:1.84	Mon Sep 20 03:52:45 2010
+++ src/sys/dev/ic/isp_netbsd.c	Mon Dec 12 18:28:34 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.84 2010/09/20 03:52:45 mjacob Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.85 2011/12/12 18:28:34 jdc Exp $ */
 /*
  * Platform (NetBSD) dependent common attachment code for Qlogic adapters.
  */
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.84 2010/09/20 03:52:45 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.85 2011/12/12 18:28:34 jdc Exp $");
 
 #include <dev/ic/isp_netbsd.h>
 #include <dev/ic/isp_ioctl.h>
@@ -1598,17 +1598,14 @@ isp_mbox_wait_complete(struct ispsoftc *
 	microtime(&start);
 	if (isp->isp_osinfo.mbox_sleep_ok) {
 		int to;
-		struct timeval tv;
+		struct timeval tv, utv;
 
 		tv.tv_sec = 0;
 		tv.tv_usec = 0;
 		for (olim = 0; olim < maxc; olim++) {
-			tv.tv_sec += (usecs / 1000000);
-			tv.tv_usec += (usecs % 1000000);
-			if (tv.tv_usec >= 100000) {
-				tv.tv_sec++;
-				tv.tv_usec -= 1000000;
-			}
+			utv.tv_sec = 0;
+			utv.tv_usec = usecs;
+			timeradd(&tv, &utv, &tv);
 		}
 		timeradd(&tv, &start, &tv);
 		to = tvhzto(&tv);

Reply via email to