mwifiex: code rearrangement for better readability

Use negative check for 'status' and return from the function.
This improves readability by avoiding line splits. Also, local
variable is used for start window calculations.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Amitkumar Karwar 2014-03-07 19:41:29 -08:00 committed by John W. Linville
parent c44379e2f9
commit 63410c37d2
2 changed files with 29 additions and 29 deletions

View File

@ -166,21 +166,21 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
tid = (le16_to_cpu(add_ba_rsp->block_ack_param_set) tid = (le16_to_cpu(add_ba_rsp->block_ack_param_set)
& IEEE80211_ADDBA_PARAM_TID_MASK) & IEEE80211_ADDBA_PARAM_TID_MASK)
>> BLOCKACKPARAM_TID_POS; >> BLOCKACKPARAM_TID_POS;
if (le16_to_cpu(add_ba_rsp->status_code) == BA_RESULT_SUCCESS) { if (le16_to_cpu(add_ba_rsp->status_code) != BA_RESULT_SUCCESS) {
tx_ba_tbl = mwifiex_get_ba_tbl(priv, tid,
add_ba_rsp->peer_mac_addr);
if (tx_ba_tbl) {
dev_dbg(priv->adapter->dev, "info: BA stream complete\n");
tx_ba_tbl->ba_status = BA_SETUP_COMPLETE;
} else {
dev_err(priv->adapter->dev, "BA stream not created\n");
}
} else {
mwifiex_del_ba_tbl(priv, tid, add_ba_rsp->peer_mac_addr, mwifiex_del_ba_tbl(priv, tid, add_ba_rsp->peer_mac_addr,
TYPE_DELBA_SENT, true); TYPE_DELBA_SENT, true);
if (add_ba_rsp->add_rsp_result != BA_RESULT_TIMEOUT) if (add_ba_rsp->add_rsp_result != BA_RESULT_TIMEOUT)
priv->aggr_prio_tbl[tid].ampdu_ap = priv->aggr_prio_tbl[tid].ampdu_ap =
BA_STREAM_NOT_ALLOWED; BA_STREAM_NOT_ALLOWED;
return 0;
}
tx_ba_tbl = mwifiex_get_ba_tbl(priv, tid, add_ba_rsp->peer_mac_addr);
if (tx_ba_tbl) {
dev_dbg(priv->adapter->dev, "info: BA stream complete\n");
tx_ba_tbl->ba_status = BA_SETUP_COMPLETE;
} else {
dev_err(priv->adapter->dev, "BA stream not created\n");
} }
return 0; return 0;

View File

@ -135,12 +135,13 @@ mwifiex_del_rx_reorder_entry(struct mwifiex_private *priv,
struct mwifiex_rx_reorder_tbl *tbl) struct mwifiex_rx_reorder_tbl *tbl)
{ {
unsigned long flags; unsigned long flags;
int start_win;
if (!tbl) if (!tbl)
return; return;
mwifiex_11n_dispatch_pkt(priv, tbl, (tbl->start_win + tbl->win_size) & start_win = (tbl->start_win + tbl->win_size) & (MAX_TID_VALUE - 1);
(MAX_TID_VALUE - 1)); mwifiex_11n_dispatch_pkt(priv, tbl, start_win);
del_timer_sync(&tbl->timer_context.timer); del_timer_sync(&tbl->timer_context.timer);
@ -228,17 +229,16 @@ mwifiex_flush_data(unsigned long context)
{ {
struct reorder_tmr_cnxt *ctx = struct reorder_tmr_cnxt *ctx =
(struct reorder_tmr_cnxt *) context; (struct reorder_tmr_cnxt *) context;
int start_win; int start_win, seq_num;
start_win = mwifiex_11n_find_last_seq_num(ctx->ptr); seq_num = mwifiex_11n_find_last_seq_num(ctx->ptr);
if (start_win < 0) if (seq_num < 0)
return; return;
dev_dbg(ctx->priv->adapter->dev, "info: flush data %d\n", start_win); dev_dbg(ctx->priv->adapter->dev, "info: flush data %d\n", seq_num);
mwifiex_11n_dispatch_pkt(ctx->priv, ctx->ptr, start_win = (ctx->ptr->start_win + seq_num + 1) & (MAX_TID_VALUE - 1);
(ctx->ptr->start_win + start_win + 1) & mwifiex_11n_dispatch_pkt(ctx->priv, ctx->ptr, start_win);
(MAX_TID_VALUE - 1));
} }
/* /*
@ -611,16 +611,7 @@ int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
* Check if we had rejected the ADDBA, if yes then do not create * Check if we had rejected the ADDBA, if yes then do not create
* the stream * the stream
*/ */
if (le16_to_cpu(add_ba_rsp->status_code) == BA_RESULT_SUCCESS) { if (le16_to_cpu(add_ba_rsp->status_code) != BA_RESULT_SUCCESS) {
win_size = (block_ack_param_set &
IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK)
>> BLOCKACKPARAM_WINSIZE_POS;
dev_dbg(priv->adapter->dev,
"cmd: ADDBA RSP: %pM tid=%d ssn=%d win_size=%d\n",
add_ba_rsp->peer_mac_addr, tid,
add_ba_rsp->ssn, win_size);
} else {
dev_err(priv->adapter->dev, "ADDBA RSP: failed %pM tid=%d)\n", dev_err(priv->adapter->dev, "ADDBA RSP: failed %pM tid=%d)\n",
add_ba_rsp->peer_mac_addr, tid); add_ba_rsp->peer_mac_addr, tid);
@ -628,8 +619,17 @@ int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
add_ba_rsp->peer_mac_addr); add_ba_rsp->peer_mac_addr);
if (tbl) if (tbl)
mwifiex_del_rx_reorder_entry(priv, tbl); mwifiex_del_rx_reorder_entry(priv, tbl);
return 0;
} }
win_size = (block_ack_param_set & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK)
>> BLOCKACKPARAM_WINSIZE_POS;
dev_dbg(priv->adapter->dev,
"cmd: ADDBA RSP: %pM tid=%d ssn=%d win_size=%d\n",
add_ba_rsp->peer_mac_addr, tid, add_ba_rsp->ssn, win_size);
return 0; return 0;
} }