aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ral
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2015-09-22 02:44:59 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2015-09-22 02:44:59 +0000
commitd6166def28d0af3917cb08ae9f7c4974927e3cbe (patch)
tree3a012e5662121dbe0100d03ff4e42e00b0579eda /sys/dev/ral
parent0ebe104f961a26c63ac904772876df682e4131e8 (diff)
downloadsrc-d6166def28d0af3917cb08ae9f7c4974927e3cbe.tar.gz
src-d6166def28d0af3917cb08ae9f7c4974927e3cbe.zip
Notes
Diffstat (limited to 'sys/dev/ral')
-rw-r--r--sys/dev/ral/rt2560.c13
-rw-r--r--sys/dev/ral/rt2661.c15
-rw-r--r--sys/dev/ral/rt2860.c5
3 files changed, 11 insertions, 22 deletions
diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c
index ea9c4162b8f8..07fe55e80a36 100644
--- a/sys/dev/ral/rt2560.c
+++ b/sys/dev/ral/rt2560.c
@@ -2301,7 +2301,6 @@ static void
rt2560_set_basicrates(struct rt2560_softc *sc,
const struct ieee80211_rateset *rs)
{
-#define RV(r) ((r) & IEEE80211_RATE_VAL)
struct ieee80211com *ic = &sc->sc_ic;
uint32_t mask = 0;
uint8_t rate;
@@ -2313,13 +2312,13 @@ rt2560_set_basicrates(struct rt2560_softc *sc,
if (!(rate & IEEE80211_RATE_BASIC))
continue;
- mask |= 1 << ieee80211_legacy_rate_lookup(ic->ic_rt, RV(rate));
+ mask |= 1 << ieee80211_legacy_rate_lookup(ic->ic_rt,
+ IEEE80211_RV(rate));
}
RAL_WRITE(sc, RT2560_ARSP_PLCP_1, mask);
DPRINTF(sc, "Setting basic rate mask to 0x%x\n", mask);
-#undef RV
}
static void
@@ -2478,7 +2477,6 @@ rt2560_scan_end(struct ieee80211com *ic)
static int
rt2560_bbp_init(struct rt2560_softc *sc)
{
-#define N(a) (sizeof (a) / sizeof ((a)[0]))
int i, ntries;
/* wait for BBP to be ready */
@@ -2493,7 +2491,7 @@ rt2560_bbp_init(struct rt2560_softc *sc)
}
/* initialize BBP registers to default values */
- for (i = 0; i < N(rt2560_def_bbp); i++) {
+ for (i = 0; i < nitems(rt2560_def_bbp); i++) {
rt2560_bbp_write(sc, rt2560_def_bbp[i].reg,
rt2560_def_bbp[i].val);
}
@@ -2507,7 +2505,6 @@ rt2560_bbp_init(struct rt2560_softc *sc)
rt2560_bbp_write(sc, 17, 0x48); /* XXX restore bbp17 */
return 0;
-#undef N
}
static void
@@ -2560,7 +2557,6 @@ rt2560_set_rxantenna(struct rt2560_softc *sc, int antenna)
static void
rt2560_init_locked(struct rt2560_softc *sc)
{
-#define N(a) (sizeof (a) / sizeof ((a)[0]))
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
uint32_t tmp;
@@ -2590,7 +2586,7 @@ rt2560_init_locked(struct rt2560_softc *sc)
RAL_WRITE(sc, RT2560_RXCSR2, sc->rxq.physaddr);
/* initialize MAC registers to default values */
- for (i = 0; i < N(rt2560_def_mac); i++)
+ for (i = 0; i < nitems(rt2560_def_mac); i++)
RAL_WRITE(sc, rt2560_def_mac[i].reg, rt2560_def_mac[i].val);
rt2560_set_macaddr(sc, vap ? vap->iv_myaddr : ic->ic_macaddr);
@@ -2641,7 +2637,6 @@ rt2560_init_locked(struct rt2560_softc *sc)
sc->sc_flags |= RT2560_F_RUNNING;
callout_reset(&sc->watchdog_ch, hz, rt2560_watchdog, sc);
-#undef N
}
static void
diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c
index c77d4f88df76..211cf773e83b 100644
--- a/sys/dev/ral/rt2661.c
+++ b/sys/dev/ral/rt2661.c
@@ -1859,7 +1859,6 @@ static void
rt2661_set_basicrates(struct rt2661_softc *sc,
const struct ieee80211_rateset *rs)
{
-#define RV(r) ((r) & IEEE80211_RATE_VAL)
struct ieee80211com *ic = &sc->sc_ic;
uint32_t mask = 0;
uint8_t rate;
@@ -1871,13 +1870,13 @@ rt2661_set_basicrates(struct rt2661_softc *sc,
if (!(rate & IEEE80211_RATE_BASIC))
continue;
- mask |= 1 << ieee80211_legacy_rate_lookup(ic->ic_rt, RV(rate));
+ mask |= 1 << ieee80211_legacy_rate_lookup(ic->ic_rt,
+ IEEE80211_RV(rate));
}
RAL_WRITE(sc, RT2661_TXRX_CSR5, mask);
DPRINTF(sc, "Setting basic rate mask to 0x%x\n", mask);
-#undef RV
}
/*
@@ -2208,7 +2207,6 @@ rt2661_read_eeprom(struct rt2661_softc *sc, uint8_t macaddr[IEEE80211_ADDR_LEN])
static int
rt2661_bbp_init(struct rt2661_softc *sc)
{
-#define N(a) (sizeof (a) / sizeof ((a)[0]))
int i, ntries;
uint8_t val;
@@ -2225,7 +2223,7 @@ rt2661_bbp_init(struct rt2661_softc *sc)
}
/* initialize BBP registers to default values */
- for (i = 0; i < N(rt2661_def_bbp); i++) {
+ for (i = 0; i < nitems(rt2661_def_bbp); i++) {
rt2661_bbp_write(sc, rt2661_def_bbp[i].reg,
rt2661_def_bbp[i].val);
}
@@ -2238,13 +2236,11 @@ rt2661_bbp_init(struct rt2661_softc *sc)
}
return 0;
-#undef N
}
static void
rt2661_init_locked(struct rt2661_softc *sc)
{
-#define N(a) (sizeof (a) / sizeof ((a)[0]))
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
uint32_t tmp, sta[3];
@@ -2305,7 +2301,7 @@ rt2661_init_locked(struct rt2661_softc *sc)
RAL_WRITE(sc, RT2661_RX_CNTL_CSR, 2);
/* initialize MAC registers to default values */
- for (i = 0; i < N(rt2661_def_mac); i++)
+ for (i = 0; i < nitems(rt2661_def_mac); i++)
RAL_WRITE(sc, rt2661_def_mac[i].reg, rt2661_def_mac[i].val);
rt2661_set_macaddr(sc, vap ? vap->iv_myaddr : ic->ic_macaddr);
@@ -2354,7 +2350,7 @@ rt2661_init_locked(struct rt2661_softc *sc)
RAL_WRITE(sc, RT2661_TXRX_CSR0, tmp);
/* clear STA registers */
- RAL_READ_REGION_4(sc, RT2661_STA_CSR0, sta, N(sta));
+ RAL_READ_REGION_4(sc, RT2661_STA_CSR0, sta, nitems(sta));
/* initialize ASIC */
RAL_WRITE(sc, RT2661_MAC_CSR1, 4);
@@ -2372,7 +2368,6 @@ rt2661_init_locked(struct rt2661_softc *sc)
sc->sc_flags |= RAL_RUNNING;
callout_reset(&sc->watchdog_ch, hz, rt2661_watchdog, sc);
-#undef N
}
static void
diff --git a/sys/dev/ral/rt2860.c b/sys/dev/ral/rt2860.c
index 48c3ed8c88f5..9ef83b6fad22 100644
--- a/sys/dev/ral/rt2860.c
+++ b/sys/dev/ral/rt2860.c
@@ -2260,7 +2260,6 @@ void
rt2860_set_basicrates(struct rt2860_softc *sc,
const struct ieee80211_rateset *rs)
{
-#define RV(r) ((r) & IEEE80211_RATE_VAL)
struct ieee80211com *ic = &sc->sc_ic;
uint32_t mask = 0;
uint8_t rate;
@@ -2272,11 +2271,11 @@ rt2860_set_basicrates(struct rt2860_softc *sc,
if (!(rate & IEEE80211_RATE_BASIC))
continue;
- mask |= 1 << ieee80211_legacy_rate_lookup(ic->ic_rt, RV(rate));
+ mask |= 1 << ieee80211_legacy_rate_lookup(ic->ic_rt,
+ IEEE80211_RV(rate));
}
RAL_WRITE(sc, RT2860_LEGACY_BASIC_RATE, mask);
-#undef RV
}
static void