[PATCH v2 3/6] Remove int ch variable from wcn struct

Olof Johansson dev at skyshaper.net
Thu Jul 11 05:41:38 EDT 2013


This commit removes the ch variable from the wcn struct and introduce a
macro for reading the hw_value from the ieee80211_hw in the wcn struct.
---
 main.c    | 12 ++++++------
 smd.c     |  2 +-
 wcn36xx.h |  3 ++-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/main.c b/main.c
index 7750b0e..e81622f 100644
--- a/main.c
+++ b/main.c
@@ -292,11 +292,11 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
 	wcn36xx_dbg(WCN36XX_DBG_MAC, "mac config changed 0x%08x", changed);
 
 	if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
-		wcn->ch = hw->conf.chandef.chan->hw_value;
+		int ch = WCN36XX_HW_CHANNEL(wcn);
 		wcn->current_channel = hw->conf.chandef.chan;
 		wcn->band = hw->conf.chandef.chan->band;
-		wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d", wcn->ch);
-		wcn36xx_smd_switch_channel(wcn, wcn->ch);
+		wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d", ch);
+		wcn36xx_smd_switch_channel(wcn, ch);
 	}
 
 	return 0;
@@ -428,14 +428,14 @@ static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw)
 	struct wcn36xx *wcn = hw->priv;
 
 	wcn36xx_smd_init_scan(wcn);
-	wcn36xx_smd_start_scan(wcn, wcn->ch);
+	wcn36xx_smd_start_scan(wcn, WCN36XX_HW_CHANNEL(wcn));
 }
 
 static void wcn36xx_sw_scan_complete(struct ieee80211_hw *hw)
 {
 	struct wcn36xx *wcn = hw->priv;
 
-	wcn36xx_smd_end_scan(wcn, wcn->ch);
+	wcn36xx_smd_end_scan(wcn, WCN36XX_HW_CHANNEL(wcn));
 	wcn36xx_smd_finish_scan(wcn);
 }
 
@@ -517,7 +517,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 		if (!is_zero_ether_addr(bss_conf->bssid)) {
 			wcn->is_joining = true;
 			wcn36xx_smd_join(wcn, bss_conf->bssid,
-					 vif->addr, wcn->ch);
+					 vif->addr, WCN36XX_HW_CHANNEL(wcn));
 			wcn36xx_smd_config_bss(wcn, NL80211_IFTYPE_STATION,
 					       bss_conf->bssid, false,
 					       wcn->beacon_interval);
diff --git a/smd.c b/smd.c
index c9b5e9e..67cd1af 100644
--- a/smd.c
+++ b/smd.c
@@ -755,7 +755,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, enum nl80211_iftype type,
 	bss->beacon_interval = beacon_interval;
 	bss->dtim_period = wcn->dtim_period;
 	bss->tx_channel_width_set = 0;
-	bss->oper_channel = wcn->ch;
+	bss->oper_channel = WCN36XX_HW_CHANNEL(wcn);
 	bss->ext_channel = 0;
 	bss->reserved = 0;
 
diff --git a/wcn36xx.h b/wcn36xx.h
index 98f1e4a..b46d78a 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -80,6 +80,8 @@ enum wcn36xx_debug_mask {
 			       buf, len, false);		\
 } while (0)
 
+#define WCN36XX_HW_CHANNEL(__wcn) (__wcn->hw->conf.chandef.chan->hw_value)
+
 static inline void buff_to_be(u32 *buf, size_t len)
 {
 	int i;
@@ -110,7 +112,6 @@ struct wcn36xx {
 	struct device		*dev;
 	const struct firmware	*nv;
 	struct mac_address	addresses[2];
-	int			ch;
 	struct ieee80211_channel *current_channel;
 	enum ieee80211_band	band;
 	struct wcn36xx_hal_mac_ssid ssid;
-- 
1.8.3.1




More information about the wcn36xx mailing list