Module Name: src Committed By: dyoung Date: Thu Nov 8 20:43:55 UTC 2012
Modified Files: src/sys/dev/ic: ath.c ath_netbsd.h athrate-amrr.c athrate-onoe.c athrate-sample.c athrate-sample.h Log Message: Use NetBSD's own KASSERT() and KASSERTMSG() instead of #undef and re-#defining KASSERT(), which is awkward at best. To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/sys/dev/ic/ath.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/ath_netbsd.h cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/athrate-amrr.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/athrate-onoe.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/athrate-sample.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/athrate-sample.h 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/ath.c diff -u src/sys/dev/ic/ath.c:1.113 src/sys/dev/ic/ath.c:1.114 --- src/sys/dev/ic/ath.c:1.113 Mon Nov 28 00:30:17 2011 +++ src/sys/dev/ic/ath.c Thu Nov 8 20:43:55 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ath.c,v 1.113 2011/11/28 00:30:17 jmcneill Exp $ */ +/* $NetBSD: ath.c,v 1.114 2012/11/08 20:43:55 dyoung Exp $ */ /*- * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.104 2005/09/16 10:09:23 ru Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.113 2011/11/28 00:30:17 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.114 2012/11/08 20:43:55 dyoung Exp $"); #endif /* @@ -878,8 +878,8 @@ ath_bmiss_proc(void *arg, int pending) struct ieee80211com *ic = &sc->sc_ic; DPRINTF(sc, ATH_DEBUG_ANY, "%s: pending %u\n", __func__, pending); - KASSERT(ic->ic_opmode == IEEE80211_M_STA, - ("unexpect operating mode %u", ic->ic_opmode)); + KASSERTMSG(ic->ic_opmode == IEEE80211_M_STA, + "unexpect operating mode %u", ic->ic_opmode); if (ic->ic_state == IEEE80211_S_RUN) { u_int64_t lastrx = sc->sc_lastrx; u_int64_t tsf = ath_hal_gettsf64(sc->sc_ah); @@ -940,8 +940,8 @@ ath_chan2flags(struct ieee80211com *ic, }; enum ieee80211_phymode mode = ieee80211_chan2mode(ic, chan); - KASSERT(mode < N(modeflags), ("unexpected phy mode %u", mode)); - KASSERT(modeflags[mode] != 0, ("mode %u undefined", mode)); + KASSERTMSG(mode < N(modeflags), "unexpected phy mode %u", mode); + KASSERTMSG(modeflags[mode] != 0, "mode %u undefined", mode); return modeflags[mode]; #undef N } @@ -1432,7 +1432,7 @@ ath_start(struct ifnet *ifp) if (next != NULL) { m = next; bf = STAILQ_FIRST(&frags); - KASSERT(bf != NULL, ("no buf for txfrag")); + KASSERTMSG(bf != NULL, "no buf for txfrag"); STAILQ_REMOVE_HEAD(&frags, bf_list); goto nextfrag; } @@ -1499,8 +1499,8 @@ ath_keyset_tkip(struct ath_softc *sc, co static const u_int8_t zerobssid[IEEE80211_ADDR_LEN]; struct ath_hal *ah = sc->sc_ah; - KASSERT(k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP, - ("got a non-TKIP key, cipher %u", k->wk_cipher->ic_cipher)); + KASSERTMSG(k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP, + "got a non-TKIP key, cipher %u", k->wk_cipher->ic_cipher); if ((k->wk_flags & IEEE80211_KEY_XR) == IEEE80211_KEY_XR) { if (sc->sc_splitmic) { /* @@ -1582,8 +1582,8 @@ ath_keyset(struct ath_softc *sc, const s * so that rx frames have an entry to match. */ if ((k->wk_flags & IEEE80211_KEY_SWCRYPT) == 0) { - KASSERT(cip->ic_cipher < N(ciphermap), - ("invalid cipher type %u", cip->ic_cipher)); + KASSERTMSG(cip->ic_cipher < N(ciphermap), + "invalid cipher type %u", cip->ic_cipher); hk.kv_type = ciphermap[cip->ic_cipher]; hk.kv_len = k->wk_keylen; memcpy(hk.kv_val, k->wk_key, k->wk_keylen); @@ -1623,7 +1623,7 @@ key_alloc_2pair(struct ath_softc *sc, #define N(a) (sizeof(a)/sizeof(a[0])) u_int i, keyix; - KASSERT(sc->sc_splitmic, ("key cache !split")); + KASSERTMSG(sc->sc_splitmic, "key cache !split"); /* XXX could optimize */ for (i = 0; i < N(sc->sc_keymap)/4; i++) { u_int8_t b = sc->sc_keymap[i]; @@ -1678,7 +1678,7 @@ key_alloc_pair(struct ath_softc *sc, iee #define N(a) (sizeof(a)/sizeof(a[0])) u_int i, keyix; - KASSERT(!sc->sc_splitmic, ("key cache split")); + KASSERTMSG(!sc->sc_splitmic, "key cache split"); /* XXX could optimize */ for (i = 0; i < N(sc->sc_keymap)/4; i++) { uint8_t b = sc->sc_keymap[i]; @@ -2195,8 +2195,8 @@ ath_beacon_setup(struct ath_softc *sc, s antenna = sc->sc_txantenna; } - KASSERT(bf->bf_nseg == 1, - ("multi-segment beacon frame; nseg %u", bf->bf_nseg)); + KASSERTMSG(bf->bf_nseg == 1, + "multi-segment beacon frame; nseg %u", bf->bf_nseg); ds->ds_data = bf->bf_segs[0].ds_addr; /* * Calculate rate code. @@ -2850,8 +2850,8 @@ ath_rxbuf_init(struct ath_softc *sc, str sc->sc_stats.ast_rx_busdma++; return error; } - KASSERT(bf->bf_nseg == 1, - ("multi-segment packet; nseg %u", bf->bf_nseg)); + KASSERTMSG(bf->bf_nseg == 1, + "multi-segment packet; nseg %u", bf->bf_nseg); } bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap, 0, bf->bf_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD); @@ -3484,8 +3484,8 @@ again: } else m = n; } - KASSERT(maxfrags > 1, - ("maxfrags %u, but normal collapse failed", maxfrags)); + KASSERTMSG(maxfrags > 1, + "maxfrags %u, but normal collapse failed", maxfrags); /* * Collapse consecutive mbufs to a cluster. */ @@ -3679,8 +3679,8 @@ ath_tx_start(struct ath_softc *sc, struc ath_freetx(m0); return error; } - KASSERT(bf->bf_nseg <= ATH_TXDESC, - ("too many segments after defrag; nseg %u", bf->bf_nseg)); + KASSERTMSG(bf->bf_nseg <= ATH_TXDESC, + "too many segments after defrag; nseg %u", bf->bf_nseg); } else if (bf->bf_nseg == 0) { /* null packet, discard */ sc->sc_stats.ast_tx_nodata++; ath_freetx(m0); @@ -3695,7 +3695,7 @@ ath_tx_start(struct ath_softc *sc, struc /* setup descriptors */ ds = bf->bf_desc; rt = sc->sc_currates; - KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); + KASSERTMSG(rt != NULL, "no rate table, mode %u", sc->sc_curmode); /* * NB: the 802.11 layer marks whether or not we should @@ -3862,7 +3862,7 @@ ath_tx_start(struct ath_softc *sc, struc dur = rt->info[rix].lpAckDuration; if (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG) { dur += dur; /* additional SIFS+ACK */ - KASSERT(m0->m_nextpkt != NULL, ("no fragment")); + KASSERTMSG(m0->m_nextpkt != NULL, "no fragment"); /* * Include the size of next fragment so NAV is * updated properly. The last fragment uses only @@ -3896,7 +3896,7 @@ ath_tx_start(struct ath_softc *sc, struc * in whether or not a short preamble is to be used. */ /* NB: cix is set above where RTS/CTS is enabled */ - KASSERT(cix != 0xff, ("cix not setup")); + KASSERTMSG(cix != 0xff, "cix not setup"); ctsrate = rt->info[cix].rateCode; /* * Compute the transmit duration based on the frame @@ -4640,8 +4640,9 @@ ath_calibrate(void *arg) if (sc->sc_calinterval > ath_calinterval) sc->sc_calinterval = ath_calinterval; } - KASSERT(0 < sc->sc_calinterval && sc->sc_calinterval <= ath_calinterval, - ("bad calibration interval %u", sc->sc_calinterval)); + KASSERTMSG(0 < sc->sc_calinterval && + sc->sc_calinterval <= ath_calinterval, + "bad calibration interval %u", sc->sc_calinterval); DPRINTF(sc, ATH_DEBUG_CALIBRATE, "%s: next +%u (%siqCalDone tries %u)\n", __func__, @@ -4864,9 +4865,9 @@ ath_newassoc(struct ieee80211_node *ni, ath_rate_newassoc(sc, ATH_NODE(ni), isnew); if (isnew && (ic->ic_flags & IEEE80211_F_PRIVACY) == 0 && sc->sc_hasclrkey) { - KASSERT(ni->ni_ucastkey.wk_keyix == IEEE80211_KEYIX_NONE, - ("new assoc with a unicast key already setup (keyix %u)", - ni->ni_ucastkey.wk_keyix)); + KASSERTMSG(ni->ni_ucastkey.wk_keyix == IEEE80211_KEYIX_NONE, + "new assoc with a unicast key already setup (keyix %u)", + ni->ni_ucastkey.wk_keyix); ath_setup_stationkey(ni); } } @@ -5107,7 +5108,7 @@ ath_setcurmode(struct ath_softc *sc, enu memset(sc->sc_rixmap, 0xff, sizeof(sc->sc_rixmap)); rt = sc->sc_rates[mode]; - KASSERT(rt != NULL, ("no h/w rate set for phy mode %u", mode)); + KASSERTMSG(rt != NULL, "no h/w rate set for phy mode %u", mode); for (i = 0; i < rt->rateCount; i++) sc->sc_rixmap[rt->info[i].dot11Rate & IEEE80211_RATE_VAL] = i; memset(sc->sc_hwmap, 0, sizeof(sc->sc_hwmap)); Index: src/sys/dev/ic/ath_netbsd.h diff -u src/sys/dev/ic/ath_netbsd.h:1.13 src/sys/dev/ic/ath_netbsd.h:1.14 --- src/sys/dev/ic/ath_netbsd.h:1.13 Sat Jun 2 21:36:44 2012 +++ src/sys/dev/ic/ath_netbsd.h Thu Nov 8 20:43:55 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ath_netbsd.h,v 1.13 2012/06/02 21:36:44 dsl Exp $ */ +/* $NetBSD: ath_netbsd.h,v 1.14 2012/11/08 20:43:55 dyoung Exp $ */ /*- * Copyright (c) 2003, 2004 David Young @@ -29,9 +29,6 @@ #include <sys/sysctl.h> -#undef KASSERT -#define KASSERT(__cond, __complaint) if (!(__cond)) panic __complaint - typedef struct ath_task { void (*t_func)(void*, int); void *t_context; @@ -53,14 +50,14 @@ typedef kmutex_t ath_txq_lock_t; #define ATH_TXQ_LOCK_DESTROY(_tq) mutex_destroy(&(_tq)->axq_lock) #define ATH_TXQ_LOCK(_tq) mutex_enter(&(_tq)->axq_lock) #define ATH_TXQ_UNLOCK(_tq) mutex_exit(&(_tq)->axq_lock) -#define ATH_TXQ_LOCK_ASSERT(_tq) do { KASSERT(mutex_owned(&(_tq)->axq_lock), ("txq lock unheld")); } while (/*CONSTCOND*/true) +#define ATH_TXQ_LOCK_ASSERT(_tq) do { KASSERTMSG(mutex_owned(&(_tq)->axq_lock), "txq lock unheld"); } while (/*CONSTCOND*/true) typedef kmutex_t ath_txbuf_lock_t; #define ATH_TXBUF_LOCK_INIT(_sc) mutex_init(&(_sc)->sc_txbuflock, MUTEX_DEFAULT, IPL_NET) #define ATH_TXBUF_LOCK_DESTROY(_sc) mutex_destroy(&(_sc)->sc_txbuflock) #define ATH_TXBUF_LOCK(_sc) mutex_enter(&(_sc)->sc_txbuflock) #define ATH_TXBUF_UNLOCK(_sc) mutex_exit(&(_sc)->sc_txbuflock) -#define ATH_TXBUF_LOCK_ASSERT(_sc) do { KASSERT(mutex_owned(&(_sc)->sc_txbuflock), ("txbuf lock unheld")); } while (/*CONSTCOND*/true) +#define ATH_TXBUF_LOCK_ASSERT(_sc) do { KASSERTMSG(mutex_owned(&(_sc)->sc_txbuflock), "txbuf lock unheld"); } while (/*CONSTCOND*/true) #define NET_LOCK_GIANT() #define NET_UNLOCK_GIANT() Index: src/sys/dev/ic/athrate-amrr.c diff -u src/sys/dev/ic/athrate-amrr.c:1.11 src/sys/dev/ic/athrate-amrr.c:1.12 --- src/sys/dev/ic/athrate-amrr.c:1.11 Thu Dec 11 05:45:29 2008 +++ src/sys/dev/ic/athrate-amrr.c Thu Nov 8 20:43:55 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: athrate-amrr.c,v 1.11 2008/12/11 05:45:29 alc Exp $ */ +/* $NetBSD: athrate-amrr.c,v 1.12 2012/11/08 20:43:55 dyoung Exp $ */ /*- * Copyright (c) 2004 INRIA @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/amrr/amrr.c,v 1.10 2005/08/09 10:19:43 rwatson Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: athrate-amrr.c,v 1.11 2008/12/11 05:45:29 alc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: athrate-amrr.c,v 1.12 2012/11/08 20:43:55 dyoung Exp $"); #endif /* @@ -202,7 +202,7 @@ ath_rate_update(struct ath_softc *sc, st const HAL_RATE_TABLE *rt = sc->sc_currates; u_int8_t rix; - KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); + KASSERTMSG(rt != NULL, "no rate table, mode %u", sc->sc_curmode); DPRINTF(sc, "%s: set xmit rate for %s to %dM\n", __func__, ether_sprintf(ni->ni_macaddr), @@ -280,7 +280,7 @@ ath_rate_ctl_start(struct ath_softc *sc, struct ieee80211com *ic = &sc->sc_ic; int srate; - KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates")); + KASSERTMSG(ni->ni_rates.rs_nrates > 0, "no rates"); if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE) { /* * No fixed rate is requested. For 11b start with @@ -296,7 +296,7 @@ ath_rate_ctl_start(struct ath_softc *sc, /* NB: the rate set is assumed sorted */ for (; srate >= 0 && RATE(srate) > 72; srate--) ; - KASSERT(srate >= 0, ("bogus rate set")); + KASSERTMSG(srate >= 0, "bogus rate set"); } } else { /* @@ -313,8 +313,8 @@ ath_rate_ctl_start(struct ath_softc *sc, srate = ni->ni_rates.rs_nrates - 1; for (; srate >= 0 && RATE(srate) != r; srate--) ; - KASSERT(srate >= 0, - ("fixed rate %d not in rate set", ic->ic_fixed_rate)); + KASSERTMSG(srate >= 0, + "fixed rate %d not in rate set", ic->ic_fixed_rate); } ath_rate_update(sc, ni, srate); #undef RATE Index: src/sys/dev/ic/athrate-onoe.c diff -u src/sys/dev/ic/athrate-onoe.c:1.14 src/sys/dev/ic/athrate-onoe.c:1.15 --- src/sys/dev/ic/athrate-onoe.c:1.14 Fri Mar 27 16:10:50 2009 +++ src/sys/dev/ic/athrate-onoe.c Thu Nov 8 20:43:55 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: athrate-onoe.c,v 1.14 2009/03/27 16:10:50 dyoung Exp $ */ +/* $NetBSD: athrate-onoe.c,v 1.15 2012/11/08 20:43:55 dyoung Exp $ */ /*- * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/onoe/onoe.c,v 1.10 2005/08/09 10:19:43 rwatson Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: athrate-onoe.c,v 1.14 2009/03/27 16:10:50 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: athrate-onoe.c,v 1.15 2012/11/08 20:43:55 dyoung Exp $"); #endif /* @@ -192,7 +192,7 @@ ath_rate_update(struct ath_softc *sc, st const HAL_RATE_TABLE *rt = sc->sc_currates; u_int8_t rix; - KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); + KASSERTMSG(rt != NULL, "no rate table, mode %u", sc->sc_curmode); DPRINTF(sc, "%s: set xmit rate for %s to %dM\n", __func__, ether_sprintf(ni->ni_macaddr), @@ -270,7 +270,7 @@ ath_rate_ctl_start(struct ath_softc *sc, struct ieee80211com *ic = &sc->sc_ic; int srate; - KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates")); + KASSERTMSG(ni->ni_rates.rs_nrates > 0, "no rates"); if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE) { /* * No fixed rate is requested. For 11b start with @@ -286,7 +286,7 @@ ath_rate_ctl_start(struct ath_softc *sc, /* NB: the rate set is assumed sorted */ for (; srate >= 0 && RATE(srate) > 72; srate--) ; - KASSERT(srate >= 0, ("bogus rate set")); + KASSERTMSG(srate >= 0, "bogus rate set"); } } else { /* @@ -303,8 +303,8 @@ ath_rate_ctl_start(struct ath_softc *sc, srate = ni->ni_rates.rs_nrates - 1; for (; srate >= 0 && RATE(srate) != r; srate--) ; - KASSERT(srate >= 0, - ("fixed rate %d not in rate set", ic->ic_fixed_rate)); + KASSERTMSG(srate >= 0, + "fixed rate %d not in rate set", ic->ic_fixed_rate); } ath_rate_update(sc, ni, srate); #undef RATE Index: src/sys/dev/ic/athrate-sample.c diff -u src/sys/dev/ic/athrate-sample.c:1.18 src/sys/dev/ic/athrate-sample.c:1.19 --- src/sys/dev/ic/athrate-sample.c:1.18 Sun Feb 20 03:55:56 2011 +++ src/sys/dev/ic/athrate-sample.c Thu Nov 8 20:43:55 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: athrate-sample.c,v 1.18 2011/02/20 03:55:56 jmcneill Exp $ */ +/* $NetBSD: athrate-sample.c,v 1.19 2012/11/08 20:43:55 dyoung Exp $ */ /*- * Copyright (c) 2005 John Bicket @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/sample/sample.c,v 1.9 2005/07/22 16:50:17 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: athrate-sample.c,v 1.18 2011/02/20 03:55:56 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: athrate-sample.c,v 1.19 2012/11/08 20:43:55 dyoung Exp $"); #endif @@ -351,7 +351,7 @@ ath_rate_findrate(struct ath_softc *sc, } } - KASSERT(ndx >= 0 && ndx < sn->num_rates, ("ndx is %d", ndx)); + KASSERTMSG(ndx >= 0 && ndx < sn->num_rates, "ndx is %d", ndx); *rix = sn->rates[ndx].rix; if (shortPreamble) { @@ -654,7 +654,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, const HAL_RATE_TABLE *rt = sc->sc_currates; int x, y, srate; - KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); + KASSERTMSG(rt != NULL, "no rate table, mode %u", sc->sc_curmode); sn->static_rate_ndx = -1; if (ic->ic_fixed_rate != IEEE80211_FIXED_RATE_NONE) { /* @@ -671,8 +671,8 @@ ath_rate_ctl_reset(struct ath_softc *sc, srate = ni->ni_rates.rs_nrates - 1; for (; srate >= 0 && RATE(srate) != r; srate--) ; - KASSERT(srate >= 0, - ("fixed rate %d not in rate set", ic->ic_fixed_rate)); + KASSERTMSG(srate >= 0, + "fixed rate %d not in rate set", ic->ic_fixed_rate); sn->static_rate_ndx = srate; } Index: src/sys/dev/ic/athrate-sample.h diff -u src/sys/dev/ic/athrate-sample.h:1.3 src/sys/dev/ic/athrate-sample.h:1.4 --- src/sys/dev/ic/athrate-sample.h:1.3 Thu Mar 2 03:38:45 2006 +++ src/sys/dev/ic/athrate-sample.h Thu Nov 8 20:43:55 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: athrate-sample.h,v 1.3 2006/03/02 03:38:45 dyoung Exp $ */ +/* $NetBSD: athrate-sample.h,v 1.4 2012/11/08 20:43:55 dyoung Exp $ */ /*- * Copyright (c) 2005 John Bicket @@ -199,7 +199,7 @@ static unsigned calc_usecs_unicast_packe int cw = WIFI_CW_MIN; int cix = rt->info[rix].controlRate; - KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); + KASSERTMSG(rt != NULL, "no rate table, mode %u", sc->sc_curmode); if (!rt->info[rix].rateKbps) { printf("rix %d (%d) bad ratekbps %d mode %u",