Skip to contentSkip to conversation

ath9k: Remove duplicate variables

PATCH In review Sujith 1 participant 1 message Feb 9, 2009 Networking drivers (wireless)

lore
Share & tools
lore

Sujith

author
#0 lore raw

PATCH 6/10 ath9k: Remove duplicate variables

A few variables (bssid, bssidmask, curaid) were duplicated in struct ath_softc and in ath_hal, remove them.

---
 drivers/net/wireless/ath9k/ath9k.h |    1 -
 drivers/net/wireless/ath9k/hw.c    |   71 ++++++++++--------------------------
 drivers/net/wireless/ath9k/hw.h    |   14 ++-----
 drivers/net/wireless/ath9k/main.c  |   24 +++++++------
 drivers/net/wireless/ath9k/recv.c  |    4 +-
 5 files changed, 38 insertions(+), 76 deletions(-)
drivers/net/wireless/ath9k/ath9k.h +0 -1
index d60b2e7..03e4d0b 100644
@@ -580,7 +580,6 @@ struct ath_softc {
 	struct mutex mutex;
 
 	u8 curbssid[ETH_ALEN];
-	u8 macaddr[ETH_ALEN];
 	u8 bssidmask[ETH_ALEN];
 	u32 intrstatus;
 	u32 sc_flags; /* SC_OP_* */
drivers/net/wireless/ath9k/hw.c +19 -52

130 lines not on this page · raw message

drivers/net/wireless/ath9k/hw.h +4 -10
index 3fdf962..f4bf702 100644
@@ -427,6 +427,7 @@ struct ath_hal {
 	struct ath9k_hw_capabilities ah_caps;
 	struct ath9k_regulatory regulatory;
 	u32 ah_flags;
+	u8 macaddr[ETH_ALEN];
 
 	enum ath9k_power_mode ah_power_mode;
 	enum ath9k_power_mode ah_restore_mode;
@@ -457,11 +458,6 @@ struct ath_hal_5416 {
 	struct ath9k_tx_queue_info ah_txq[ATH9K_NUM_TX_QUEUES];
 	void __iomem *ah_cal_mem;
 
-	u8 ah_macaddr[ETH_ALEN];
-	u8 ah_bssid[ETH_ALEN];
-	u8 ah_bssidmask[ETH_ALEN];
-	u16 ah_assocId;
-
 	int16_t ah_curchanRadIndex;
 	u32 ah_maskReg;
 	u32 ah_txOkInterruptMask;
@@ -633,13 +629,11 @@ void ath9k_hw_setrxfilter(struct ath_hal *ah, u32 bits);
 bool ath9k_hw_phy_disable(struct ath_hal *ah);
 bool ath9k_hw_disable(struct ath_hal *ah);
 bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit);
-void ath9k_hw_getmac(struct ath_hal *ah, u8 *mac);
-bool ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac);
+void ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac);
 void ath9k_hw_setopmode(struct ath_hal *ah);
 void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0, u32 filter1);
-void ath9k_hw_getbssidmask(struct ath_hal *ah, u8 *mask);
-bool ath9k_hw_setbssidmask(struct ath_hal *ah, const u8 *mask);
-void ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid, u16 assocId);
+void ath9k_hw_setbssidmask(struct ath_softc *sc);
+void ath9k_hw_write_associd(struct ath_softc *sc);
 u64 ath9k_hw_gettsf64(struct ath_hal *ah);
 void ath9k_hw_settsf64(struct ath_hal *ah, u64 tsf64);
 void ath9k_hw_reset_tsf(struct ath_hal *ah);
drivers/net/wireless/ath9k/main.c +13 -11
index a1c76ec..bafefbe 100644
@@ -905,8 +905,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
 		/* New association, store aid */
 		if (avp->av_opmode == NL80211_IFTYPE_STATION) {
 			sc->curaid = bss_conf->aid;
-			ath9k_hw_write_associd(sc->sc_ah, sc->curbssid,
-					       sc->curaid);
+			ath9k_hw_write_associd(sc);
 		}
 
 		/* Configure the beacon */
@@ -1514,11 +1513,10 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 	ath9k_hw_setcapability(ah, ATH9K_CAP_DIVERSITY, 1, true, NULL);
 	sc->rx.defant = ath9k_hw_getdefantenna(ah);
 
-	ath9k_hw_getmac(ah, sc->macaddr);
 	if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) {
-		ath9k_hw_getbssidmask(ah, sc->bssidmask);
+		memcpy(sc->bssidmask, ath_bcast_mac, ETH_ALEN);
 		ATH_SET_VIF_BSSID_MASK(sc->bssidmask);
-		ath9k_hw_setbssidmask(ah, sc->bssidmask);
+		ath9k_hw_setbssidmask(sc);
 	}
 
 	sc->beacon.slottime = ATH9K_SLOT_TIME_9;	/* default to short slot time */
@@ -1577,7 +1575,7 @@ int ath_attach(u16 devid, struct ath_softc *sc)
 
 	/* get mac address from hardware and set in mac80211 */
 
-	SET_IEEE80211_PERM_ADDR(hw, sc->macaddr);
+	SET_IEEE80211_PERM_ADDR(hw, sc->sc_ah->macaddr);
 
 	hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
 		IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
@@ -2285,7 +2283,9 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
 	    ah->ah_opmode != NL80211_IFTYPE_AP) {
 		ah->ah_opmode = NL80211_IFTYPE_STATION;
 		ath9k_hw_setopmode(ah);
-		ath9k_hw_write_associd(ah, sc->macaddr, 0);
+		memcpy(sc->curbssid, sc->sc_ah->macaddr, ETH_ALEN);
+		sc->curaid = 0;
+		ath9k_hw_write_associd(sc);
 		/* Request full reset to get hw opmode changed properly */
 		sc->sc_flags |= SC_OP_FULL_RESET;
 	}
@@ -2298,8 +2298,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
 			/* Set BSSID */
 			memcpy(sc->curbssid, conf->bssid, ETH_ALEN);
 			sc->curaid = 0;
-			ath9k_hw_write_associd(sc->sc_ah, sc->curbssid,
-					       sc->curaid);
+			ath9k_hw_write_associd(sc);
 
 			/* Set aggregation protection mode parameters */
 			sc->config.ath_aggr_prot = 0;
@@ -2382,8 +2381,11 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw,
 	ath9k_hw_setrxfilter(sc->sc_ah, rfilt);
 
 	if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
-		if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
-			ath9k_hw_write_associd(sc->sc_ah, ath_bcast_mac, 0);
+		if (*total_flags & FIF_BCN_PRBRESP_PROMISC) {
+			memcpy(sc->curbssid, ath_bcast_mac, ETH_ALEN);
+			sc->curaid = 0;
+			ath9k_hw_write_associd(sc);
+		}
 	}
 
 	DPRINTF(sc, ATH_DBG_CONFIG, "Set HW RX filter: 0x%x\n", sc->rx.rxfilter);
drivers/net/wireless/ath9k/recv.c +2 -2
index e8e4a32..c51c085 100644
@@ -242,13 +242,13 @@ static void ath_opmode_init(struct ath_softc *sc)
 
 	/* configure bssid mask */
 	if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
-		ath9k_hw_setbssidmask(ah, sc->bssidmask);
+		ath9k_hw_setbssidmask(sc);
 
 	/* configure operational mode */
 	ath9k_hw_setopmode(ah);
 
 	/* Handle any link-level address change. */
-	ath9k_hw_setmac(ah, sc->macaddr);
+	ath9k_hw_setmac(ah, sc->sc_ah->macaddr);
 
 	/* calculate and install multicast filter */
 	mfilt[0] = mfilt[1] = ~0;
Signature · 1 line
1.6.1