summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYogesh Ashok Powar <yogeshp@marvell.com>2012-03-13 02:35:12 (GMT)
committerJohn W. Linville <linville@tuxdriver.com>2012-03-13 18:54:18 (GMT)
commitbb7de2bad5cb527e5fdc6b64d7f5d6e5009f2962 (patch)
tree9e04f783ffc2b0af2ed0ddb6de5e8438aedaac02 /drivers
parente7891ba2de9a67f22e5fd2a137f98d89cfb71348 (diff)
downloadlinux-fsl-qoriq-bb7de2bad5cb527e5fdc6b64d7f5d6e5009f2962.tar.xz
mwifiex: rearrange if and else blocks to avoid extra indentation
This adds better readability. Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/mwifiex/11n_rxreorder.c15
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmdresp.c93
-rw-r--r--drivers/net/wireless/mwifiex/wmm.c30
3 files changed, 68 insertions, 70 deletions
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c
index ad41fab..491cd85 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c
@@ -205,14 +205,17 @@ mwifiex_flush_data(unsigned long context)
int start_win;
start_win = mwifiex_11n_find_last_seq_num(reorder_cnxt->ptr);
- if (start_win >= 0) {
- dev_dbg(reorder_cnxt->priv->adapter->dev,
- "info: flush data %d\n", start_win);
+
+ if (start_win < 0)
+ return;
+
+ dev_dbg(reorder_cnxt->priv->adapter->dev, "info: flush data %d\n",
+ start_win);
mwifiex_11n_dispatch_pkt_until_start_win(reorder_cnxt->priv,
reorder_cnxt->ptr,
- ((reorder_cnxt->ptr->start_win +
- start_win + 1) & (MAX_TID_VALUE - 1)));
- }
+ ((reorder_cnxt->ptr->start_win
+ + start_win + 1) &
+ (MAX_TID_VALUE - 1)));
}
/*
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index 3f13ff0..a2a9c51 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -327,31 +327,26 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
HostCmd_CMD_802_11_TX_RATE_QUERY,
HostCmd_ACT_GEN_GET, 0, NULL);
- if (ds_rate) {
- if (le16_to_cpu(rate_cfg->action) == HostCmd_ACT_GEN_GET) {
- if (priv->is_data_rate_auto) {
- ds_rate->is_rate_auto = 1;
- } else {
- ds_rate->rate = mwifiex_get_rate_index(priv->
- bitmap_rates,
- sizeof(priv->
- bitmap_rates));
- if (ds_rate->rate >=
- MWIFIEX_RATE_BITMAP_OFDM0
- && ds_rate->rate <=
- MWIFIEX_RATE_BITMAP_OFDM7)
- ds_rate->rate -=
- (MWIFIEX_RATE_BITMAP_OFDM0 -
- MWIFIEX_RATE_INDEX_OFDM0);
- if (ds_rate->rate >=
- MWIFIEX_RATE_BITMAP_MCS0
- && ds_rate->rate <=
- MWIFIEX_RATE_BITMAP_MCS127)
- ds_rate->rate -=
- (MWIFIEX_RATE_BITMAP_MCS0 -
- MWIFIEX_RATE_INDEX_MCS0);
- }
- }
+ if (!ds_rate)
+ return ret;
+
+ if (le16_to_cpu(rate_cfg->action) == HostCmd_ACT_GEN_GET) {
+ if (priv->is_data_rate_auto) {
+ ds_rate->is_rate_auto = 1;
+ return ret;
+ }
+ ds_rate->rate = mwifiex_get_rate_index(priv->bitmap_rates,
+ sizeof(priv->bitmap_rates));
+
+ if (ds_rate->rate >= MWIFIEX_RATE_BITMAP_OFDM0 &&
+ ds_rate->rate <= MWIFIEX_RATE_BITMAP_OFDM7)
+ ds_rate->rate -= (MWIFIEX_RATE_BITMAP_OFDM0 -
+ MWIFIEX_RATE_INDEX_OFDM0);
+
+ if (ds_rate->rate >= MWIFIEX_RATE_BITMAP_MCS0 &&
+ ds_rate->rate <= MWIFIEX_RATE_BITMAP_MCS127)
+ ds_rate->rate -= (MWIFIEX_RATE_BITMAP_MCS0 -
+ MWIFIEX_RATE_INDEX_MCS0);
}
return ret;
@@ -369,34 +364,32 @@ static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)
struct mwifiex_types_power_group *pg_tlv_hdr;
struct mwifiex_power_group *pg;
- if (data_buf) {
- pg_tlv_hdr =
- (struct mwifiex_types_power_group *) ((u8 *) data_buf
- + sizeof(struct host_cmd_ds_txpwr_cfg));
- pg = (struct mwifiex_power_group *) ((u8 *) pg_tlv_hdr +
- sizeof(struct mwifiex_types_power_group));
- length = pg_tlv_hdr->length;
- if (length > 0) {
+ if (!data_buf)
+ return -1;
+
+ pg_tlv_hdr = (struct mwifiex_types_power_group *)
+ ((u8 *) data_buf + sizeof(struct host_cmd_ds_txpwr_cfg));
+ pg = (struct mwifiex_power_group *)
+ ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group));
+ length = pg_tlv_hdr->length;
+ if (length > 0) {
+ max_power = pg->power_max;
+ min_power = pg->power_min;
+ length -= sizeof(struct mwifiex_power_group);
+ }
+ while (length) {
+ pg++;
+ if (max_power < pg->power_max)
max_power = pg->power_max;
- min_power = pg->power_min;
- length -= sizeof(struct mwifiex_power_group);
- }
- while (length) {
- pg++;
- if (max_power < pg->power_max)
- max_power = pg->power_max;
- if (min_power > pg->power_min)
- min_power = pg->power_min;
+ if (min_power > pg->power_min)
+ min_power = pg->power_min;
- length -= sizeof(struct mwifiex_power_group);
- }
- if (pg_tlv_hdr->length > 0) {
- priv->min_tx_power_level = (u8) min_power;
- priv->max_tx_power_level = (u8) max_power;
- }
- } else {
- return -1;
+ length -= sizeof(struct mwifiex_power_group);
+ }
+ if (pg_tlv_hdr->length > 0) {
+ priv->min_tx_power_level = (u8) min_power;
+ priv->max_tx_power_level = (u8) max_power;
}
return 0;
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 5757ebd..6f0cc21 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -850,6 +850,7 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
struct mwifiex_ra_list_tbl *ptr, *head;
struct mwifiex_bss_prio_node *bssprio_node, *bssprio_head;
struct mwifiex_tid_tbl *tid_ptr;
+ atomic_t *hqp;
int is_list_empty;
unsigned long flags;
int i, j;
@@ -879,12 +880,8 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
}
do {
- atomic_t *hqp;
- spinlock_t *lock;
-
priv_tmp = bssprio_node->priv;
hqp = &priv_tmp->wmm.highest_queued_prio;
- lock = &priv_tmp->wmm.ra_list_spinlock;
for (i = atomic_read(hqp); i >= LOW_PRIO_TID; --i) {
@@ -923,16 +920,10 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
do {
is_list_empty =
skb_queue_empty(&ptr->skb_head);
- if (!is_list_empty) {
- spin_lock_irqsave(lock, flags);
- if (atomic_read(hqp) > i)
- atomic_set(hqp, i);
- spin_unlock_irqrestore(lock,
- flags);
- *priv = priv_tmp;
- *tid = tos_to_tid[i];
- return ptr;
- }
+
+ if (!is_list_empty)
+ goto found;
+
/* Get next ra */
ptr = list_first_entry(&ptr->list,
struct mwifiex_ra_list_tbl,
@@ -969,6 +960,17 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
} while (bssprio_node != bssprio_head);
}
return NULL;
+
+found:
+ spin_lock_irqsave(&priv_tmp->wmm.ra_list_spinlock, flags);
+ if (atomic_read(hqp) > i)
+ atomic_set(hqp, i);
+ spin_unlock_irqrestore(&priv_tmp->wmm.ra_list_spinlock, flags);
+
+ *priv = priv_tmp;
+ *tid = tos_to_tid[i];
+
+ return ptr;
}
/*