Skip to content

Commit

Permalink
iwlegacy: remove not needed parentheses
Browse files Browse the repository at this point in the history
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
  • Loading branch information
Stanislaw Gruszka committed Nov 15, 2011
1 parent db54eb5 commit 232913b
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 182 deletions.
4 changes: 2 additions & 2 deletions drivers/net/wireless/iwlegacy/iwl-3945-hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ struct il3945_eeprom {

static inline int il3945_hw_valid_rtc_data_addr(u32 addr)
{
return (addr >= IWL39_RTC_DATA_LOWER_BOUND) &&
(addr < IWL39_RTC_DATA_UPPER_BOUND);
return (addr >= IWL39_RTC_DATA_LOWER_BOUND &&
addr < IWL39_RTC_DATA_UPPER_BOUND);
}

/* Base physical address of il3945_shared is provided to FH_TSSR_CBB_BASE
Expand Down
40 changes: 20 additions & 20 deletions drivers/net/wireless/iwlegacy/iwl-3945-rs.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band)
u32 table_size = 0;
struct il3945_tpt_entry *tpt_table = NULL;

if ((rssi < IL_MIN_RSSI_VAL) || (rssi > IL_MAX_RSSI_VAL))
if (rssi < IL_MIN_RSSI_VAL || rssi > IL_MAX_RSSI_VAL)
rssi = IL_MIN_RSSI_VAL;

switch (band) {
Expand All @@ -123,7 +123,7 @@ static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band)
break;
}

while ((index < table_size) && (rssi < tpt_table[index].min_rssi))
while (index < table_size && rssi < tpt_table[index].min_rssi)
index++;

index = min(index, (table_size - 1));
Expand Down Expand Up @@ -315,8 +315,8 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
fail_count = window->counter - window->success_counter;

/* Calculate average throughput, if we have enough history. */
if ((fail_count >= IL_RATE_MIN_FAILURE_TH) ||
(window->success_counter >= IL_RATE_MIN_SUCCESS_TH))
if (fail_count >= IL_RATE_MIN_FAILURE_TH ||
window->success_counter >= IL_RATE_MIN_SUCCESS_TH)
window->average_tpt = ((window->success_ratio *
rs_sta->expected_tpt[index] + 64) / 128);
else
Expand Down Expand Up @@ -461,7 +461,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
retries = IL_RATE_RETRY_TH;

first_index = sband->bitrates[info->status.rates[0].idx].hw_value;
if ((first_index < 0) || (first_index >= IL_RATE_COUNT_3945)) {
if (first_index < 0 || first_index >= IL_RATE_COUNT_3945) {
D_RATE("leave: Rate out of bounds: %d\n", first_index);
return;
}
Expand Down Expand Up @@ -663,9 +663,9 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,

/* get user max rate if set */
max_rate_idx = txrc->max_rate_idx;
if ((sband->band == IEEE80211_BAND_5GHZ) && (max_rate_idx != -1))
if (sband->band == IEEE80211_BAND_5GHZ && max_rate_idx != -1)
max_rate_idx += IL_FIRST_OFDM_RATE;
if ((max_rate_idx < 0) || (max_rate_idx >= IL_RATE_COUNT))
if (max_rate_idx < 0 || max_rate_idx >= IL_RATE_COUNT)
max_rate_idx = -1;

index = min(rs_sta->last_txrate_idx & 0xffff, IL_RATE_COUNT_3945 - 1);
Expand All @@ -686,7 +686,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
}

/* force user max rate if set by user */
if ((max_rate_idx != -1) && (max_rate_idx < index)) {
if (max_rate_idx != -1 && max_rate_idx < index) {
if (rate_mask & (1 << max_rate_idx))
index = max_rate_idx;
}
Expand All @@ -695,8 +695,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,

fail_count = window->counter - window->success_counter;

if (((fail_count < IL_RATE_MIN_FAILURE_TH) &&
(window->success_counter < IL_RATE_MIN_SUCCESS_TH))) {
if (fail_count < IL_RATE_MIN_FAILURE_TH &&
window->success_counter < IL_RATE_MIN_SUCCESS_TH) {
spin_unlock_irqrestore(&rs_sta->lock, flags);

D_RATE("Invalid average_tpt on rate %d: "
Expand All @@ -721,7 +721,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
high = (high_low >> 8) & 0xff;

/* If user set max rate, dont allow higher than user constrain */
if ((max_rate_idx != -1) && (max_rate_idx < high))
if (max_rate_idx != -1 && max_rate_idx < high)
high = IL_RATE_INVALID;

/* Collect Measured throughputs of adjacent rates */
Expand All @@ -736,13 +736,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
scale_action = 0;

/* Low success ratio , need to drop the rate */
if ((window->success_ratio < IL_RATE_DECREASE_TH) || !current_tpt) {
if (window->success_ratio < IL_RATE_DECREASE_TH || !current_tpt) {
D_RATE("decrease rate because of low success_ratio\n");
scale_action = -1;
/* No throughput measured yet for adjacent rates,
* try increase */
} else if ((low_tpt == IL_INVALID_VALUE) &&
(high_tpt == IL_INVALID_VALUE)) {
} else if (low_tpt == IL_INVALID_VALUE &&
high_tpt == IL_INVALID_VALUE) {

if (high != IL_RATE_INVALID && window->success_ratio >= IL_RATE_INCREASE_TH)
scale_action = 1;
Expand All @@ -752,9 +752,9 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
/* Both adjacent throughputs are measured, but neither one has
* better throughput; we're using the best rate, don't change
* it! */
} else if ((low_tpt != IL_INVALID_VALUE) &&
(high_tpt != IL_INVALID_VALUE) &&
(low_tpt < current_tpt) && (high_tpt < current_tpt)) {
} else if (low_tpt != IL_INVALID_VALUE &&
high_tpt != IL_INVALID_VALUE &&
low_tpt < current_tpt && high_tpt < current_tpt) {

D_RATE("No action -- low [%d] & high [%d] < "
"current_tpt [%d]\n",
Expand Down Expand Up @@ -790,9 +790,9 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,

/* Sanity check; asked for decrease, but success rate or throughput
* has been good at old rate. Don't change it. */
if ((scale_action == -1) && (low != IL_RATE_INVALID) &&
((window->success_ratio > IL_RATE_HIGH_TH) ||
(current_tpt > (100 * rs_sta->expected_tpt[low]))))
if (scale_action == -1 && low != IL_RATE_INVALID &&
(window->success_ratio > IL_RATE_HIGH_TH ||
current_tpt > 100 * rs_sta->expected_tpt[low]))
scale_action = 0;

switch (scale_action) {
Expand Down
25 changes: 12 additions & 13 deletions drivers/net/wireless/iwlegacy/iwl-3945.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void il3945_disable_events(struct il_priv *il)
disable_ptr = il_read_targ_mem(il, base + (4 * sizeof(u32)));
array_size = il_read_targ_mem(il, base + (5 * sizeof(u32)));

if (IL_EVT_DISABLE && (array_size == IL_EVT_DISABLE_SIZE)) {
if (IL_EVT_DISABLE && array_size == IL_EVT_DISABLE_SIZE) {
D_INFO("Disabling selected uCode log events at 0x%x\n",
disable_ptr);
for (i = 0; i < IL_EVT_DISABLE_SIZE; i++)
Expand Down Expand Up @@ -293,9 +293,8 @@ static void il3945_tx_queue_reclaim(struct il_priv *il,
il->cfg->ops->lib->txq_free_tfd(il, txq);
}

if (il_queue_space(q) > q->low_mark && (txq_id >= 0) &&
(txq_id != IWL39_CMD_QUEUE_NUM) &&
il->mac80211_registered)
if (il_queue_space(q) > q->low_mark && txq_id >= 0 &&
txq_id != IWL39_CMD_QUEUE_NUM && il->mac80211_registered)
il_wake_queue(il, txq);
}

Expand All @@ -316,7 +315,7 @@ static void il3945_rx_reply_tx(struct il_priv *il,
int rate_idx;
int fail;

if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) {
if (index >= txq->q.n_bd || il_queue_used(&txq->q, index) == 0) {
IL_ERR("Read index for DMA queue txq_id (%d) index %d "
"is out of range [0-%d] %d %d\n", txq_id,
index, txq->q.n_bd, txq->q.write_ptr,
Expand Down Expand Up @@ -544,8 +543,8 @@ static void il3945_rx_reply_rx(struct il_priv *il,
return;
}

if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR)
|| !(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) {
if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR) ||
!(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) {
D_RX("Bad CRC or FIFO: 0x%08X.\n", rx_end->status);
return;
}
Expand Down Expand Up @@ -599,7 +598,7 @@ int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il,

count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));

if ((count >= NUM_TFD_CHUNKS) || (count < 0)) {
if (count >= NUM_TFD_CHUNKS || count < 0) {
IL_ERR("Error can not send more than %d chunks\n",
NUM_TFD_CHUNKS);
return -EINVAL;
Expand Down Expand Up @@ -1053,7 +1052,7 @@ static int il3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading)
*/
static inline int il3945_hw_reg_temp_out_of_range(int temperature)
{
return ((temperature < -260) || (temperature > 25)) ? 1 : 0;
return (temperature < -260 || temperature > 25) ? 1 : 0;
}

int il3945_hw_get_temperature(struct il_priv *il)
Expand Down Expand Up @@ -1666,10 +1665,10 @@ static int il3945_send_rxon_assoc(struct il_priv *il,
const struct il_rxon_cmd *rxon1 = &ctx->staging;
const struct il_rxon_cmd *rxon2 = &ctx->active;

if ((rxon1->flags == rxon2->flags) &&
(rxon1->filter_flags == rxon2->filter_flags) &&
(rxon1->cck_basic_rates == rxon2->cck_basic_rates) &&
(rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) {
if (rxon1->flags == rxon2->flags &&
rxon1->filter_flags == rxon2->filter_flags &&
rxon1->cck_basic_rates == rxon2->cck_basic_rates &&
rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates) {
D_INFO("Using current RXON_ASSOC. Not resending.\n");
return 0;
}
Expand Down
27 changes: 13 additions & 14 deletions drivers/net/wireless/iwlegacy/iwl-4965-calib.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ static int il4965_sens_energy_cck(struct il_priv *il,
data->num_in_cck_no_fa);

/* If we got too many false alarms this time, reduce sensitivity */
if ((false_alarms > max_false_alarms) &&
(data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK)) {
if (false_alarms > max_false_alarms &&
data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK) {
D_CALIB("norm FA %u > max FA %u\n",
false_alarms, max_false_alarms);
D_CALIB("... reducing sensitivity\n");
Expand Down Expand Up @@ -230,9 +230,9 @@ static int il4965_sens_energy_cck(struct il_priv *il,
* from a previous beacon with too many, or healthy # FAs
* OR 2) We've seen a lot of beacons (100) with too few
* false alarms */
if ((data->nrg_prev_state != IL_FA_TOO_MANY) &&
((data->nrg_auto_corr_silence_diff > NRG_DIFF) ||
(data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) {
if (data->nrg_prev_state != IL_FA_TOO_MANY &&
(data->nrg_auto_corr_silence_diff > NRG_DIFF ||
data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA)) {

D_CALIB("... increasing sensitivity\n");
/* Increase nrg value to increase sensitivity */
Expand Down Expand Up @@ -289,9 +289,9 @@ static int il4965_sens_energy_cck(struct il_priv *il,
val = data->auto_corr_cck_mrc + AUTO_CORR_STEP_CCK;
data->auto_corr_cck_mrc =
min((u32)ranges->auto_corr_max_cck_mrc, val);
} else if ((false_alarms < min_false_alarms) &&
((data->nrg_auto_corr_silence_diff > NRG_DIFF) ||
(data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) {
} else if (false_alarms < min_false_alarms &&
(data->nrg_auto_corr_silence_diff > NRG_DIFF ||
data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA)) {

/* Decrease auto_corr values to increase sensitivity */
val = data->auto_corr_cck - AUTO_CORR_STEP_CCK;
Expand Down Expand Up @@ -747,9 +747,8 @@ static void il4965_gain_computation(struct il_priv *il,
for (i = default_chain; i < NUM_RX_CHAINS; i++) {
s32 delta_g = 0;

if (!(data->disconn_array[i]) &&
(data->delta_gain_code[i] ==
CHAIN_NOISE_DELTA_GAIN_INIT_VAL)) {
if (!data->disconn_array[i] &&
data->delta_gain_code[i] == CHAIN_NOISE_DELTA_GAIN_INIT_VAL) {
delta_g = average_noise[i] - min_average_noise;
data->delta_gain_code[i] = (u8)((delta_g * 10) / 15);
data->delta_gain_code[i] =
Expand Down Expand Up @@ -860,7 +859,7 @@ void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)

/* Make sure we accumulate data for just the associated channel
* (even if scanning). */
if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) {
if (rxon_chnum != stat_chnum || rxon_band24 != stat_band24) {
D_CALIB("Stats not from chan=%d, band24=%d\n",
rxon_chnum, rxon_band24);
spin_unlock_irqrestore(&il->lock, flags);
Expand Down Expand Up @@ -920,8 +919,8 @@ void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)
il->cfg->base_params->chain_noise_num_beacons;

for (i = 0; i < NUM_RX_CHAINS; i++) {
if (!(data->disconn_array[i]) &&
(average_noise[i] <= min_average_noise)) {
if (!data->disconn_array[i] &&
average_noise[i] <= min_average_noise) {
/* This means that chain i is active and has
* lower noise values so far: */
min_average_noise = average_noise[i];
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/wireless/iwlegacy/iwl-4965-hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@

static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
{
return (addr >= IWL49_RTC_DATA_LOWER_BOUND) &&
(addr < IWL49_RTC_DATA_UPPER_BOUND);
return (addr >= IWL49_RTC_DATA_LOWER_BOUND &&
addr < IWL49_RTC_DATA_UPPER_BOUND);
}

/********************* START TEMPERATURE *************************************/
Expand Down Expand Up @@ -147,8 +147,8 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
#define IL_TX_POWER_TEMPERATURE_MAX (410)

#define IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \
(((t) < IL_TX_POWER_TEMPERATURE_MIN) || \
((t) > IL_TX_POWER_TEMPERATURE_MAX))
((t) < IL_TX_POWER_TEMPERATURE_MIN || \
(t) > IL_TX_POWER_TEMPERATURE_MAX)

/********************* END TEMPERATURE ***************************************/

Expand Down
6 changes: 3 additions & 3 deletions drivers/net/wireless/iwlegacy/iwl-4965-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void il4965_rx_queue_restock(struct il_priv *il)
unsigned long flags;

spin_lock_irqsave(&rxq->lock, flags);
while ((il_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
while (il_rx_queue_space(rxq) > 0 && rxq->free_count) {
/* The overwritten rxb must be a used one */
rxb = rxq->queue[rxq->write];
BUG_ON(rxb && rxb->page);
Expand Down Expand Up @@ -307,7 +307,7 @@ static void il4965_rx_allocate(struct il_priv *il, gfp_t priority)
"order: %d\n",
il->hw_params.rx_page_order);

if ((rxq->free_count <= RX_LOW_WATERMARK) &&
if (rxq->free_count <= RX_LOW_WATERMARK &&
net_ratelimit())
IL_ERR(
"Failed to alloc_pages with %s. "
Expand Down Expand Up @@ -1106,7 +1106,7 @@ void il4965_set_rxon_chain(struct il_priv *il, struct il_rxon_context *ctx)

ctx->staging.rx_chain = cpu_to_le16(rx_chain);

if (!is_single && (active_rx_cnt >= IL_NUM_RX_CHAINS_SINGLE) && is_cam)
if (!is_single && active_rx_cnt >= IL_NUM_RX_CHAINS_SINGLE && is_cam)
ctx->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK;
else
ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK;
Expand Down
Loading

0 comments on commit 232913b

Please sign in to comment.