Commit bb7de2ba authored by Yogesh Ashok Powar's avatar Yogesh Ashok Powar Committed by John W. Linville

mwifiex: rearrange if and else blocks to avoid extra indentation

This adds better readability.
Signed-off-by: default avatarYogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e7891ba2
...@@ -205,14 +205,17 @@ mwifiex_flush_data(unsigned long context) ...@@ -205,14 +205,17 @@ mwifiex_flush_data(unsigned long context)
int start_win; int start_win;
start_win = mwifiex_11n_find_last_seq_num(reorder_cnxt->ptr); start_win = mwifiex_11n_find_last_seq_num(reorder_cnxt->ptr);
if (start_win >= 0) {
dev_dbg(reorder_cnxt->priv->adapter->dev, if (start_win < 0)
"info: flush data %d\n", start_win); 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, mwifiex_11n_dispatch_pkt_until_start_win(reorder_cnxt->priv,
reorder_cnxt->ptr, reorder_cnxt->ptr,
((reorder_cnxt->ptr->start_win + ((reorder_cnxt->ptr->start_win
start_win + 1) & (MAX_TID_VALUE - 1))); + start_win + 1) &
} (MAX_TID_VALUE - 1)));
} }
/* /*
......
...@@ -327,31 +327,26 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, ...@@ -327,31 +327,26 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
HostCmd_CMD_802_11_TX_RATE_QUERY, HostCmd_CMD_802_11_TX_RATE_QUERY,
HostCmd_ACT_GEN_GET, 0, NULL); HostCmd_ACT_GEN_GET, 0, NULL);
if (ds_rate) { if (!ds_rate)
if (le16_to_cpu(rate_cfg->action) == HostCmd_ACT_GEN_GET) { return ret;
if (priv->is_data_rate_auto) {
ds_rate->is_rate_auto = 1; if (le16_to_cpu(rate_cfg->action) == HostCmd_ACT_GEN_GET) {
} else { if (priv->is_data_rate_auto) {
ds_rate->rate = mwifiex_get_rate_index(priv-> ds_rate->is_rate_auto = 1;
bitmap_rates, return ret;
sizeof(priv-> }
bitmap_rates)); ds_rate->rate = mwifiex_get_rate_index(priv->bitmap_rates,
if (ds_rate->rate >= sizeof(priv->bitmap_rates));
MWIFIEX_RATE_BITMAP_OFDM0
&& ds_rate->rate <= if (ds_rate->rate >= MWIFIEX_RATE_BITMAP_OFDM0 &&
MWIFIEX_RATE_BITMAP_OFDM7) ds_rate->rate <= MWIFIEX_RATE_BITMAP_OFDM7)
ds_rate->rate -= ds_rate->rate -= (MWIFIEX_RATE_BITMAP_OFDM0 -
(MWIFIEX_RATE_BITMAP_OFDM0 - MWIFIEX_RATE_INDEX_OFDM0);
MWIFIEX_RATE_INDEX_OFDM0);
if (ds_rate->rate >= if (ds_rate->rate >= MWIFIEX_RATE_BITMAP_MCS0 &&
MWIFIEX_RATE_BITMAP_MCS0 ds_rate->rate <= MWIFIEX_RATE_BITMAP_MCS127)
&& ds_rate->rate <= ds_rate->rate -= (MWIFIEX_RATE_BITMAP_MCS0 -
MWIFIEX_RATE_BITMAP_MCS127) MWIFIEX_RATE_INDEX_MCS0);
ds_rate->rate -=
(MWIFIEX_RATE_BITMAP_MCS0 -
MWIFIEX_RATE_INDEX_MCS0);
}
}
} }
return ret; return ret;
...@@ -369,34 +364,32 @@ static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf) ...@@ -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_types_power_group *pg_tlv_hdr;
struct mwifiex_power_group *pg; struct mwifiex_power_group *pg;
if (data_buf) { if (!data_buf)
pg_tlv_hdr = return -1;
(struct mwifiex_types_power_group *) ((u8 *) data_buf
+ sizeof(struct host_cmd_ds_txpwr_cfg)); pg_tlv_hdr = (struct mwifiex_types_power_group *)
pg = (struct mwifiex_power_group *) ((u8 *) pg_tlv_hdr + ((u8 *) data_buf + sizeof(struct host_cmd_ds_txpwr_cfg));
sizeof(struct mwifiex_types_power_group)); pg = (struct mwifiex_power_group *)
length = pg_tlv_hdr->length; ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group));
if (length > 0) { 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; 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) if (min_power > pg->power_min)
min_power = pg->power_min; min_power = pg->power_min;
length -= sizeof(struct mwifiex_power_group); length -= sizeof(struct mwifiex_power_group);
} }
if (pg_tlv_hdr->length > 0) { if (pg_tlv_hdr->length > 0) {
priv->min_tx_power_level = (u8) min_power; priv->min_tx_power_level = (u8) min_power;
priv->max_tx_power_level = (u8) max_power; priv->max_tx_power_level = (u8) max_power;
}
} else {
return -1;
} }
return 0; return 0;
......
...@@ -850,6 +850,7 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter, ...@@ -850,6 +850,7 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
struct mwifiex_ra_list_tbl *ptr, *head; struct mwifiex_ra_list_tbl *ptr, *head;
struct mwifiex_bss_prio_node *bssprio_node, *bssprio_head; struct mwifiex_bss_prio_node *bssprio_node, *bssprio_head;
struct mwifiex_tid_tbl *tid_ptr; struct mwifiex_tid_tbl *tid_ptr;
atomic_t *hqp;
int is_list_empty; int is_list_empty;
unsigned long flags; unsigned long flags;
int i, j; int i, j;
...@@ -879,12 +880,8 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter, ...@@ -879,12 +880,8 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
} }
do { do {
atomic_t *hqp;
spinlock_t *lock;
priv_tmp = bssprio_node->priv; priv_tmp = bssprio_node->priv;
hqp = &priv_tmp->wmm.highest_queued_prio; hqp = &priv_tmp->wmm.highest_queued_prio;
lock = &priv_tmp->wmm.ra_list_spinlock;
for (i = atomic_read(hqp); i >= LOW_PRIO_TID; --i) { for (i = atomic_read(hqp); i >= LOW_PRIO_TID; --i) {
...@@ -923,16 +920,10 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter, ...@@ -923,16 +920,10 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
do { do {
is_list_empty = is_list_empty =
skb_queue_empty(&ptr->skb_head); skb_queue_empty(&ptr->skb_head);
if (!is_list_empty) {
spin_lock_irqsave(lock, flags); if (!is_list_empty)
if (atomic_read(hqp) > i) goto found;
atomic_set(hqp, i);
spin_unlock_irqrestore(lock,
flags);
*priv = priv_tmp;
*tid = tos_to_tid[i];
return ptr;
}
/* Get next ra */ /* Get next ra */
ptr = list_first_entry(&ptr->list, ptr = list_first_entry(&ptr->list,
struct mwifiex_ra_list_tbl, struct mwifiex_ra_list_tbl,
...@@ -969,6 +960,17 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter, ...@@ -969,6 +960,17 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
} while (bssprio_node != bssprio_head); } while (bssprio_node != bssprio_head);
} }
return NULL; 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;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment