You need to sign in or sign up before continuing.
提交 3ea2f4d6 编写于 作者: G Greg Kroah-Hartman

Staging: brcm80211: remove broken MAX() implementation

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: NGreg Kroah-Hartman <gregkh@suse.de>
上级 7068c2f1
...@@ -1680,7 +1680,7 @@ static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg) ...@@ -1680,7 +1680,7 @@ static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg)
bus->pktgen_stop = pktgen.stop; bus->pktgen_stop = pktgen.stop;
bus->pktgen_tick = bus->pktgen_ptick = 0; 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); bus->pktgen_len = min(bus->pktgen_len, bus->pktgen_maxlen);
/* Clear counts for a new pktgen (mode change, or was stopped) */ /* Clear counts for a new pktgen (mode change, or was stopped) */
......
...@@ -449,10 +449,6 @@ extern "C" { ...@@ -449,10 +449,6 @@ extern "C" {
#define ABS(a) (((a) < 0) ? -(a) : (a)) #define ABS(a) (((a) < 0) ? -(a) : (a))
#endif /* ABS */ #endif /* ABS */
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif /* MAX */
#define CEIL(x, y) (((x) + ((y)-1)) / (y)) #define CEIL(x, y) (((x) + ((y)-1)) / (y))
#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y)) #define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
#define ISALIGNED(a, x) (((a) & ((x)-1)) == 0) #define ISALIGNED(a, x) (((a) & ((x)-1)) == 0)
......
...@@ -1774,7 +1774,7 @@ wlc_phy_txpower_sromlimit_max_get(wlc_phy_t *ppi, uint chan, u8 *max_txpwr, ...@@ -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; 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); tx_pwr_min = min(tx_pwr_min, maxtxpwr);
} }
*max_txpwr = tx_pwr_max; *max_txpwr = tx_pwr_max;
...@@ -1885,7 +1885,7 @@ void wlc_phy_txpower_recalc_target(phy_info_t *pi) ...@@ -1885,7 +1885,7 @@ void wlc_phy_txpower_recalc_target(phy_info_t *pi)
if (pi->txpwr_percent <= 100) if (pi->txpwr_percent <= 100)
maxtxpwr = (maxtxpwr * 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] = tx_pwr_target[rate] =
...@@ -1894,7 +1894,7 @@ void wlc_phy_txpower_recalc_target(phy_info_t *pi) ...@@ -1894,7 +1894,7 @@ void wlc_phy_txpower_recalc_target(phy_info_t *pi)
if (tx_pwr_target[rate] > tx_pwr_max) if (tx_pwr_target[rate] > tx_pwr_max)
tx_pwr_max_rate_ind = rate; 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]); tx_pwr_min = min(tx_pwr_min, tx_pwr_target[rate]);
} }
......
...@@ -25482,7 +25482,7 @@ wlc_phy_rxcal_gainctrl_nphy_rev5(phy_info_t *pi, u8 rx_core, ...@@ -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) { if (fine_gain_idx + (int)lpf_biq0 > 10) {
lpf_biq1 = 10 - lpf_biq0; lpf_biq1 = 10 - lpf_biq0;
} else { } else {
lpf_biq1 = (u16) MAX(fine_gain_idx, 0); lpf_biq1 = (u16) max(fine_gain_idx, 0);
} }
wlc_phy_rfctrl_override_1tomany_nphy(pi, wlc_phy_rfctrl_override_1tomany_nphy(pi,
NPHY_REV7_RfctrlOverride_cmd_rxgain, NPHY_REV7_RfctrlOverride_cmd_rxgain,
...@@ -25492,7 +25492,7 @@ wlc_phy_rxcal_gainctrl_nphy_rev5(phy_info_t *pi, u8 rx_core, ...@@ -25492,7 +25492,7 @@ wlc_phy_rxcal_gainctrl_nphy_rev5(phy_info_t *pi, u8 rx_core,
(lna2 << 2) | lna1), 0x3, (lna2 << 2) | lna1), 0x3,
0); 0);
} else { } 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), wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12),
((hpvga << 12) | (lpf_biq1 << 10) | ((hpvga << 12) | (lpf_biq1 << 10) |
(lpf_biq0 << 8) | (mix_tia_gain << (lpf_biq0 << 8) | (mix_tia_gain <<
...@@ -25663,12 +25663,12 @@ wlc_phy_rc_sweep_nphy(phy_info_t *pi, u8 core_idx, u8 loopback_type) ...@@ -25663,12 +25663,12 @@ wlc_phy_rc_sweep_nphy(phy_info_t *pi, u8 core_idx, u8 loopback_type)
if (core_idx == 0) { if (core_idx == 0) {
ref_iq_vals = ref_iq_vals =
MAX((est[0].i_pwr + max((est[0].i_pwr +
est[0].q_pwr) >> (log_num_samps + 1), est[0].q_pwr) >> (log_num_samps + 1),
1); 1);
} else { } else {
ref_iq_vals = ref_iq_vals =
MAX((est[1].i_pwr + max((est[1].i_pwr +
est[1].q_pwr) >> (log_num_samps + 1), est[1].q_pwr) >> (log_num_samps + 1),
1); 1);
} }
...@@ -25877,8 +25877,8 @@ wlc_phy_cal_rxiq_nphy_rev3(phy_info_t *pi, nphy_txgains_t target_gain, ...@@ -25877,8 +25877,8 @@ wlc_phy_cal_rxiq_nphy_rev3(phy_info_t *pi, nphy_txgains_t target_gain,
TXLPF_IDAC_4, txlpf_idac); TXLPF_IDAC_4, txlpf_idac);
} }
rxlpf_rccal_hpc = MAX(min(rxlpf_rccal_hpc, 31), 0); rxlpf_rccal_hpc = max(min(rxlpf_rccal_hpc, 31), 0);
txlpf_rccal_lpc = MAX(min(txlpf_rccal_lpc, 31), 0); txlpf_rccal_lpc = max(min(txlpf_rccal_lpc, 31), 0);
write_radio_reg(pi, (RADIO_2056_RX_RXLPF_RCCAL_HPC | write_radio_reg(pi, (RADIO_2056_RX_RXLPF_RCCAL_HPC |
((rx_core == ((rx_core ==
...@@ -26060,7 +26060,7 @@ wlc_phy_cal_rxiq_nphy_rev2(phy_info_t *pi, nphy_txgains_t target_gain, ...@@ -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; hpf_change = desired_log2_pwr - actual_log2_pwr;
curr_hpf += hpf_change; 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) { if (use_hpf_num == 1) {
curr_hpf1 = curr_hpf; curr_hpf1 = curr_hpf;
} else { } else {
...@@ -28687,12 +28687,12 @@ static void wlc_phy_txpwrctrl_pwr_setup_nphy(phy_info_t *pi) ...@@ -28687,12 +28687,12 @@ static void wlc_phy_txpwrctrl_pwr_setup_nphy(phy_info_t *pi)
num = num =
8 * (16 * b0[tbl_id - 26] + b1[tbl_id - 26] * idx); 8 * (16 * b0[tbl_id - 26] + b1[tbl_id - 26] * idx);
den = 32768 + a1[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 (NREV_LT(pi->pubpi.phy_rev, 3)) {
if (idx <= if (idx <=
(uint) (31 - idle_tssi[tbl_id - 26] + 1)) (uint) (31 - idle_tssi[tbl_id - 26] + 1))
pwr_est = pwr_est =
MAX(pwr_est, max(pwr_est,
target_pwr_qtrdbm[tbl_id - 26] + target_pwr_qtrdbm[tbl_id - 26] +
1); 1);
} }
......
...@@ -761,7 +761,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec) ...@@ -761,7 +761,7 @@ wlc_sendampdu(ampdu_info_t *ampdu, wlc_txq_info_t *qi, void **pdu, int prec)
plen = plen =
pkttotlen(osh, p) + AMPDU_MAX_MPDU_OVERHEAD; 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) { if ((plen + ampdu_len) > maxlen) {
p = NULL; p = NULL;
......
...@@ -1355,7 +1355,7 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, ...@@ -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 = li->maxpwr[CHANNEL_POWER_IDX_2G_CCK(chan)];
maxpwr = maxpwr - delta; maxpwr = maxpwr - delta;
maxpwr = MAX(maxpwr, 0); maxpwr = max(maxpwr, 0);
maxpwr = min(maxpwr, conducted_max); maxpwr = min(maxpwr, conducted_max);
for (i = 0; i < WLC_NUM_RATES_CCK; i++) for (i = 0; i < WLC_NUM_RATES_CCK; i++)
...@@ -1371,7 +1371,7 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, ...@@ -1371,7 +1371,7 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec,
} }
maxpwr = maxpwr - delta; maxpwr = maxpwr - delta;
maxpwr = MAX(maxpwr, 0); maxpwr = max(maxpwr, 0);
maxpwr = min(maxpwr, conducted_ofdm_max); maxpwr = min(maxpwr, conducted_ofdm_max);
/* Keep OFDM lmit below CCK limit */ /* Keep OFDM lmit below CCK limit */
...@@ -1413,9 +1413,9 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec, ...@@ -1413,9 +1413,9 @@ wlc_channel_reg_limits(wlc_cm_info_t *wlc_cm, chanspec_t chanspec,
maxpwr40 = li_mimo->maxpwr40[maxpwr_idx]; maxpwr40 = li_mimo->maxpwr40[maxpwr_idx];
maxpwr20 = maxpwr20 - delta; maxpwr20 = maxpwr20 - delta;
maxpwr20 = MAX(maxpwr20, 0); maxpwr20 = max(maxpwr20, 0);
maxpwr40 = maxpwr40 - delta; maxpwr40 = maxpwr40 - delta;
maxpwr40 = MAX(maxpwr40, 0); maxpwr40 = max(maxpwr40, 0);
/* Fill in the MCS 0-7 (SISO) rates */ /* Fill in the MCS 0-7 (SISO) rates */
for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) { for (i = 0; i < WLC_NUM_RATES_MCS_1_STREAM; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册