Skip to content

Commit

Permalink
Staging: brcm80211: remove broken MAX() implementation
Browse files Browse the repository at this point in the history
Use the kernel-provided version, this one is broken.

Note, there are more compiler warnings now, that's due to different
types being compared, which shows how the original macro was wrong in at
least one way.  They need to be fixed up.

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 7068c2f commit 3ea2f4d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,7 @@ static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg)
bus->pktgen_stop = pktgen.stop;

bus->pktgen_tick = bus->pktgen_ptick = 0;
bus->pktgen_len = MAX(bus->pktgen_len, bus->pktgen_minlen);
bus->pktgen_len = max(bus->pktgen_len, bus->pktgen_minlen);
bus->pktgen_len = min(bus->pktgen_len, bus->pktgen_maxlen);

/* Clear counts for a new pktgen (mode change, or was stopped) */
Expand Down
4 changes: 0 additions & 4 deletions drivers/staging/brcm80211/include/bcmutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,6 @@ extern "C" {
#define ABS(a) (((a) < 0) ? -(a) : (a))
#endif /* ABS */

#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif /* MAX */

#define CEIL(x, y) (((x) + ((y)-1)) / (y))
#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
#define ISALIGNED(a, x) (((a) & ((x)-1)) == 0)
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/brcm80211/phy/wlc_phy_cmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ wlc_phy_txpower_sromlimit_max_get(wlc_phy_t *ppi, uint chan, u8 *max_txpwr,

maxtxpwr = (maxtxpwr > 6) ? (maxtxpwr - 6) : 0;

tx_pwr_max = MAX(tx_pwr_max, maxtxpwr);
tx_pwr_max = max(tx_pwr_max, maxtxpwr);
tx_pwr_min = min(tx_pwr_min, maxtxpwr);
}
*max_txpwr = tx_pwr_max;
Expand Down Expand Up @@ -1885,7 +1885,7 @@ void wlc_phy_txpower_recalc_target(phy_info_t *pi)
if (pi->txpwr_percent <= 100)
maxtxpwr = (maxtxpwr * pi->txpwr_percent) / 100;

tx_pwr_target[rate] = MAX(maxtxpwr, mintxpwr);
tx_pwr_target[rate] = max(maxtxpwr, mintxpwr);
}

tx_pwr_target[rate] =
Expand All @@ -1894,7 +1894,7 @@ void wlc_phy_txpower_recalc_target(phy_info_t *pi)
if (tx_pwr_target[rate] > tx_pwr_max)
tx_pwr_max_rate_ind = rate;

tx_pwr_max = MAX(tx_pwr_max, tx_pwr_target[rate]);
tx_pwr_max = max(tx_pwr_max, tx_pwr_target[rate]);
tx_pwr_min = min(tx_pwr_min, tx_pwr_target[rate]);
}

Expand Down
18 changes: 9 additions & 9 deletions drivers/staging/brcm80211/phy/wlc_phy_n.c
Original file line number Diff line number Diff line change
Expand Up @@ -25482,7 +25482,7 @@ wlc_phy_rxcal_gainctrl_nphy_rev5(phy_info_t *pi, u8 rx_core,
if (fine_gain_idx + (int)lpf_biq0 > 10) {
lpf_biq1 = 10 - lpf_biq0;
} else {
lpf_biq1 = (u16) MAX(fine_gain_idx, 0);
lpf_biq1 = (u16) max(fine_gain_idx, 0);
}
wlc_phy_rfctrl_override_1tomany_nphy(pi,
NPHY_REV7_RfctrlOverride_cmd_rxgain,
Expand All @@ -25492,7 +25492,7 @@ wlc_phy_rxcal_gainctrl_nphy_rev5(phy_info_t *pi, u8 rx_core,
(lna2 << 2) | lna1), 0x3,
0);
} else {
hpvga = (u16) MAX(min(((int)hpvga) + delta_pwr, 10), 0);
hpvga = (u16) max(min(((int)hpvga) + delta_pwr, 10), 0);
wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12),
((hpvga << 12) | (lpf_biq1 << 10) |
(lpf_biq0 << 8) | (mix_tia_gain <<
Expand Down Expand Up @@ -25663,12 +25663,12 @@ wlc_phy_rc_sweep_nphy(phy_info_t *pi, u8 core_idx, u8 loopback_type)

if (core_idx == 0) {
ref_iq_vals =
MAX((est[0].i_pwr +
max((est[0].i_pwr +
est[0].q_pwr) >> (log_num_samps + 1),
1);
} else {
ref_iq_vals =
MAX((est[1].i_pwr +
max((est[1].i_pwr +
est[1].q_pwr) >> (log_num_samps + 1),
1);
}
Expand Down Expand Up @@ -25877,8 +25877,8 @@ wlc_phy_cal_rxiq_nphy_rev3(phy_info_t *pi, nphy_txgains_t target_gain,
TXLPF_IDAC_4, txlpf_idac);
}

rxlpf_rccal_hpc = MAX(min(rxlpf_rccal_hpc, 31), 0);
txlpf_rccal_lpc = MAX(min(txlpf_rccal_lpc, 31), 0);
rxlpf_rccal_hpc = max(min(rxlpf_rccal_hpc, 31), 0);
txlpf_rccal_lpc = max(min(txlpf_rccal_lpc, 31), 0);

write_radio_reg(pi, (RADIO_2056_RX_RXLPF_RCCAL_HPC |
((rx_core ==
Expand Down Expand Up @@ -26060,7 +26060,7 @@ wlc_phy_cal_rxiq_nphy_rev2(phy_info_t *pi, nphy_txgains_t target_gain,

hpf_change = desired_log2_pwr - actual_log2_pwr;
curr_hpf += hpf_change;
curr_hpf = MAX(min(curr_hpf, 10), 0);
curr_hpf = max(min(curr_hpf, 10), 0);
if (use_hpf_num == 1) {
curr_hpf1 = curr_hpf;
} else {
Expand Down Expand Up @@ -28687,12 +28687,12 @@ static void wlc_phy_txpwrctrl_pwr_setup_nphy(phy_info_t *pi)
num =
8 * (16 * b0[tbl_id - 26] + b1[tbl_id - 26] * idx);
den = 32768 + a1[tbl_id - 26] * idx;
pwr_est = MAX(((4 * num + den / 2) / den), -8);
pwr_est = max(((4 * num + den / 2) / den), -8);
if (NREV_LT(pi->pubpi.phy_rev, 3)) {
if (idx <=
(uint) (31 - idle_tssi[tbl_id - 26] + 1))
pwr_est =
MAX(pwr_est,
max(pwr_est,
target_pwr_qtrdbm[tbl_id - 26] +
1);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/sys/wlc_ampdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec)

plen =
pkttotlen(osh, p) + AMPDU_MAX_MPDU_OVERHEAD;
plen = MAX(scb_ampdu->min_len, plen);
plen = max(scb_ampdu->min_len, plen);

if ((plen + ampdu_len) > maxlen) {
p = NULL;
Expand Down
8 changes: 4 additions & 4 deletions drivers/staging/brcm80211/sys/wlc_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec,
maxpwr = li->maxpwr[CHANNEL_POWER_IDX_2G_CCK(chan)];

maxpwr = maxpwr - delta;
maxpwr = MAX(maxpwr, 0);
maxpwr = max(maxpwr, 0);
maxpwr = min(maxpwr, conducted_max);

for (i = 0; i < WLC_NUM_RATES_CCK; i++)
Expand All @@ -1371,7 +1371,7 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec,
}

maxpwr = maxpwr - delta;
maxpwr = MAX(maxpwr, 0);
maxpwr = max(maxpwr, 0);
maxpwr = min(maxpwr, conducted_ofdm_max);

/* Keep OFDM lmit below CCK limit */
Expand Down Expand Up @@ -1413,9 +1413,9 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec,
maxpwr40 = li_mimo->maxpwr40[maxpwr_idx];

maxpwr20 = maxpwr20 - delta;
maxpwr20 = MAX(maxpwr20, 0);
maxpwr20 = max(maxpwr20, 0);
maxpwr40 = maxpwr40 - delta;
maxpwr40 = MAX(maxpwr40, 0);
maxpwr40 = max(maxpwr40, 0);

/* Fill in the MCS 0-7 (SISO) rates */
for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) {
Expand Down

0 comments on commit 3ea2f4d

Please sign in to comment.