]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ath5k: store the clock rate in common data on channel changes
authorFelix Fietkau <nbd@openwrt.org>
Fri, 8 Oct 2010 20:13:52 +0000 (22:13 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 Oct 2010 19:04:20 +0000 (15:04 -0400)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/ath5k.h
drivers/net/wireless/ath/ath5k/pcu.c
drivers/net/wireless/ath/ath5k/phy.c

index 0cba2e315d9af18191b61905e59ba9d8166f8f39..4a367cdb3eb93b93d369f56aa40f81f5d3a95f43 100644 (file)
@@ -1201,7 +1201,7 @@ void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, bool high);
 /* Clock rate related functions */
 unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec);
 unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock);
-unsigned int ath5k_hw_get_clockrate(struct ath5k_hw *ah);
+void ath5k_hw_set_clockrate(struct ath5k_hw *ah);
 
 /* Queue Control Unit, DFS Control Unit Functions */
 int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue,
index 095d30b50ec7edbb5d82b77e188605d3a458d291..074b4c644399c8f5f3790a1d6ff0f8be9f8b2ccc 100644 (file)
@@ -207,7 +207,8 @@ static int ath5k_hw_set_cts_timeout(struct ath5k_hw *ah, unsigned int timeout)
  */
 unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec)
 {
-       return usec * ath5k_hw_get_clockrate(ah);
+       struct ath_common *common = ath5k_hw_common(ah);
+       return usec * common->clockrate;
 }
 
 /**
@@ -216,17 +217,19 @@ unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec)
  */
 unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock)
 {
-       return clock / ath5k_hw_get_clockrate(ah);
+       struct ath_common *common = ath5k_hw_common(ah);
+       return clock / common->clockrate;
 }
 
 /**
- * ath5k_hw_get_clockrate - Get the clock rate for current mode
+ * ath5k_hw_set_clockrate - Set common->clockrate for the current channel
  *
  * @ah: The &struct ath5k_hw
  */
-unsigned int ath5k_hw_get_clockrate(struct ath5k_hw *ah)
+void ath5k_hw_set_clockrate(struct ath5k_hw *ah)
 {
        struct ieee80211_channel *channel = ah->ah_current_channel;
+       struct ath_common *common = ath5k_hw_common(ah);
        int clock;
 
        if (channel->hw_value & CHANNEL_5GHZ)
@@ -240,7 +243,7 @@ unsigned int ath5k_hw_get_clockrate(struct ath5k_hw *ah)
        if (channel->hw_value & CHANNEL_TURBO)
                clock *= 2;
 
-       return clock;
+       common->clockrate = clock;
 }
 
 /**
index 61da913e7c8fb05a7492ffefc7be9b06b4fc0662..219367884e640a60a99a99eba59478aaba9bc1da 100644 (file)
@@ -1093,6 +1093,7 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
 
        ah->ah_current_channel = channel;
        ah->ah_turbo = channel->hw_value == CHANNEL_T ? true : false;
+       ath5k_hw_set_clockrate(ah);
 
        return 0;
 }