Skip to contentSkip to conversation

wlcore: a couple of small clean-ups

PATCH Applied Luciano Coelho 1 participant 4 messages Nov 20, 2012 – Nov 28, 2012 TI wilink wireless drivers

lore
Share & tools
lore
#0 lore raw

cover wlcore: a couple of small clean-ups

Hi,

Just a couple of patches cleaning up things I bumped into.

Luca.

Luciano Coelho (2):
wlcore: avoid using goto in normal code flow
wlcore: remove a bunch of unnecessary parentheses

 drivers/net/wireless/ti/wlcore/main.c |   37 +++++++++++++++++----------------
 1 file changed, 19 insertions(+), 18 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/2 wlcore: avoid using goto in normal code flow

Remove goto and label in the code where a simple if can be used. If nothing else, this is at least confusing git diff, which shows the label name as the name of the function.

---
 drivers/net/wireless/ti/wlcore/main.c |   27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/net/wireless/ti/wlcore/main.c +14 -13
index 0eb739b..c056bb3 100644
@@ -3884,19 +3884,20 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
 	if (changed & (BSS_CHANGED_ASSOC | BSS_CHANGED_HT)) {
 		rcu_read_lock();
 		sta = ieee80211_find_sta(vif, bss_conf->bssid);
-		if (!sta)
-			goto sta_not_found;
-
-		/* save the supp_rates of the ap */
-		sta_rate_set = sta->supp_rates[wl->hw->conf.channel->band];
-		if (sta->ht_cap.ht_supported)
-			sta_rate_set |=
-			  (sta->ht_cap.mcs.rx_mask[0] << HW_HT_RATES_OFFSET) |
-			  (sta->ht_cap.mcs.rx_mask[1] << HW_MIMO_RATES_OFFSET);
-		sta_ht_cap = sta->ht_cap;
-		sta_exists = true;
-
-sta_not_found:
+		if (sta) {
+			u8 *rx_mask = sta->ht_cap.mcs.rx_mask;
+
+			/* save the supp_rates of the ap */
+			sta_rate_set =
+				sta->supp_rates[wl->hw->conf.channel->band];
+			if (sta->ht_cap.ht_supported)
+				sta_rate_set |=
+					(rx_mask[0] << HW_HT_RATES_OFFSET) |
+					(rx_mask[1] << HW_MIMO_RATES_OFFSET);
+			sta_ht_cap = sta->ht_cap;
+			sta_exists = true;
+		}
+
 		rcu_read_unlock();
 	}
 
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/2 wlcore: remove a bunch of unnecessary parentheses

In reply to Luciano Coelho

Some if statements had unnecessary parentheses. Remove them for consistency.

---
 drivers/net/wireless/ti/wlcore/main.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ti/wlcore/main.c +5 -5
index c056bb3..11d20b1 100644
@@ -3692,7 +3692,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl,
 	bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS);
 	int ret = 0;
 
-	if ((changed & BSS_CHANGED_BEACON_INT)) {
+	if (changed & BSS_CHANGED_BEACON_INT) {
 		wl1271_debug(DEBUG_MASTER, "beacon interval updated: %d",
 			bss_conf->beacon_int);
 
@@ -3705,7 +3705,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl,
 		wl1271_ap_set_probe_resp_tmpl(wl, rate, vif);
 	}
 
-	if ((changed & BSS_CHANGED_BEACON)) {
+	if (changed & BSS_CHANGED_BEACON) {
 		ret = wlcore_set_beacon_template(wl, vif, is_ap);
 		if (ret < 0)
 			goto out;
@@ -3726,7 +3726,7 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl,
 	struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
 	int ret = 0;
 
-	if ((changed & BSS_CHANGED_BASIC_RATES)) {
+	if (changed & BSS_CHANGED_BASIC_RATES) {
 		u32 rates = bss_conf->basic_rates;
 
 		wlvif->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates,
@@ -3858,7 +3858,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
 			wl1271_warning("idle mode change failed %d", ret);
 	}
 
-	if ((changed & BSS_CHANGED_CQM)) {
+	if (changed & BSS_CHANGED_CQM) {
 		bool enable = false;
 		if (bss_conf->cqm_rssi_thold)
 			enable = true;
@@ -3901,7 +3901,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
 		rcu_read_unlock();
 	}
 
-	if ((changed & BSS_CHANGED_ASSOC)) {
+	if (changed & BSS_CHANGED_ASSOC) {
 		if (bss_conf->assoc) {
 			u32 rates;
 			int ieoffset;
Signature · 1 line
1.7.10.4
author Applied
#3 lore raw
In reply to Luciano Coelho
Quoted 4 lines · Luciano Coelho

Hi,

Just a couple of patches cleaning up things I bumped into.

Quoted 8 lines

Luca.

Luciano Coelho (2):
wlcore: avoid using goto in normal code flow
wlcore: remove a bunch of unnecessary parentheses

 drivers/net/wireless/ti/wlcore/main.c |   37 +++++++++++++++++----------------
 1 file changed, 19 insertions(+), 18 deletions(-)

Applied.

--
Luca.