diff options
Diffstat (limited to 'sys/dev/bwi/bwiphy.c')
-rw-r--r-- | sys/dev/bwi/bwiphy.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/sys/dev/bwi/bwiphy.c b/sys/dev/bwi/bwiphy.c index 60d6bf569baf..60afb191d240 100644 --- a/sys/dev/bwi/bwiphy.c +++ b/sys/dev/bwi/bwiphy.c @@ -185,19 +185,17 @@ bwi_phy_attach(struct bwi_mac *mac) phy->phy_tbl_data_hi = BWI_PHYR_TBL_DATA_HI_11A; break; case BWI_PHYINFO_TYPE_11B: -#define N(arr) (int)(sizeof(arr) / sizeof(arr[0])) - for (i = 0; i < N(bwi_sup_bphy); ++i) { + for (i = 0; i < nitems(bwi_sup_bphy); ++i) { if (phyrev == bwi_sup_bphy[i].rev) { phy->phy_init = bwi_sup_bphy[i].init; break; } } - if (i == N(bwi_sup_bphy)) { + if (i == nitems(bwi_sup_bphy)) { device_printf(sc->sc_dev, "unsupported 11B PHY, " "rev %u\n", phyrev); return ENXIO; } -#undef N phy->phy_mode = IEEE80211_MODE_11B; break; case BWI_PHYINFO_TYPE_11G: @@ -745,8 +743,6 @@ bwi_phy_init_11b_rev6(struct bwi_mac *mac) } } -#define N(arr) (int)(sizeof(arr) / sizeof(arr[0])) - static void bwi_phy_config_11g(struct bwi_mac *mac) { @@ -763,19 +759,19 @@ bwi_phy_config_11g(struct bwi_mac *mac) PHY_WRITE(mac, 0x427, 0x1a); /* Fill frequency table */ - for (i = 0; i < N(bwi_phy_freq_11g_rev1); ++i) { + for (i = 0; i < nitems(bwi_phy_freq_11g_rev1); ++i) { bwi_tbl_write_2(mac, BWI_PHYTBL_FREQ + i, bwi_phy_freq_11g_rev1[i]); } /* Fill noise table */ - for (i = 0; i < N(bwi_phy_noise_11g_rev1); ++i) { + for (i = 0; i < nitems(bwi_phy_noise_11g_rev1); ++i) { bwi_tbl_write_2(mac, BWI_PHYTBL_NOISE + i, bwi_phy_noise_11g_rev1[i]); } /* Fill rotor table */ - for (i = 0; i < N(bwi_phy_rotor_11g_rev1); ++i) { + for (i = 0; i < nitems(bwi_phy_rotor_11g_rev1); ++i) { /* NB: data length is 4 bytes */ bwi_tbl_write_4(mac, BWI_PHYTBL_ROTOR + i, bwi_phy_rotor_11g_rev1[i]); @@ -798,7 +794,7 @@ bwi_phy_config_11g(struct bwi_mac *mac) bwi_tbl_write_2(mac, BWI_PHYTBL_RSSI + i, i); /* Fill noise table */ - for (i = 0; i < N(bwi_phy_noise_11g); ++i) { + for (i = 0; i < nitems(bwi_phy_noise_11g); ++i) { bwi_tbl_write_2(mac, BWI_PHYTBL_NOISE + i, bwi_phy_noise_11g[i]); } @@ -809,13 +805,13 @@ bwi_phy_config_11g(struct bwi_mac *mac) */ if (phy->phy_rev <= 2) { tbl = bwi_phy_noise_scale_11g_rev2; - n = N(bwi_phy_noise_scale_11g_rev2); + n = nitems(bwi_phy_noise_scale_11g_rev2); } else if (phy->phy_rev >= 7 && (PHY_READ(mac, 0x449) & 0x200)) { tbl = bwi_phy_noise_scale_11g_rev7; - n = N(bwi_phy_noise_scale_11g_rev7); + n = nitems(bwi_phy_noise_scale_11g_rev7); } else { tbl = bwi_phy_noise_scale_11g; - n = N(bwi_phy_noise_scale_11g); + n = nitems(bwi_phy_noise_scale_11g); } for (i = 0; i < n; ++i) bwi_tbl_write_2(mac, BWI_PHYTBL_NOISE_SCALE + i, tbl[i]); @@ -825,10 +821,10 @@ bwi_phy_config_11g(struct bwi_mac *mac) */ if (phy->phy_rev == 2) { tbl = bwi_phy_sigma_sq_11g_rev2; - n = N(bwi_phy_sigma_sq_11g_rev2); + n = nitems(bwi_phy_sigma_sq_11g_rev2); } else if (phy->phy_rev > 2 && phy->phy_rev <= 8) { tbl = bwi_phy_sigma_sq_11g_rev7; - n = N(bwi_phy_sigma_sq_11g_rev7); + n = nitems(bwi_phy_sigma_sq_11g_rev7); } else { tbl = NULL; n = 0; @@ -838,7 +834,7 @@ bwi_phy_config_11g(struct bwi_mac *mac) if (phy->phy_rev == 1) { /* Fill delay table */ - for (i = 0; i < N(bwi_phy_delay_11g_rev1); ++i) { + for (i = 0; i < nitems(bwi_phy_delay_11g_rev1); ++i) { bwi_tbl_write_4(mac, BWI_PHYTBL_DELAY + i, bwi_phy_delay_11g_rev1[i]); } @@ -877,8 +873,6 @@ bwi_phy_config_11g(struct bwi_mac *mac) PHY_WRITE(mac, 0x46e, 0x3cf); } -#undef N - /* * Configure Automatic Gain Controller */ |