Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Nov 2014 21:03:47 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r274675 - head/sys/dev/isp
Message-ID:  <201411182103.sAIL3leC063427@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue Nov 18 21:03:46 2014
New Revision: 274675
URL: https://svnweb.freebsd.org/changeset/base/274675

Log:
  Convert the refire_notify_ack timer from timeout(9) to callout(9).
  
  Tested by:	no one

Modified:
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_freebsd.h

Modified: head/sys/dev/isp/isp_freebsd.c
==============================================================================
--- head/sys/dev/isp/isp_freebsd.c	Tue Nov 18 18:52:38 2014	(r274674)
+++ head/sys/dev/isp/isp_freebsd.c	Tue Nov 18 21:03:46 2014	(r274675)
@@ -2137,9 +2137,9 @@ isp_refire_putback_atio(void *arg)
 {
 	union ccb *ccb = arg;
 	ispsoftc_t *isp = XS_ISP(ccb);
-	ISP_LOCK(isp);
+
+	ISP_ASSERT_LOCKED(isp);
 	isp_target_putback_atio(ccb);
-	ISP_UNLOCK(isp);
 }
 
 static void
@@ -2147,13 +2147,13 @@ isp_refire_notify_ack(void *arg)
 {
 	isp_tna_t *tp  = arg;
 	ispsoftc_t *isp = tp->isp;
-	ISP_LOCK(isp);
+
+	ISP_ASSERT_LOCKED(isp);
 	if (isp_notify_ack(isp, tp->not)) {
-		(void) timeout(isp_refire_notify_ack, tp, 5);
+		callout_schedule(&tp->timer, 5);
 	} else {
 		free(tp, M_DEVBUF);
 	}
-	ISP_UNLOCK(isp);
 }
 
 
@@ -2170,7 +2170,8 @@ isp_target_putback_atio(union ccb *ccb)
 	if (qe == NULL) {
 		xpt_print(ccb->ccb_h.path,
 		    "%s: Request Queue Overflow\n", __func__);
-		(void) timeout(isp_refire_putback_atio, ccb, 10);
+		callout_reset(&PISP_PCMD(ccb)->wdog, 10,
+		    isp_refire_putback_atio, ccb);
 		return;
 	}
 	memset(qe, 0, QENTRY_LEN);
@@ -5964,7 +5965,9 @@ isp_async(ispsoftc_t *isp, ispasync_t cm
 				} else {
 					tp->not = NULL;
 				}
-				(void) timeout(isp_refire_notify_ack, tp, 5);
+				callout_init_mtx(&tp->timer, &isp->isp_lock, 0);
+				callout_reset(&tp->timer, 5,
+				    isp_refire_notify_ack, tp);
 			} else {
 				isp_prt(isp, ISP_LOGERR, "you lose- cannot allocate a notify refire");
 			}

Modified: head/sys/dev/isp/isp_freebsd.h
==============================================================================
--- head/sys/dev/isp/isp_freebsd.h	Tue Nov 18 18:52:38 2014	(r274674)
+++ head/sys/dev/isp/isp_freebsd.h	Tue Nov 18 21:03:46 2014	(r274675)
@@ -158,6 +158,7 @@ typedef struct isp_timed_notify_ack {
 	void *isp;
 	void *not;
 	uint8_t data[64];	 /* sb QENTRY_LEN, but order of definitions is wrong */
+	struct callout timer;
 } isp_tna_t;
 
 TAILQ_HEAD(isp_ccbq, ccb_hdr);
@@ -401,6 +402,7 @@ struct isposinfo {
  */
 #define	ISP_LOCK(isp)	mtx_lock(&isp->isp_osinfo.lock)
 #define	ISP_UNLOCK(isp)	mtx_unlock(&isp->isp_osinfo.lock)
+#define	ISP_ASSERT_LOCKED(isp)	mtx_assert(&isp->isp_osinfo.lock, MA_OWNED)
 
 /*
  * Required Macros/Defines



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