From: Alex Briskin <br.shurik@gmail.com>
To: linux-wireless@vger.kernel.org, johannes@sipsolutions.net
Cc: Alex Briskin <br.shurik@gmail.com>
Subject: [PATCH 2/4 v1] even better readability
Date: Wed, 13 Jul 2016 23:19:54 +0300 [thread overview]
Message-ID: <1468441196-23503-3-git-send-email-br.shurik@gmail.com> (raw)
In-Reply-To: <1468441196-23503-1-git-send-email-br.shurik@gmail.com>
Further improve readability by replacing if else with switch case
Signed-off-by: Alex Briskin <br.shurik@gmail.com>
---
net/mac80211/iface.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index a68cbac..1793ad2 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1207,13 +1207,16 @@ static bool ieee80211_is_skb_handled_by_pkt_type(struct sk_buff *skb,
struct ieee80211_local *local = sdata->local;
struct sta_info *sta;
- if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_START) {
+ switch (skb->pkt_type) {
+ case IEEE80211_SDATA_QUEUE_AGG_START:
ra_tid = (void *)&skb->cb;
ieee80211_start_tx_ba_cb(&sdata->vif, ra_tid->ra, ra_tid->tid);
- } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_STOP) {
+ break;
+ case IEEE80211_SDATA_QUEUE_AGG_STOP:
ra_tid = (void *)&skb->cb;
ieee80211_stop_tx_ba_cb(&sdata->vif, ra_tid->ra, ra_tid->tid);
- } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_START) {
+ break;
+ case IEEE80211_SDATA_QUEUE_RX_AGG_START:
rx_agg = (void *)&skb->cb;
mutex_lock(&local->sta_mtx);
sta = sta_info_get_bss(sdata, rx_agg->addr);
@@ -1223,7 +1226,8 @@ static bool ieee80211_is_skb_handled_by_pkt_type(struct sk_buff *skb,
IEEE80211_MAX_AMPDU_BUF,
false, true);
mutex_unlock(&local->sta_mtx);
- } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_STOP) {
+ break;
+ case IEEE80211_SDATA_QUEUE_RX_AGG_STOP:
rx_agg = (void *)&skb->cb;
mutex_lock(&local->sta_mtx);
sta = sta_info_get_bss(sdata, rx_agg->addr);
@@ -1233,7 +1237,8 @@ static bool ieee80211_is_skb_handled_by_pkt_type(struct sk_buff *skb,
WLAN_BACK_RECIPIENT, 0,
false);
mutex_unlock(&local->sta_mtx);
- } else {
+ break;
+ default:
return false;
}
/*will return true if pkt_type found and handled */
--
2.5.0
next prev parent reply other threads:[~2016-07-13 20:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-13 20:19 [PATCH 0/4 v1] Refactoring ieee80211_iface_work Alex Briskin
2016-07-13 20:19 ` [PATCH 1/4 v1] Refactoring ieee80211_iface_work to reduce complexity and improve readability Alex Briskin
2016-07-13 20:19 ` Alex Briskin [this message]
2016-07-13 20:19 ` [PATCH 3/4 v1] Continue breaking down to smaller functions Alex Briskin
2016-07-13 20:41 ` kbuild test robot
2016-07-13 20:19 ` [PATCH 4/4 v1] Simple and well understood logic Alex Briskin
2016-07-14 7:56 ` [PATCH 0/4 v1] Refactoring ieee80211_iface_work Arend Van Spriel
2016-07-14 13:04 ` Alex Briskin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1468441196-23503-3-git-send-email-br.shurik@gmail.com \
--to=br.shurik@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.