]> xenbits.xensource.com Git - people/liuw/freebsd.git/commitdiff
Rework r290504.
authormav <mav@FreeBSD.org>
Sat, 7 Nov 2015 19:33:57 +0000 (19:33 +0000)
committermav <mav@FreeBSD.org>
Sat, 7 Nov 2015 19:33:57 +0000 (19:33 +0000)
sys/dev/isp/isp.c
sys/dev/isp/isp_freebsd.h

index 149c2beb25fc62bed3dd68bb3664aa88944b2e81..9b8ce725edb4cc26c495da37e042239d1acd80e7 100644 (file)
@@ -2774,7 +2774,7 @@ isp_fclink_test(ispsoftc_t *isp, int chan, int usdelay)
         */
        lwfs = FW_CONFIG_WAIT;
        GET_NANOTIME(&hra);
-       do {
+       while (1) {
                isp_fw_state(isp, chan);
                if (lwfs != fcp->isp_fwstate) {
                        isp_prt(isp, ISP_LOGCONFIG|ISP_LOG_SANCFG, "Chan %d Firmware State <%s->%s>", chan, isp_fc_fw_statename((int)lwfs), isp_fc_fw_statename((int)fcp->isp_fwstate));
@@ -2783,9 +2783,11 @@ isp_fclink_test(ispsoftc_t *isp, int chan, int usdelay)
                if (fcp->isp_fwstate == FW_READY) {
                        break;
                }
-               ISP_SLEEP(isp, 1000);
                GET_NANOTIME(&hrb);
-       } while (NANOTIME_SUB(&hrb, &hra) / 1000 < usdelay);
+               if ((NANOTIME_SUB(&hrb, &hra) / 1000 + 1000 >= usdelay))
+                       break;
+               ISP_SLEEP(isp, 1000);
+       }
 
        /*
         * If we haven't gone to 'ready' state, return.
index 14b1e59722db1b49bab45d157fb675988df08966..4215274e898c4ce2990aa808590cad8ef0f3e237 100644 (file)
@@ -401,10 +401,10 @@ struct isposinfo {
 #define        ISP_SNPRINTF            snprintf
 #define        ISP_DELAY(x)            DELAY(x)
 #if __FreeBSD_version < 1000029
-#define        ISP_SLEEP(isp, x)       msleep(&(isp)->isp_osinfo.lock, \
+#define        ISP_SLEEP(isp, x)       msleep(&(isp)->isp_osinfo.is_exiting, \
     &(isp)->isp_osinfo.lock, 0, "isp_sleep", ((x) + tick - 1) / tick)
 #else
-#define        ISP_SLEEP(isp, x)       msleep_sbt(&(isp)->isp_osinfo.lock, \
+#define        ISP_SLEEP(isp, x)       msleep_sbt(&(isp)->isp_osinfo.is_exiting, \
     &(isp)->isp_osinfo.lock, 0, "isp_sleep", (x) * SBT_1US, 0, 0)
 #endif