summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_phy.c
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2013-08-14 04:24:25 +0000
committerrpaulo <rpaulo@FreeBSD.org>2013-08-14 04:24:25 +0000
commitb66e5efc0f138709337bda97b97422177187cf60 (patch)
treeaab84fc7202136670f336f52bd4cbf358edc91cf /sys/net80211/ieee80211_phy.c
parentcee1e037da7213db868bb6bfc99884926330de56 (diff)
downloadFreeBSD-src-b66e5efc0f138709337bda97b97422177187cf60.zip
FreeBSD-src-b66e5efc0f138709337bda97b97422177187cf60.tar.gz
Replace the homegrown implementation of nitems() with calls to nitems()
(param.h). Operating systems that don't have nitems() can easily define it on their own net80211 OS-specific header file. Discussed with: adrian
Diffstat (limited to 'sys/net80211/ieee80211_phy.c')
-rw-r--r--sys/net80211/ieee80211_phy.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sys/net80211/ieee80211_phy.c b/sys/net80211/ieee80211_phy.c
index d1924d8..923266c 100644
--- a/sys/net80211/ieee80211_phy.c
+++ b/sys/net80211/ieee80211_phy.c
@@ -294,13 +294,12 @@ static struct ieee80211_rate_table ieee80211_11na_table = {
static void
ieee80211_setup_ratetable(struct ieee80211_rate_table *rt)
{
-#define N(a) (sizeof(a)/sizeof(a[0]))
#define WLAN_CTRL_FRAME_SIZE \
(sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
int i;
- for (i = 0; i < N(rt->rateCodeToIndex); i++)
+ for (i = 0; i < nitems(rt->rateCodeToIndex); i++)
rt->rateCodeToIndex[i] = (uint8_t) -1;
for (i = 0; i < rt->rateCount; i++) {
uint8_t code = rt->info[i].dot11Rate;
@@ -341,14 +340,12 @@ ieee80211_setup_ratetable(struct ieee80211_rate_table *rt)
}
#undef WLAN_CTRL_FRAME_SIZE
-#undef N
}
/* Setup all rate tables */
static void
ieee80211_phy_init(void)
{
-#define N(arr) (int)(sizeof(arr) / sizeof(arr[0]))
static struct ieee80211_rate_table * const ratetables[] = {
&ieee80211_half_table,
&ieee80211_quarter_table,
@@ -362,10 +359,9 @@ ieee80211_phy_init(void)
};
int i;
- for (i = 0; i < N(ratetables); ++i)
+ for (i = 0; i < nitems(ratetables); ++i)
ieee80211_setup_ratetable(ratetables[i]);
-#undef N
}
SYSINIT(wlan_phy, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_phy_init, NULL);
OpenPOWER on IntegriCloud