Skip to content

Commit

Permalink
Staging: brcm80211: remove ARRAYSIZE macro
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Greg Kroah-Hartman committed Oct 8, 2010
1 parent ce0f1b8 commit 8d3d6a6
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 88 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/brcmfmac/bcmutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ const char *bcmerrorstr(int bcmerror)
{
/* check if someone added a bcmerror code but
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) {
snprintf(bcm_undeferrstr, BCME_STRLEN, "Undefined error %d",
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/brcmfmac/dhd_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

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)
event_name = event_names[i].event_name;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/brcm80211/brcmfmac/wl_iw.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ wl_iw_set_spy(struct net_device *dev,
if (!extra)
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++)
memcpy(&iw->spy_addr[i], addr[i].sa_data, ETHER_ADDR_LEN);
memset(iw->spy_qual, 0, sizeof(iw->spy_qual));
Expand Down Expand Up @@ -3165,7 +3165,7 @@ static const iw_handler wl_iw_handler[] = {
#if WIRELESS_EXT > 12

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,
.num_private = 0,
.num_private_args = 0,
Expand All @@ -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",
__func__, cmd));
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__,
cmd));
return -EOPNOTSUPP;
Expand Down
3 changes: 0 additions & 3 deletions drivers/staging/brcm80211/include/bcmutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,6 @@ extern "C" {
& ~((boundary) - 1))
#define ISPOWEROF2(x) ((((x)-1)&(x)) == 0)
#define VALID_MASK(mask) (!((mask) & ((mask) + 1)))
#ifndef ARRAYSIZE
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
#endif

/* bit map related macros */
#ifndef setbit
Expand Down
14 changes: 7 additions & 7 deletions drivers/staging/brcm80211/phy/wlc_phy_cmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ int wlc_phy_channel2freq(uint channel)
{
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)
return chan_info_all[i].freq;
return 0;
Expand All @@ -1538,7 +1538,7 @@ wlc_phy_chanspec_band_validch(wlc_phy_t *ppi, uint band, chanvec_t *channels)

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;

if ((pi->a_band_high_disable) && (channel >= FIRST_REF5_CHANNUM)
Expand All @@ -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));

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;

if (ISNPHY(pi) && IS40MHZ(pi)) {
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 ==
channel + CH_10MHZ_APART)
break;
}

if (j == ARRAYSIZE(chan_info_all))
if (j == ARRAY_SIZE(chan_info_all))
continue;

channel = UPPER_20_SB(channel);
Expand Down Expand Up @@ -1725,12 +1725,12 @@ wlc_phy_txpower_sromlimit(wlc_phy_t *ppi, uint channel, u8 *min_pwr,
if (txp_rate_idx < 0)
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) {
break;
}
}
ASSERT(i < ARRAYSIZE(chan_info_all));
ASSERT(i < ARRAY_SIZE(chan_info_all));

if (pi->hwtxpwr) {
*max_pwr = pi->hwtxpwr[i];
Expand Down
28 changes: 14 additions & 14 deletions drivers/staging/brcm80211/phy/wlc_phy_lcn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,7 @@ void wlc_lcnphy_txpower_recalc_target(phy_info_t *pi)
if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi))
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)
j = TXP_FIRST_MCS_20_SISO;
Expand All @@ -1631,7 +1631,7 @@ void wlc_lcnphy_txpower_recalc_target(phy_info_t *pi)

tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL;
tab.tbl_width = 32;
tab.tbl_len = ARRAYSIZE(rate_table);
tab.tbl_len = ARRAY_SIZE(rate_table);
tab.tbl_ptr = rate_table;
tab.tbl_offset = LCNPHY_TX_PWR_CTRL_RATE_OFFSET;
wlc_lcnphy_write_table(pi, &tab);
Expand Down Expand Up @@ -1900,7 +1900,7 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,
case LCNPHY_CAL_FULL:
start_coeffs = syst_coeffs;
cal_cmds = commands_fullcal;
n_cal_cmds = ARRAYSIZE(commands_fullcal);
n_cal_cmds = ARRAY_SIZE(commands_fullcal);
break;

case LCNPHY_CAL_RECAL:
Expand All @@ -1909,7 +1909,7 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,
start_coeffs = syst_coeffs;

cal_cmds = commands_recal;
n_cal_cmds = ARRAYSIZE(commands_recal);
n_cal_cmds = ARRAY_SIZE(commands_recal);
command_nums = command_nums_recal;
break;
default:
Expand Down Expand Up @@ -1977,12 +1977,12 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,
wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL,
(const void *)
lcnphy_iqcal_loft_gainladder,
ARRAYSIZE(lcnphy_iqcal_loft_gainladder),
ARRAY_SIZE(lcnphy_iqcal_loft_gainladder),
16, 0);

wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL,
(const void *)lcnphy_iqcal_ir_gainladder,
ARRAYSIZE(lcnphy_iqcal_ir_gainladder), 16,
ARRAY_SIZE(lcnphy_iqcal_ir_gainladder), 16,
32);

if (pi->phy_tx_tone_freq) {
Expand Down Expand Up @@ -2029,10 +2029,10 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,

wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL,
best_coeffs,
ARRAYSIZE(best_coeffs), 16, 96);
ARRAY_SIZE(best_coeffs), 16, 96);
wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL,
best_coeffs,
ARRAYSIZE(best_coeffs), 16, 64);
ARRAY_SIZE(best_coeffs), 16, 64);

if ((cal_type == 3) || (cal_type == 4)) {
wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL,
Expand All @@ -2041,7 +2041,7 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,
wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL,
pi_lcn->lcnphy_cal_results.
txiqlocal_bestcoeffs,
ARRAYSIZE(pi_lcn->
ARRAY_SIZE(pi_lcn->
lcnphy_cal_results.
txiqlocal_bestcoeffs),
16, 96);
Expand All @@ -2050,7 +2050,7 @@ wlc_lcnphy_tx_iqlo_cal(phy_info_t *pi,
wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL,
pi_lcn->lcnphy_cal_results.
txiqlocal_bestcoeffs,
ARRAYSIZE(pi_lcn->lcnphy_cal_results.
ARRAY_SIZE(pi_lcn->lcnphy_cal_results.
txiqlocal_bestcoeffs), 16, 96);
pi_lcn->lcnphy_cal_results.txiqlocal_bestcoeffs_valid = TRUE;

Expand Down Expand Up @@ -2759,7 +2759,7 @@ wlc_lcnphy_start_tx_tone(phy_info_t *pi, s32 f_kHz, u16 max_val,
do {
bw = phy_bw * 1000 * k;
num_samps = bw / ABS(f_kHz);
ASSERT(num_samps <= ARRAYSIZE(data_buf));
ASSERT(num_samps <= ARRAY_SIZE(data_buf));
k++;
} while ((num_samps * (u32) (ABS(f_kHz))) != bw);
} else
Expand Down Expand Up @@ -3510,7 +3510,7 @@ static void wlc_lcnphy_periodic_cal(phy_info_t *pi)
wlc_lcnphy_txpwrtbl_iqlo_cal(pi);

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))
wlc_lcnphy_rx_iq_cal(pi, NULL, 0, TRUE, FALSE, 1, 40);
Expand Down Expand Up @@ -4891,11 +4891,11 @@ wlc_lcnphy_radio_2064_channel_tune_4313(phy_info_t *pi, u8 channel)
}

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)
break;

if (i >= ARRAYSIZE(chan_info_2064_lcnphy)) {
if (i >= ARRAY_SIZE(chan_info_2064_lcnphy)) {
return;
}

Expand Down
Loading

0 comments on commit 8d3d6a6

Please sign in to comment.