Module Name: src Committed By: bouyer Date: Tue Aug 21 15:53:07 UTC 2012
Modified Files: src/sys/dev/ic: isp_netbsd.c Log Message: Properly fill the struct timeval before using it: a timeout in microseconds has to be converted to seconds and microseconds. Fix KASSERT("usec >= 0 && usec < 1000000") in tvtohz(). While there, simplify computation of to (avoids a timersub() in tvhzto() and directly call tvtohz() with the interval). To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 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.85 src/sys/dev/ic/isp_netbsd.c:1.86 --- src/sys/dev/ic/isp_netbsd.c:1.85 Mon Dec 12 18:28:34 2011 +++ src/sys/dev/ic/isp_netbsd.c Tue Aug 21 15:53:07 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: isp_netbsd.c,v 1.85 2011/12/12 18:28:34 jdc Exp $ */ +/* $NetBSD: isp_netbsd.c,v 1.86 2012/08/21 15:53:07 bouyer 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.85 2011/12/12 18:28:34 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.86 2012/08/21 15:53:07 bouyer Exp $"); #include <dev/ic/isp_netbsd.h> #include <dev/ic/isp_ioctl.h> @@ -1603,14 +1603,14 @@ isp_mbox_wait_complete(struct ispsoftc * tv.tv_sec = 0; tv.tv_usec = 0; for (olim = 0; olim < maxc; olim++) { - utv.tv_sec = 0; - utv.tv_usec = usecs; + utv.tv_sec = usecs / 1000000; + utv.tv_usec = usecs % 1000000; timeradd(&tv, &utv, &tv); } - timeradd(&tv, &start, &tv); - to = tvhzto(&tv); + to = tvtohz(&tv); if (to == 0) to = 1; + timeradd(&tv, &start, &tv); isp->isp_osinfo.mbox_sleep_ok = 0; isp->isp_osinfo.mbox_sleeping = 1;