Staging: brcm80211: remove ARRAYSIZE macro

Use the real 'ARRAY_SIZE' definition instead.

Cc: Brett Rudley <brudley@broadcom.com>
Cc: Henry Ptasinski <henryp@broadcom.com>
Cc: Nohee Ko <noheek@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman 2010-10-08 11:47:11 -07:00
parent ce0f1b8cd1
commit 8d3d6a6945
11 changed files with 85 additions and 88 deletions

View File

@ -945,7 +945,7 @@ const char *bcmerrorstr(int bcmerror)
{ {
/* check if someone added a bcmerror code but /* check if someone added a bcmerror code but
forgot to add errorstring */ forgot to add errorstring */
ASSERT(ABS(BCME_LAST) == (ARRAYSIZE(bcmerrorstrtable) - 1)); ASSERT(ABS(BCME_LAST) == (ARRAY_SIZE(bcmerrorstrtable) - 1));
if (bcmerror > 0 || bcmerror < BCME_LAST) { if (bcmerror > 0 || bcmerror < BCME_LAST) {
snprintf(bcm_undeferrstr, BCME_STRLEN, "Undefined error %d", snprintf(bcm_undeferrstr, BCME_STRLEN, "Undefined error %d",

View File

@ -607,7 +607,7 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
(unsigned char) event->addr.octet[5] & 0xff); (unsigned char) event->addr.octet[5] & 0xff);
event_name = "UNKNOWN"; event_name = "UNKNOWN";
for (i = 0; i < ARRAYSIZE(event_names); i++) { for (i = 0; i < ARRAY_SIZE(event_names); i++) {
if (event_names[i].event == event_type) if (event_names[i].event == event_type)
event_name = event_names[i].event_name; event_name = event_names[i].event_name;
} }

View File

@ -701,7 +701,7 @@ wl_iw_set_spy(struct net_device *dev,
if (!extra) if (!extra)
return -EINVAL; return -EINVAL;
iw->spy_num = min(ARRAYSIZE(iw->spy_addr), dwrq->length); iw->spy_num = min(ARRAY_SIZE(iw->spy_addr), dwrq->length);
for (i = 0; i < iw->spy_num; i++) for (i = 0; i < iw->spy_num; i++)
memcpy(&iw->spy_addr[i], addr[i].sa_data, ETHER_ADDR_LEN); memcpy(&iw->spy_addr[i], addr[i].sa_data, ETHER_ADDR_LEN);
memset(iw->spy_qual, 0, sizeof(iw->spy_qual)); memset(iw->spy_qual, 0, sizeof(iw->spy_qual));
@ -3165,7 +3165,7 @@ static const iw_handler wl_iw_handler[] = {
#if WIRELESS_EXT > 12 #if WIRELESS_EXT > 12
const struct iw_handler_def wl_iw_handler_def = { const struct iw_handler_def wl_iw_handler_def = {
.num_standard = ARRAYSIZE(wl_iw_handler), .num_standard = ARRAY_SIZE(wl_iw_handler),
.standard = (iw_handler *) wl_iw_handler, .standard = (iw_handler *) wl_iw_handler,
.num_private = 0, .num_private = 0,
.num_private_args = 0, .num_private_args = 0,
@ -3189,7 +3189,7 @@ int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
WL_TRACE(("\n%s, cmd:%x alled via dhd->do_ioctl()entry point\n", WL_TRACE(("\n%s, cmd:%x alled via dhd->do_ioctl()entry point\n",
__func__, cmd)); __func__, cmd));
if (cmd < SIOCIWFIRST || if (cmd < SIOCIWFIRST ||
IW_IOCTL_IDX(cmd) >= ARRAYSIZE(wl_iw_handler)) { IW_IOCTL_IDX(cmd) >= ARRAY_SIZE(wl_iw_handler)) {
WL_ERROR(("%s: error in cmd=%x : out of range\n", __func__, WL_ERROR(("%s: error in cmd=%x : out of range\n", __func__,
cmd)); cmd));
return -EOPNOTSUPP; return -EOPNOTSUPP;

View File

@ -456,9 +456,6 @@ extern "C" {
& ~((boundary) - 1)) & ~((boundary) - 1))
#define ISPOWEROF2(x) ((((x)-1)&(x)) == 0) #define ISPOWEROF2(x) ((((x)-1)&(x)) == 0)
#define VALID_MASK(mask) (!((mask) & ((mask) + 1))) #define VALID_MASK(mask) (!((mask) & ((mask) + 1)))
#ifndef ARRAYSIZE
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
#endif
/* bit map related macros */ /* bit map related macros */
#ifndef setbit #ifndef setbit

View File

@ -1521,7 +1521,7 @@ int wlc_phy_channel2freq(uint channel)
{ {
uint i; uint i;
for (i = 0; i < ARRAYSIZE(chan_info_all); i++) for (i = 0; i < ARRAY_SIZE(chan_info_all); i++)
if (chan_info_all[i].chan == channel) if (chan_info_all[i].chan == channel)
return chan_info_all[i].freq; return chan_info_all[i].freq;
return 0; return 0;
@ -1538,7 +1538,7 @@ wlc_phy_chanspec_band_validch(wlc_phy_t *ppi, uint band, chanvec_t *channels)
bzero(channels, sizeof(chanvec_t)); bzero(channels, sizeof(chanvec_t));
for (i = 0; i < ARRAYSIZE(chan_info_all); i++) { for (i = 0; i < ARRAY_SIZE(chan_info_all); i++) {
channel = chan_info_all[i].chan; channel = chan_info_all[i].chan;
if ((pi->a_band_high_disable) && (channel >= FIRST_REF5_CHANNUM) if ((pi->a_band_high_disable) && (channel >= FIRST_REF5_CHANNUM)
@ -1560,19 +1560,19 @@ chanspec_t wlc_phy_chanspec_band_firstch(wlc_phy_t *ppi, uint band)
ASSERT((band == WLC_BAND_2G) || (band == WLC_BAND_5G)); ASSERT((band == WLC_BAND_2G) || (band == WLC_BAND_5G));
for (i = 0; i < ARRAYSIZE(chan_info_all); i++) { for (i = 0; i < ARRAY_SIZE(chan_info_all); i++) {
channel = chan_info_all[i].chan; channel = chan_info_all[i].chan;
if (ISNPHY(pi) && IS40MHZ(pi)) { if (ISNPHY(pi) && IS40MHZ(pi)) {
uint j; uint j;
for (j = 0; j < ARRAYSIZE(chan_info_all); j++) { for (j = 0; j < ARRAY_SIZE(chan_info_all); j++) {
if (chan_info_all[j].chan == if (chan_info_all[j].chan ==
channel + CH_10MHZ_APART) channel + CH_10MHZ_APART)
break; break;
} }
if (j == ARRAYSIZE(chan_info_all)) if (j == ARRAY_SIZE(chan_info_all))
continue; continue;
channel = UPPER_20_SB(channel); channel = UPPER_20_SB(channel);
@ -1725,12 +1725,12 @@ wlc_phy_txpower_sromlimit(wlc_phy_t *ppi, uint channel, u8 *min_pwr,
if (txp_rate_idx < 0) if (txp_rate_idx < 0)
txp_rate_idx = TXP_FIRST_OFDM; txp_rate_idx = TXP_FIRST_OFDM;
for (i = 0; i < ARRAYSIZE(chan_info_all); i++) { for (i = 0; i < ARRAY_SIZE(chan_info_all); i++) {
if (channel == chan_info_all[i].chan) { if (channel == chan_info_all[i].chan) {
break; break;
} }
} }
ASSERT(i < ARRAYSIZE(chan_info_all)); ASSERT(i < ARRAY_SIZE(chan_info_all));
if (pi->hwtxpwr) { if (pi->hwtxpwr) {
*max_pwr = pi->hwtxpwr[i]; *max_pwr = pi->hwtxpwr[i];

View File

@ -1621,7 +1621,7 @@ void wlc_lcnphy_txpower_recalc_target(phy_info_t *pi)
if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi))
return; return;
for (i = 0, j = 0; i < ARRAYSIZE(rate_table); i++, j++) { for (i = 0, j = 0; i < ARRAY_SIZE(rate_table); i++, j++) {
if (i == WLC_NUM_RATES_CCK + WLC_NUM_RATES_OFDM) if (i == WLC_NUM_RATES_CCK + WLC_NUM_RATES_OFDM)
j = TXP_FIRST_MCS_20_SISO; j = TXP_FIRST_MCS_20_SISO;
@ -1631,7 +1631,7 @@ void wlc_lcnphy_txpower_recalc_target(phy_info_t *pi)
tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL;
tab.tbl_width = 32; tab.tbl_width = 32;
tab.tbl_len = ARRAYSIZE(rate_table); tab.tbl_len = ARRAY_SIZE(rate_table);
tab.tbl_ptr = rate_table; tab.tbl_ptr = rate_table;
tab.tbl_offset = LCNPHY_TX_PWR_CTRL_RATE_OFFSET; tab.tbl_offset = LCNPHY_TX_PWR_CTRL_RATE_OFFSET;
wlc_lcnphy_write_table(pi, &tab); wlc_lcnphy_write_table(pi, &tab);
@ -1900,7 +1900,7 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,
case LCNPHY_CAL_FULL: case LCNPHY_CAL_FULL:
start_coeffs = syst_coeffs; start_coeffs = syst_coeffs;
cal_cmds = commands_fullcal; cal_cmds = commands_fullcal;
n_cal_cmds = ARRAYSIZE(commands_fullcal); n_cal_cmds = ARRAY_SIZE(commands_fullcal);
break; break;
case LCNPHY_CAL_RECAL: case LCNPHY_CAL_RECAL:
@ -1909,7 +1909,7 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,
start_coeffs = syst_coeffs; start_coeffs = syst_coeffs;
cal_cmds = commands_recal; cal_cmds = commands_recal;
n_cal_cmds = ARRAYSIZE(commands_recal); n_cal_cmds = ARRAY_SIZE(commands_recal);
command_nums = command_nums_recal; command_nums = command_nums_recal;
break; break;
default: default:
@ -1977,12 +1977,12 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,
wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL,
(const void *) (const void *)
lcnphy_iqcal_loft_gainladder, lcnphy_iqcal_loft_gainladder,
ARRAYSIZE(lcnphy_iqcal_loft_gainladder), ARRAY_SIZE(lcnphy_iqcal_loft_gainladder),
16, 0); 16, 0);
wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL,
(const void *)lcnphy_iqcal_ir_gainladder, (const void *)lcnphy_iqcal_ir_gainladder,
ARRAYSIZE(lcnphy_iqcal_ir_gainladder), 16, ARRAY_SIZE(lcnphy_iqcal_ir_gainladder), 16,
32); 32);
if (pi->phy_tx_tone_freq) { if (pi->phy_tx_tone_freq) {
@ -2029,10 +2029,10 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,
wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL, wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL,
best_coeffs, best_coeffs,
ARRAYSIZE(best_coeffs), 16, 96); ARRAY_SIZE(best_coeffs), 16, 96);
wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL,
best_coeffs, best_coeffs,
ARRAYSIZE(best_coeffs), 16, 64); ARRAY_SIZE(best_coeffs), 16, 64);
if ((cal_type == 3) || (cal_type == 4)) { if ((cal_type == 3) || (cal_type == 4)) {
wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL,
@ -2041,7 +2041,7 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,
wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL, wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL,
pi_lcn->lcnphy_cal_results. pi_lcn->lcnphy_cal_results.
txiqlocal_bestcoeffs, txiqlocal_bestcoeffs,
ARRAYSIZE(pi_lcn-> ARRAY_SIZE(pi_lcn->
lcnphy_cal_results. lcnphy_cal_results.
txiqlocal_bestcoeffs), txiqlocal_bestcoeffs),
16, 96); 16, 96);
@ -2050,7 +2050,7 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,
wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL, wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL,
pi_lcn->lcnphy_cal_results. pi_lcn->lcnphy_cal_results.
txiqlocal_bestcoeffs, txiqlocal_bestcoeffs,
ARRAYSIZE(pi_lcn->lcnphy_cal_results. ARRAY_SIZE(pi_lcn->lcnphy_cal_results.
txiqlocal_bestcoeffs), 16, 96); txiqlocal_bestcoeffs), 16, 96);
pi_lcn->lcnphy_cal_results.txiqlocal_bestcoeffs_valid = TRUE; pi_lcn->lcnphy_cal_results.txiqlocal_bestcoeffs_valid = TRUE;
@ -2759,7 +2759,7 @@ wlc_lcnphy_start_tx_tone(phy_info_t *pi, s32 f_kHz, u16 max_val,
do { do {
bw = phy_bw * 1000 * k; bw = phy_bw * 1000 * k;
num_samps = bw / ABS(f_kHz); num_samps = bw / ABS(f_kHz);
ASSERT(num_samps <= ARRAYSIZE(data_buf)); ASSERT(num_samps <= ARRAY_SIZE(data_buf));
k++; k++;
} while ((num_samps * (u32) (ABS(f_kHz))) != bw); } while ((num_samps * (u32) (ABS(f_kHz))) != bw);
} else } else
@ -3510,7 +3510,7 @@ static void wlc_lcnphy_periodic_cal(phy_info_t *pi)
wlc_lcnphy_txpwrtbl_iqlo_cal(pi); wlc_lcnphy_txpwrtbl_iqlo_cal(pi);
rx_iqcomp = lcnphy_rx_iqcomp_table_rev0; rx_iqcomp = lcnphy_rx_iqcomp_table_rev0;
rx_iqcomp_sz = ARRAYSIZE(lcnphy_rx_iqcomp_table_rev0); rx_iqcomp_sz = ARRAY_SIZE(lcnphy_rx_iqcomp_table_rev0);
if (LCNREV_IS(pi->pubpi.phy_rev, 1)) if (LCNREV_IS(pi->pubpi.phy_rev, 1))
wlc_lcnphy_rx_iq_cal(pi, NULL, 0, TRUE, FALSE, 1, 40); wlc_lcnphy_rx_iq_cal(pi, NULL, 0, TRUE, FALSE, 1, 40);
@ -4891,11 +4891,11 @@ wlc_lcnphy_radio_2064_channel_tune_4313(phy_info_t *pi, u8 channel)
} }
if (CHSPEC_IS2G(pi->radio_chanspec)) { if (CHSPEC_IS2G(pi->radio_chanspec)) {
for (i = 0; i < ARRAYSIZE(chan_info_2064_lcnphy); i++) for (i = 0; i < ARRAY_SIZE(chan_info_2064_lcnphy); i++)
if (chan_info_2064_lcnphy[i].chan == channel) if (chan_info_2064_lcnphy[i].chan == channel)
break; break;
if (i >= ARRAYSIZE(chan_info_2064_lcnphy)) { if (i >= ARRAY_SIZE(chan_info_2064_lcnphy)) {
return; return;
} }

View File

@ -15073,10 +15073,10 @@ void wlc_phy_rxcore_setstate_nphy(wlc_phy_t *pih, u8 rxcore_bitmask)
if (NREV_GE(pi->pubpi.phy_rev, 3)) { if (NREV_GE(pi->pubpi.phy_rev, 3)) {
if (pi->rx2tx_biasentry == -1) { if (pi->rx2tx_biasentry == -1) {
wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ,
ARRAYSIZE(tbl_buf), 80, ARRAY_SIZE(tbl_buf), 80,
16, tbl_buf); 16, tbl_buf);
for (i = 0; i < ARRAYSIZE(tbl_buf); i++) { for (i = 0; i < ARRAY_SIZE(tbl_buf); i++) {
if (tbl_buf[i] == if (tbl_buf[i] ==
NPHY_REV3_RFSEQ_CMD_CLR_RXRX_BIAS) { NPHY_REV3_RFSEQ_CMD_CLR_RXRX_BIAS) {
@ -16244,7 +16244,7 @@ static void wlc_phy_workarounds_nphy(phy_info_t *pi)
(pi->sh->boardtype == 0x8b)) { (pi->sh->boardtype == 0x8b)) {
uint i; uint i;
u8 war_dlys[] = { 1, 6, 6, 2, 4, 20, 1 }; u8 war_dlys[] = { 1, 6, 6, 2, 4, 20, 1 };
for (i = 0; i < ARRAYSIZE(rfseq_rx2tx_dlys); i++) for (i = 0; i < ARRAY_SIZE(rfseq_rx2tx_dlys); i++)
rfseq_rx2tx_dlys[i] = war_dlys[i]; rfseq_rx2tx_dlys[i] = war_dlys[i];
} }
@ -17638,7 +17638,7 @@ wlc_phy_chan2freq_nphy(phy_info_t *pi, uint channel, int *f,
if (NREV_IS(pi->pubpi.phy_rev, 7)) { if (NREV_IS(pi->pubpi.phy_rev, 7)) {
chan_info_tbl_p_0 = chan_info_nphyrev7_2057_rev4; chan_info_tbl_p_0 = chan_info_nphyrev7_2057_rev4;
tbl_len = ARRAYSIZE(chan_info_nphyrev7_2057_rev4); tbl_len = ARRAY_SIZE(chan_info_nphyrev7_2057_rev4);
} else if (NREV_IS(pi->pubpi.phy_rev, 8) } else if (NREV_IS(pi->pubpi.phy_rev, 8)
|| NREV_IS(pi->pubpi.phy_rev, 9)) { || NREV_IS(pi->pubpi.phy_rev, 9)) {
@ -17651,7 +17651,7 @@ wlc_phy_chan2freq_nphy(phy_info_t *pi, uint channel, int *f,
chan_info_tbl_p_2 = chan_info_tbl_p_2 =
chan_info_nphyrev8_2057_rev5; chan_info_nphyrev8_2057_rev5;
tbl_len = tbl_len =
ARRAYSIZE ARRAY_SIZE
(chan_info_nphyrev8_2057_rev5); (chan_info_nphyrev8_2057_rev5);
} else if (pi->pubpi.radiover == 0x1) { } else if (pi->pubpi.radiover == 0x1) {
@ -17659,7 +17659,7 @@ wlc_phy_chan2freq_nphy(phy_info_t *pi, uint channel, int *f,
chan_info_tbl_p_2 = chan_info_tbl_p_2 =
chan_info_nphyrev9_2057_rev5v1; chan_info_nphyrev9_2057_rev5v1;
tbl_len = tbl_len =
ARRAYSIZE ARRAY_SIZE
(chan_info_nphyrev9_2057_rev5v1); (chan_info_nphyrev9_2057_rev5v1);
} }
@ -17669,14 +17669,14 @@ wlc_phy_chan2freq_nphy(phy_info_t *pi, uint channel, int *f,
chan_info_tbl_p_0 = chan_info_tbl_p_0 =
chan_info_nphyrev8_2057_rev7; chan_info_nphyrev8_2057_rev7;
tbl_len = tbl_len =
ARRAYSIZE(chan_info_nphyrev8_2057_rev7); ARRAY_SIZE(chan_info_nphyrev8_2057_rev7);
break; break;
case 8: case 8:
chan_info_tbl_p_0 = chan_info_tbl_p_0 =
chan_info_nphyrev8_2057_rev8; chan_info_nphyrev8_2057_rev8;
tbl_len = tbl_len =
ARRAYSIZE(chan_info_nphyrev8_2057_rev8); ARRAY_SIZE(chan_info_nphyrev8_2057_rev8);
break; break;
default: default:
@ -17688,7 +17688,7 @@ wlc_phy_chan2freq_nphy(phy_info_t *pi, uint channel, int *f,
} else if (NREV_IS(pi->pubpi.phy_rev, 16)) { } else if (NREV_IS(pi->pubpi.phy_rev, 16)) {
chan_info_tbl_p_0 = chan_info_nphyrev8_2057_rev8; chan_info_tbl_p_0 = chan_info_nphyrev8_2057_rev8;
tbl_len = ARRAYSIZE(chan_info_nphyrev8_2057_rev8); tbl_len = ARRAY_SIZE(chan_info_nphyrev8_2057_rev8);
} else { } else {
goto fail; goto fail;
} }
@ -17720,34 +17720,34 @@ wlc_phy_chan2freq_nphy(phy_info_t *pi, uint channel, int *f,
} else if (NREV_GE(pi->pubpi.phy_rev, 3)) { } else if (NREV_GE(pi->pubpi.phy_rev, 3)) {
if (NREV_IS(pi->pubpi.phy_rev, 3)) { if (NREV_IS(pi->pubpi.phy_rev, 3)) {
chan_info_tbl_p_1 = chan_info_nphyrev3_2056; chan_info_tbl_p_1 = chan_info_nphyrev3_2056;
tbl_len = ARRAYSIZE(chan_info_nphyrev3_2056); tbl_len = ARRAY_SIZE(chan_info_nphyrev3_2056);
} else if (NREV_IS(pi->pubpi.phy_rev, 4)) { } else if (NREV_IS(pi->pubpi.phy_rev, 4)) {
chan_info_tbl_p_1 = chan_info_nphyrev4_2056_A1; chan_info_tbl_p_1 = chan_info_nphyrev4_2056_A1;
tbl_len = ARRAYSIZE(chan_info_nphyrev4_2056_A1); tbl_len = ARRAY_SIZE(chan_info_nphyrev4_2056_A1);
} else if (NREV_IS(pi->pubpi.phy_rev, 5) } else if (NREV_IS(pi->pubpi.phy_rev, 5)
|| NREV_IS(pi->pubpi.phy_rev, 6)) { || NREV_IS(pi->pubpi.phy_rev, 6)) {
switch (pi->pubpi.radiorev) { switch (pi->pubpi.radiorev) {
case 5: case 5:
chan_info_tbl_p_1 = chan_info_nphyrev5_2056v5; chan_info_tbl_p_1 = chan_info_nphyrev5_2056v5;
tbl_len = ARRAYSIZE(chan_info_nphyrev5_2056v5); tbl_len = ARRAY_SIZE(chan_info_nphyrev5_2056v5);
break; break;
case 6: case 6:
chan_info_tbl_p_1 = chan_info_nphyrev6_2056v6; chan_info_tbl_p_1 = chan_info_nphyrev6_2056v6;
tbl_len = ARRAYSIZE(chan_info_nphyrev6_2056v6); tbl_len = ARRAY_SIZE(chan_info_nphyrev6_2056v6);
break; break;
case 7: case 7:
case 9: case 9:
chan_info_tbl_p_1 = chan_info_nphyrev5n6_2056v7; chan_info_tbl_p_1 = chan_info_nphyrev5n6_2056v7;
tbl_len = tbl_len =
ARRAYSIZE(chan_info_nphyrev5n6_2056v7); ARRAY_SIZE(chan_info_nphyrev5n6_2056v7);
break; break;
case 8: case 8:
chan_info_tbl_p_1 = chan_info_nphyrev6_2056v8; chan_info_tbl_p_1 = chan_info_nphyrev6_2056v8;
tbl_len = ARRAYSIZE(chan_info_nphyrev6_2056v8); tbl_len = ARRAY_SIZE(chan_info_nphyrev6_2056v8);
break; break;
case 11: case 11:
chan_info_tbl_p_1 = chan_info_nphyrev6_2056v11; chan_info_tbl_p_1 = chan_info_nphyrev6_2056v11;
tbl_len = ARRAYSIZE(chan_info_nphyrev6_2056v11); tbl_len = ARRAY_SIZE(chan_info_nphyrev6_2056v11);
break; break;
default: default:
if (NORADIO_ENAB(pi->pubpi)) { if (NORADIO_ENAB(pi->pubpi)) {
@ -17770,12 +17770,12 @@ wlc_phy_chan2freq_nphy(phy_info_t *pi, uint channel, int *f,
freq = chan_info_tbl_p_1[i].freq; freq = chan_info_tbl_p_1[i].freq;
} else { } else {
for (i = 0; i < ARRAYSIZE(chan_info_nphy_2055); i++) for (i = 0; i < ARRAY_SIZE(chan_info_nphy_2055); i++)
if (chan_info_nphy_2055[i].chan == channel) if (chan_info_nphy_2055[i].chan == channel)
break; break;
if (i >= ARRAYSIZE(chan_info_nphy_2055)) { if (i >= ARRAY_SIZE(chan_info_nphy_2055)) {
ASSERT(i < ARRAYSIZE(chan_info_nphy_2055)); ASSERT(i < ARRAY_SIZE(chan_info_nphy_2055));
goto fail; goto fail;
} }
*t3 = &chan_info_nphy_2055[i]; *t3 = &chan_info_nphy_2055[i];
@ -24212,20 +24212,20 @@ wlc_phy_cal_txiqlo_nphy(phy_info_t *pi, nphy_txgains_t target_gain,
if (phy_bw == 40) { if (phy_bw == 40) {
tbl_ptr = tbl_tx_iqlo_cal_loft_ladder_40; tbl_ptr = tbl_tx_iqlo_cal_loft_ladder_40;
tbl_len = ARRAYSIZE(tbl_tx_iqlo_cal_loft_ladder_40); tbl_len = ARRAY_SIZE(tbl_tx_iqlo_cal_loft_ladder_40);
} else { } else {
tbl_ptr = tbl_tx_iqlo_cal_loft_ladder_20; tbl_ptr = tbl_tx_iqlo_cal_loft_ladder_20;
tbl_len = ARRAYSIZE(tbl_tx_iqlo_cal_loft_ladder_20); tbl_len = ARRAY_SIZE(tbl_tx_iqlo_cal_loft_ladder_20);
} }
wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, tbl_len, 0, wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, tbl_len, 0,
16, tbl_ptr); 16, tbl_ptr);
if (phy_bw == 40) { if (phy_bw == 40) {
tbl_ptr = tbl_tx_iqlo_cal_iqimb_ladder_40; tbl_ptr = tbl_tx_iqlo_cal_iqimb_ladder_40;
tbl_len = ARRAYSIZE(tbl_tx_iqlo_cal_iqimb_ladder_40); tbl_len = ARRAY_SIZE(tbl_tx_iqlo_cal_iqimb_ladder_40);
} else { } else {
tbl_ptr = tbl_tx_iqlo_cal_iqimb_ladder_20; tbl_ptr = tbl_tx_iqlo_cal_iqimb_ladder_20;
tbl_len = ARRAYSIZE(tbl_tx_iqlo_cal_iqimb_ladder_20); tbl_len = ARRAY_SIZE(tbl_tx_iqlo_cal_iqimb_ladder_20);
} }
wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, tbl_len, 32, wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, tbl_len, 32,
16, tbl_ptr); 16, tbl_ptr);
@ -24252,7 +24252,7 @@ wlc_phy_cal_txiqlo_nphy(phy_info_t *pi, nphy_txgains_t target_gain,
if (pi->mphase_cal_phase_id > MPHASE_CAL_STATE_TXPHASE0) { if (pi->mphase_cal_phase_id > MPHASE_CAL_STATE_TXPHASE0) {
tbl_ptr = pi->mphase_txcal_bestcoeffs; tbl_ptr = pi->mphase_txcal_bestcoeffs;
tbl_len = ARRAYSIZE(pi->mphase_txcal_bestcoeffs); tbl_len = ARRAY_SIZE(pi->mphase_txcal_bestcoeffs);
if (NREV_LT(pi->pubpi.phy_rev, 3)) { if (NREV_LT(pi->pubpi.phy_rev, 3)) {
tbl_len -= 2; tbl_len -= 2;
@ -24261,7 +24261,7 @@ wlc_phy_cal_txiqlo_nphy(phy_info_t *pi, nphy_txgains_t target_gain,
if ((!fullcal) && (pi->nphy_txiqlocal_coeffsvalid)) { if ((!fullcal) && (pi->nphy_txiqlocal_coeffsvalid)) {
tbl_ptr = pi->nphy_txiqlocal_bestc; tbl_ptr = pi->nphy_txiqlocal_bestc;
tbl_len = ARRAYSIZE(pi->nphy_txiqlocal_bestc); tbl_len = ARRAY_SIZE(pi->nphy_txiqlocal_bestc);
if (NREV_LT(pi->pubpi.phy_rev, 3)) { if (NREV_LT(pi->pubpi.phy_rev, 3)) {
tbl_len -= 2; tbl_len -= 2;
@ -24274,12 +24274,12 @@ wlc_phy_cal_txiqlo_nphy(phy_info_t *pi, nphy_txgains_t target_gain,
tbl_ptr = tbl_ptr =
tbl_tx_iqlo_cal_startcoefs_nphyrev3; tbl_tx_iqlo_cal_startcoefs_nphyrev3;
tbl_len = tbl_len =
ARRAYSIZE ARRAY_SIZE
(tbl_tx_iqlo_cal_startcoefs_nphyrev3); (tbl_tx_iqlo_cal_startcoefs_nphyrev3);
} else { } else {
tbl_ptr = tbl_tx_iqlo_cal_startcoefs; tbl_ptr = tbl_tx_iqlo_cal_startcoefs;
tbl_len = tbl_len =
ARRAYSIZE ARRAY_SIZE
(tbl_tx_iqlo_cal_startcoefs); (tbl_tx_iqlo_cal_startcoefs);
} }
} }
@ -24289,12 +24289,12 @@ wlc_phy_cal_txiqlo_nphy(phy_info_t *pi, nphy_txgains_t target_gain,
if (fullcal) { if (fullcal) {
max_cal_cmds = (NREV_GE(pi->pubpi.phy_rev, 3)) ? max_cal_cmds = (NREV_GE(pi->pubpi.phy_rev, 3)) ?
ARRAYSIZE(tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3) : ARRAY_SIZE(tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3) :
ARRAYSIZE(tbl_tx_iqlo_cal_cmds_fullcal); ARRAY_SIZE(tbl_tx_iqlo_cal_cmds_fullcal);
} else { } else {
max_cal_cmds = (NREV_GE(pi->pubpi.phy_rev, 3)) ? max_cal_cmds = (NREV_GE(pi->pubpi.phy_rev, 3)) ?
ARRAYSIZE(tbl_tx_iqlo_cal_cmds_recal_nphyrev3) : ARRAY_SIZE(tbl_tx_iqlo_cal_cmds_recal_nphyrev3) :
ARRAYSIZE(tbl_tx_iqlo_cal_cmds_recal); ARRAY_SIZE(tbl_tx_iqlo_cal_cmds_recal);
} }
if (mphase) { if (mphase) {
@ -24414,7 +24414,7 @@ wlc_phy_cal_txiqlo_nphy(phy_info_t *pi, nphy_txgains_t target_gain,
wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 93, wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 93,
16, tbl_buf); 16, tbl_buf);
tbl_len = ARRAYSIZE(pi->nphy_txiqlocal_bestc); tbl_len = ARRAY_SIZE(pi->nphy_txiqlocal_bestc);
if (NREV_LT(pi->pubpi.phy_rev, 3)) { if (NREV_LT(pi->pubpi.phy_rev, 3)) {
tbl_len -= 2; tbl_len -= 2;
@ -24426,7 +24426,7 @@ wlc_phy_cal_txiqlo_nphy(phy_info_t *pi, nphy_txgains_t target_gain,
pi->nphy_txiqlocal_coeffsvalid = TRUE; pi->nphy_txiqlocal_coeffsvalid = TRUE;
pi->nphy_txiqlocal_chanspec = pi->radio_chanspec; pi->nphy_txiqlocal_chanspec = pi->radio_chanspec;
} else { } else {
tbl_len = ARRAYSIZE(pi->mphase_txcal_bestcoeffs); tbl_len = ARRAY_SIZE(pi->mphase_txcal_bestcoeffs);
if (NREV_LT(pi->pubpi.phy_rev, 3)) { if (NREV_LT(pi->pubpi.phy_rev, 3)) {
tbl_len -= 2; tbl_len -= 2;
@ -24473,7 +24473,7 @@ static void wlc_phy_reapply_txcal_coeffs_nphy(phy_info_t *pi)
if ((pi->nphy_txiqlocal_chanspec == pi->radio_chanspec) && if ((pi->nphy_txiqlocal_chanspec == pi->radio_chanspec) &&
(pi->nphy_txiqlocal_coeffsvalid)) { (pi->nphy_txiqlocal_coeffsvalid)) {
wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL,
ARRAYSIZE(tbl_buf), 80, 16, tbl_buf); ARRAY_SIZE(tbl_buf), 80, 16, tbl_buf);
if ((pi->nphy_txiqlocal_bestc[0] != tbl_buf[0]) || if ((pi->nphy_txiqlocal_bestc[0] != tbl_buf[0]) ||
(pi->nphy_txiqlocal_bestc[1] != tbl_buf[1]) || (pi->nphy_txiqlocal_bestc[1] != tbl_buf[1]) ||

View File

@ -926,7 +926,7 @@ BCMATTACHFN(wlc_bmac_attach) (wlc_info_t *wlc, u16 vendor, u16 device,
/* init tx fifo size */ /* init tx fifo size */
ASSERT((wlc_hw->corerev - XMTFIFOTBL_STARTREV) < ASSERT((wlc_hw->corerev - XMTFIFOTBL_STARTREV) <
ARRAYSIZE(xmtfifo_sz)); ARRAY_SIZE(xmtfifo_sz));
wlc_hw->xmtfifo_sz = wlc_hw->xmtfifo_sz =
xmtfifo_sz[(wlc_hw->corerev - XMTFIFOTBL_STARTREV)]; xmtfifo_sz[(wlc_hw->corerev - XMTFIFOTBL_STARTREV)];
@ -1500,7 +1500,7 @@ wlc_bmac_mhf(wlc_hw_info_t *wlc_hw, u8 idx, u16 mask, u16 val,
ASSERT((val & ~mask) == 0); ASSERT((val & ~mask) == 0);
ASSERT(idx < MHFMAX); ASSERT(idx < MHFMAX);
ASSERT(ARRAYSIZE(addr) == MHFMAX); ASSERT(ARRAY_SIZE(addr) == MHFMAX);
switch (bands) { switch (bands) {
/* Current band only or all bands, /* Current band only or all bands,
@ -1576,7 +1576,7 @@ static void wlc_write_mhf(wlc_hw_info_t *wlc_hw, u16 *mhfs)
M_HOST_FLAGS5 M_HOST_FLAGS5
}; };
ASSERT(ARRAYSIZE(addr) == MHFMAX); ASSERT(ARRAY_SIZE(addr) == MHFMAX);
for (idx = 0; idx < MHFMAX; idx++) { for (idx = 0; idx < MHFMAX; idx++) {
wlc_bmac_write_shm(wlc_hw, addr[idx], mhfs[idx]); wlc_bmac_write_shm(wlc_hw, addr[idx], mhfs[idx]);
@ -3595,7 +3595,7 @@ static void wlc_upd_ofdm_pctl1_table(wlc_hw_info_t *wlc_hw)
return; return;
/* walk the phy rate table and update the entries */ /* walk the phy rate table and update the entries */
for (i = 0; i < ARRAYSIZE(rates); i++) { for (i = 0; i < ARRAY_SIZE(rates); i++) {
rate = rates[i]; rate = rates[i];
entry_ptr = wlc_bmac_ofdm_ratetable_offset(wlc_hw, rate); entry_ptr = wlc_bmac_ofdm_ratetable_offset(wlc_hw, rate);
@ -3634,7 +3634,7 @@ static u16 wlc_bmac_ofdm_ratetable_offset(wlc_hw_info_t *wlc_hw, u8 rate)
{WLC_RATE_54M, 0xC} {WLC_RATE_54M, 0xC}
}; };
for (i = 0; i < ARRAYSIZE(rate_lookup); i++) { for (i = 0; i < ARRAY_SIZE(rate_lookup); i++) {
if (rate == rate_lookup[i].rate) { if (rate == rate_lookup[i].rate) {
plcp_rate = rate_lookup[i].signal_rate; plcp_rate = rate_lookup[i].signal_rate;
break; break;

View File

@ -380,7 +380,7 @@ void wlc_locale_get_channels(const locale_info_t *locale, chanvec_t *channels)
bzero(channels, sizeof(chanvec_t)); bzero(channels, sizeof(chanvec_t));
for (i = 0; i < ARRAYSIZE(g_table_locale_base); i++) { for (i = 0; i < ARRAY_SIZE(g_table_locale_base); i++) {
if (locale->valid_channels & (1 << i)) { if (locale->valid_channels & (1 << i)) {
wlc_locale_add_channels(channels, wlc_locale_add_channels(channels,
g_table_locale_base[i]); g_table_locale_base[i]);
@ -562,10 +562,10 @@ struct chan20_info chan20_info[] = {
const locale_info_t *wlc_get_locale_2g(u8 locale_idx) const locale_info_t *wlc_get_locale_2g(u8 locale_idx)
{ {
if (locale_idx >= ARRAYSIZE(g_locale_2g_table)) { if (locale_idx >= ARRAY_SIZE(g_locale_2g_table)) {
WL_ERROR(("%s: locale 2g index size out of range %d\n", WL_ERROR(("%s: locale 2g index size out of range %d\n",
__func__, locale_idx)); __func__, locale_idx));
ASSERT(locale_idx < ARRAYSIZE(g_locale_2g_table)); ASSERT(locale_idx < ARRAY_SIZE(g_locale_2g_table));
return NULL; return NULL;
} }
return g_locale_2g_table[locale_idx]; return g_locale_2g_table[locale_idx];
@ -573,10 +573,10 @@ const locale_info_t *wlc_get_locale_2g(u8 locale_idx)
const locale_info_t *wlc_get_locale_5g(u8 locale_idx) const locale_info_t *wlc_get_locale_5g(u8 locale_idx)
{ {
if (locale_idx >= ARRAYSIZE(g_locale_5g_table)) { if (locale_idx >= ARRAY_SIZE(g_locale_5g_table)) {
WL_ERROR(("%s: locale 5g index size out of range %d\n", WL_ERROR(("%s: locale 5g index size out of range %d\n",
__func__, locale_idx)); __func__, locale_idx));
ASSERT(locale_idx < ARRAYSIZE(g_locale_5g_table)); ASSERT(locale_idx < ARRAY_SIZE(g_locale_5g_table));
return NULL; return NULL;
} }
return g_locale_5g_table[locale_idx]; return g_locale_5g_table[locale_idx];
@ -584,7 +584,7 @@ const locale_info_t *wlc_get_locale_5g(u8 locale_idx)
const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx) const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx)
{ {
if (locale_idx >= ARRAYSIZE(g_mimo_2g_table)) { if (locale_idx >= ARRAY_SIZE(g_mimo_2g_table)) {
WL_ERROR(("%s: mimo 2g index size out of range %d\n", __func__, WL_ERROR(("%s: mimo 2g index size out of range %d\n", __func__,
locale_idx)); locale_idx));
return NULL; return NULL;
@ -594,7 +594,7 @@ const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx)
const locale_mimo_info_t *wlc_get_mimo_5g(u8 locale_idx) const locale_mimo_info_t *wlc_get_mimo_5g(u8 locale_idx)
{ {
if (locale_idx >= ARRAYSIZE(g_mimo_5g_table)) { if (locale_idx >= ARRAY_SIZE(g_mimo_5g_table)) {
WL_ERROR(("%s: mimo 5g index size out of range %d\n", __func__, WL_ERROR(("%s: mimo 5g index size out of range %d\n", __func__,
locale_idx)); locale_idx));
return NULL; return NULL;
@ -886,7 +886,7 @@ static const country_info_t *wlc_country_lookup_direct(const char *ccode,
return NULL; return NULL;
/* find matched table entry from country code */ /* find matched table entry from country code */
size = ARRAYSIZE(cntry_locales); size = ARRAY_SIZE(cntry_locales);
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
if (strcmp(ccode, cntry_locales[i].abbrev) == 0) { if (strcmp(ccode, cntry_locales[i].abbrev) == 0) {
return &cntry_locales[i].country; return &cntry_locales[i].country;

View File

@ -707,11 +707,11 @@ void BCMATTACHFN(si_pmu_res_init) (si_t *sih, osl_t *osh)
pmu_res_updown_table_sz = 0; pmu_res_updown_table_sz = 0;
} else { } else {
pmu_res_updown_table = bcm4329_res_updown; pmu_res_updown_table = bcm4329_res_updown;
pmu_res_updown_table_sz = ARRAYSIZE(bcm4329_res_updown); pmu_res_updown_table_sz = ARRAY_SIZE(bcm4329_res_updown);
} }
/* Optimize resources dependencies */ /* Optimize resources dependencies */
pmu_res_depend_table = bcm4329_res_depend; pmu_res_depend_table = bcm4329_res_depend;
pmu_res_depend_table_sz = ARRAYSIZE(bcm4329_res_depend); pmu_res_depend_table_sz = ARRAY_SIZE(bcm4329_res_depend);
break; break;
case BCM4319_CHIP_ID: case BCM4319_CHIP_ID:
@ -719,15 +719,15 @@ void BCMATTACHFN(si_pmu_res_init) (si_t *sih, osl_t *osh)
if (ISSIM_ENAB(sih)) { if (ISSIM_ENAB(sih)) {
pmu_res_updown_table = bcm4319a0_res_updown_qt; pmu_res_updown_table = bcm4319a0_res_updown_qt;
pmu_res_updown_table_sz = pmu_res_updown_table_sz =
ARRAYSIZE(bcm4319a0_res_updown_qt); ARRAY_SIZE(bcm4319a0_res_updown_qt);
} else { } else {
pmu_res_updown_table = bcm4319a0_res_updown; pmu_res_updown_table = bcm4319a0_res_updown;
pmu_res_updown_table_sz = pmu_res_updown_table_sz =
ARRAYSIZE(bcm4319a0_res_updown); ARRAY_SIZE(bcm4319a0_res_updown);
} }
/* Optimize resources dependancies masks */ /* Optimize resources dependancies masks */
pmu_res_depend_table = bcm4319a0_res_depend; pmu_res_depend_table = bcm4319a0_res_depend;
pmu_res_depend_table_sz = ARRAYSIZE(bcm4319a0_res_depend); pmu_res_depend_table_sz = ARRAY_SIZE(bcm4319a0_res_depend);
break; break;
case BCM4336_CHIP_ID: case BCM4336_CHIP_ID:
@ -735,15 +735,15 @@ void BCMATTACHFN(si_pmu_res_init) (si_t *sih, osl_t *osh)
if (ISSIM_ENAB(sih)) { if (ISSIM_ENAB(sih)) {
pmu_res_updown_table = bcm4336a0_res_updown_qt; pmu_res_updown_table = bcm4336a0_res_updown_qt;
pmu_res_updown_table_sz = pmu_res_updown_table_sz =
ARRAYSIZE(bcm4336a0_res_updown_qt); ARRAY_SIZE(bcm4336a0_res_updown_qt);
} else { } else {
pmu_res_updown_table = bcm4336a0_res_updown; pmu_res_updown_table = bcm4336a0_res_updown;
pmu_res_updown_table_sz = pmu_res_updown_table_sz =
ARRAYSIZE(bcm4336a0_res_updown); ARRAY_SIZE(bcm4336a0_res_updown);
} }
/* Optimize resources dependancies masks */ /* Optimize resources dependancies masks */
pmu_res_depend_table = bcm4336a0_res_depend; pmu_res_depend_table = bcm4336a0_res_depend;
pmu_res_depend_table_sz = ARRAYSIZE(bcm4336a0_res_depend); pmu_res_depend_table_sz = ARRAY_SIZE(bcm4336a0_res_depend);
break; break;
case BCM4330_CHIP_ID: case BCM4330_CHIP_ID:
@ -751,15 +751,15 @@ void BCMATTACHFN(si_pmu_res_init) (si_t *sih, osl_t *osh)
if (ISSIM_ENAB(sih)) { if (ISSIM_ENAB(sih)) {
pmu_res_updown_table = bcm4330a0_res_updown_qt; pmu_res_updown_table = bcm4330a0_res_updown_qt;
pmu_res_updown_table_sz = pmu_res_updown_table_sz =
ARRAYSIZE(bcm4330a0_res_updown_qt); ARRAY_SIZE(bcm4330a0_res_updown_qt);
} else { } else {
pmu_res_updown_table = bcm4330a0_res_updown; pmu_res_updown_table = bcm4330a0_res_updown;
pmu_res_updown_table_sz = pmu_res_updown_table_sz =
ARRAYSIZE(bcm4330a0_res_updown); ARRAY_SIZE(bcm4330a0_res_updown);
} }
/* Optimize resources dependancies masks */ /* Optimize resources dependancies masks */
pmu_res_depend_table = bcm4330a0_res_depend; pmu_res_depend_table = bcm4330a0_res_depend;
pmu_res_depend_table_sz = ARRAYSIZE(bcm4330a0_res_depend); pmu_res_depend_table_sz = ARRAY_SIZE(bcm4330a0_res_depend);
break; break;
default: default:

View File

@ -154,7 +154,7 @@ osl_t *osl_attach(void *pdev, uint bustype, bool pkttag)
#ifdef BRCM_FULLMAC #ifdef BRCM_FULLMAC
/* Check that error map has the right number of entries in it */ /* Check that error map has the right number of entries in it */
ASSERT(ABS(BCME_LAST) == (ARRAYSIZE(linuxbcmerrormap) - 1)); ASSERT(ABS(BCME_LAST) == (ARRAY_SIZE(linuxbcmerrormap) - 1));
#endif /* BRCM_FULLMAC */ #endif /* BRCM_FULLMAC */
osh->magic = OS_HANDLE_MAGIC; osh->magic = OS_HANDLE_MAGIC;