Skip to contentSkip to conversation

ath5k: merge ath5k_{init, deinit}_hw() with their thin wrappers

PATCH New Pavel Roskin 1 participant 3 messages Jul 21, 2011 Atheros ATH5K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ath5k: merge ath5k_{init, deinit}_hw() with their thin wrappers

---
 drivers/net/wireless/ath/ath5k/ath5k.h        |    4 ++--
 drivers/net/wireless/ath/ath5k/base.c         |   10 ++++------
 drivers/net/wireless/ath/ath5k/mac80211-ops.c |   14 --------------
 3 files changed, 6 insertions(+), 22 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +2 -2
index 0289584..c6fb44c 100644
@@ -1372,8 +1372,8 @@ void ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable);
 bool ath5k_any_vif_assoc(struct ath5k_hw *ah);
 void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
 		    struct ath5k_txq *txq);
-int ath5k_init_hw(struct ath5k_hw *ah);
-int ath5k_stop_hw(struct ath5k_hw *ah);
+int ath5k_start(struct ieee80211_hw *hw);
+void ath5k_stop(struct ieee80211_hw *hw);
 void ath5k_mode_setup(struct ath5k_hw *ah, struct ieee80211_vif *vif);
 void ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah,
 					struct ieee80211_vif *vif);
drivers/net/wireless/ath/ath5k/base.c +4 -6
index 20e4ef4..a74d286 100644
@@ -2526,9 +2526,9 @@ ath5k_stop_locked(struct ath5k_hw *ah)
 	return 0;
 }
 
-int
-ath5k_init_hw(struct ath5k_hw *ah)
+int ath5k_start(struct ieee80211_hw *hw)
 {
+	struct ath5k_hw *ah = hw->priv;
 	struct ath_common *common = ath5k_hw_common(ah);
 	int ret, i;
 
@@ -2602,9 +2602,9 @@ static void ath5k_stop_tasklets(struct ath5k_hw *ah)
  * if another thread does a system call and the thread doing the
  * stop is preempted).
  */
-int
-ath5k_stop_hw(struct ath5k_hw *ah)
+void ath5k_stop(struct ieee80211_hw *hw)
 {
+	struct ath5k_hw *ah = hw->priv;
 	int ret;
 
 	mutex_lock(&ah->lock);
@@ -2644,8 +2644,6 @@ ath5k_stop_hw(struct ath5k_hw *ah)
 	cancel_delayed_work_sync(&ah->tx_complete_work);
 
 	ath5k_rfkill_hw_stop(ah);
-
-	return ret;
 }
 
 /*
drivers/net/wireless/ath/ath5k/mac80211-ops.c +0 -14
index 7aa2a63..2a715ca 100644
@@ -66,20 +66,6 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 
 
 static int
-ath5k_start(struct ieee80211_hw *hw)
-{
-	return ath5k_init_hw(hw->priv);
-}
-
-
-static void
-ath5k_stop(struct ieee80211_hw *hw)
-{
-	ath5k_stop_hw(hw->priv);
-}
-
-
-static int
 ath5k_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
 	struct ath5k_hw *ah = hw->priv;
#1 lore raw

PATCH 2/3 ath5k: remove ath5k_hw_get_capability(), don't use VEOL on AR5210

There are only two capabilities we need, and both are trivial to find.

ath5k_hw_hasbssidmask() is true on AR5212, but not on AR5210 or AR5211.

ath5k_hw_hasveol() is true on AR5211 and AR5212, but not on AR5210, according to the HAL source.

---
 drivers/net/wireless/ath/ath5k/ath5k.h |   32 -----------------------
 drivers/net/wireless/ath/ath5k/base.h  |    9 ++++--
 drivers/net/wireless/ath/ath5k/caps.c  |   45 --------------------------------
 3 files changed, 5 insertions(+), 81 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +0 -32
index c6fb44c..277d5cb 100644
@@ -972,35 +972,6 @@ enum ath5k_power_mode {
 #define AR5K_SOFTLED_ON		0
 #define AR5K_SOFTLED_OFF	1
 
-/*
- * Chipset capabilities -see ath5k_hw_get_capability-
- * get_capability function is not yet fully implemented
- * in ath5k so most of these don't work yet...
- * TODO: Implement these & merge with _TUNE_ stuff above
- */
-enum ath5k_capability_type {
-	AR5K_CAP_REG_DMN		= 0,	/* Used to get current reg. domain id */
-	AR5K_CAP_TKIP_MIC		= 2,	/* Can handle TKIP MIC in hardware */
-	AR5K_CAP_TKIP_SPLIT		= 3,	/* TKIP uses split keys */
-	AR5K_CAP_PHYCOUNTERS		= 4,	/* PHY error counters */
-	AR5K_CAP_DIVERSITY		= 5,	/* Supports fast diversity */
-	AR5K_CAP_NUM_TXQUEUES		= 6,	/* Used to get max number of hw txqueues */
-	AR5K_CAP_VEOL			= 7,	/* Supports virtual EOL */
-	AR5K_CAP_COMPRESSION		= 8,	/* Supports compression */
-	AR5K_CAP_BURST			= 9,	/* Supports packet bursting */
-	AR5K_CAP_FASTFRAME		= 10,	/* Supports fast frames */
-	AR5K_CAP_TXPOW			= 11,	/* Used to get global tx power limit */
-	AR5K_CAP_TPC			= 12,	/* Can do per-packet tx power control (needed for 802.11a) */
-	AR5K_CAP_BSSIDMASK		= 13,	/* Supports bssid mask */
-	AR5K_CAP_MCAST_KEYSRCH		= 14,	/* Supports multicast key search */
-	AR5K_CAP_TSF_ADJUST		= 15,	/* Supports beacon tsf adjust */
-	AR5K_CAP_XR			= 16,	/* Supports XR mode */
-	AR5K_CAP_WME_TKIPMIC		= 17,	/* Supports TKIP MIC when using WMM */
-	AR5K_CAP_CHAN_HALFRATE		= 18,	/* Supports half rate channels */
-	AR5K_CAP_CHAN_QUARTERRATE	= 19,	/* Supports quarter rate channels */
-	AR5K_CAP_RFSILENT		= 20,	/* Supports RFsilent */
-};
-
 
 /* XXX: we *may* move cap_range stuff to struct wiphy */
 struct ath5k_capabilities {
@@ -1506,9 +1477,6 @@ void ath5k_rfkill_hw_stop(struct ath5k_hw *ah);
 
 /* Misc functions TODO: Cleanup */
 int ath5k_hw_set_capabilities(struct ath5k_hw *ah);
-int ath5k_hw_get_capability(struct ath5k_hw *ah,
-			    enum ath5k_capability_type cap_type, u32 capability,
-			    u32 *result);
 int ath5k_hw_enable_pspoll(struct ath5k_hw *ah, u8 *bssid, u16 assoc_id);
 int ath5k_hw_disable_pspoll(struct ath5k_hw *ah);
 
drivers/net/wireless/ath/ath5k/base.h +5 -4
index aa8aafc..a81f28d 100644
@@ -81,9 +81,10 @@ struct ath5k_vif_iter_data {
 void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif);
 
 
-#define ath5k_hw_hasbssidmask(_ah) \
-	(ath5k_hw_get_capability(_ah, AR5K_CAP_BSSIDMASK, 0, NULL) == 0)
-#define ath5k_hw_hasveol(_ah) \
-	(ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0)
+/* Check whether BSSID mask is supported */
+#define ath5k_hw_hasbssidmask(_ah) (ah->ah_version == AR5K_AR5212)
+
+/* Check whether virtual EOL is supported */
+#define ath5k_hw_hasveol(_ah) (ah->ah_version != AR5K_AR5210)
 
 #endif
drivers/net/wireless/ath/ath5k/caps.c +0 -45

51 lines not on this page · raw message

#2 lore raw

PATCH 3/3 ath5k: use get_unaligned_le32() in ath5k_write_pwr_to_pdadc_table()

In reply to Pavel Roskin
---
 drivers/net/wireless/ath/ath5k/phy.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath5k/phy.c +3 -6
index a0c66cf..81e465e 100644
@@ -22,6 +22,7 @@
 
 #include <linux/delay.h>
 #include <linux/slab.h>
+#include <asm/unaligned.h>
 
 #include "ath5k.h"
 #include "reg.h"
@@ -2794,12 +2795,8 @@ ath5k_write_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode)
 	 * Write TX power values
 	 */
 	for (i = 0; i < (AR5K_EEPROM_POWER_TABLE_SIZE / 2); i++) {
-		ath5k_hw_reg_write(ah,
-			((pdadc_out[4 * i + 0] & 0xff) << 0) |
-			((pdadc_out[4 * i + 1] & 0xff) << 8) |
-			((pdadc_out[4 * i + 2] & 0xff) << 16) |
-			((pdadc_out[4 * i + 3] & 0xff) << 24),
-			AR5K_PHY_PDADC_TXPOWER(i));
+		u32 val = get_unaligned_le32(&pdadc_out[4 * i]);
+		ath5k_hw_reg_write(ah, val, AR5K_PHY_PDADC_TXPOWER(i));
 	}
 }