diff options
-rw-r--r-- | sys/dev/fxp/if_fxp.c | 13 | ||||
-rw-r--r-- | sys/dev/fxp/if_fxpvar.h | 6 |
2 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index fd87125..9d6c8ea 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -863,7 +863,7 @@ fxp_release(struct fxp_softc *sc) struct fxp_tx *txp; int i; - mtx_assert(&sc->sc_mtx, MA_NOTOWNED); + FXP_LOCK_ASSERT(sc, MA_NOTOWNED); KASSERT(sc->ih == NULL, ("fxp_release() called with intr handle still active")); if (sc->miibus) @@ -1295,7 +1295,7 @@ fxp_start_body(struct ifnet *ifp) struct mbuf *mb_head; int error; - mtx_assert(&sc->sc_mtx, MA_OWNED); + FXP_LOCK_ASSERT(sc, MA_OWNED); /* * See if we need to suspend xmit until the multicast filter * has been reprogrammed (which can only be done at the head @@ -1634,7 +1634,7 @@ fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp, u_int8_t statack, struct fxp_rfa *rfa; int rnr = (statack & FXP_SCB_STATACK_RNR) ? 1 : 0; - mtx_assert(&sc->sc_mtx, MA_OWNED); + FXP_LOCK_ASSERT(sc, MA_OWNED); if (rnr) sc->rnr++; #ifdef DEVICE_POLLING @@ -1993,7 +1993,7 @@ fxp_init_body(struct fxp_softc *sc) struct fxp_cb_mcs *mcsp; int i, prm, s; - mtx_assert(&sc->sc_mtx, MA_OWNED); + FXP_LOCK_ASSERT(sc, MA_OWNED); s = splimp(); /* * Cancel any pending I/O @@ -2434,7 +2434,7 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) * Detaching causes us to call ioctl with the mutex owned. Preclude * that by saying we're busy if the lock is already held. */ - if (mtx_owned(&sc->sc_mtx)) + if (FXP_LOCKED(sc)) return (EBUSY); FXP_LOCK(sc); @@ -2517,7 +2517,7 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) FXP_UNLOCK(sc); error = ether_ioctl(ifp, command, data); } - if (mtx_owned(&sc->sc_mtx)) + if (FXP_LOCKED(sc)) FXP_UNLOCK(sc); splx(s); return (error); @@ -2579,6 +2579,7 @@ fxp_mc_setup(struct fxp_softc *sc) struct fxp_tx *txp; int count; + FXP_LOCK_ASSERT(sc, MA_OWNED); /* * If there are queued commands, we must wait until they are all * completed. If we are already waiting, then add a NOP command diff --git a/sys/dev/fxp/if_fxpvar.h b/sys/dev/fxp/if_fxpvar.h index 3471a83..8168bd3 100644 --- a/sys/dev/fxp/if_fxpvar.h +++ b/sys/dev/fxp/if_fxpvar.h @@ -104,15 +104,17 @@ #if __FreeBSD_version < 500000 #define FXP_LOCK(_sc) #define FXP_UNLOCK(_sc) +#define FXP_LOCKED(_sc) +#define FXP_LOCK_ASSERT(_sc, _what) #define INTR_MPSAFE 0 -#define mtx_owned(a) 0 -#define mtx_assert(a, b) #define mtx_init(a, b, c, d) #define mtx_destroy(a) struct mtx { int dummy; }; #else #define FXP_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define FXP_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define FXP_LOCKED(_sc) mtx_owned(&(_sc)->sc_mtx) +#define FXP_LOCK_ASSERT(_sc, _what) mtx_assert(&(_sc)->sc_mtx, (_what)) #endif /* |