linux/atheros: fix another 2.6.36 patch issue
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 521-ath5k_common_clockrate.patch
1 --- a/drivers/net/wireless/ath/ath5k/pcu.c
2 +++ b/drivers/net/wireless/ath/ath5k/pcu.c
3 @@ -207,7 +207,8 @@ static int ath5k_hw_set_cts_timeout(stru
4 */
5 unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec)
6 {
7 - return usec * ath5k_hw_get_clockrate(ah);
8 + struct ath_common *common = ath5k_hw_common(ah);
9 + return usec * common->clockrate;
10 }
11
12 /**
13 @@ -216,17 +217,19 @@ unsigned int ath5k_hw_htoclock(struct at
14 */
15 unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock)
16 {
17 - return clock / ath5k_hw_get_clockrate(ah);
18 + struct ath_common *common = ath5k_hw_common(ah);
19 + return clock / common->clockrate;
20 }
21
22 /**
23 - * ath5k_hw_get_clockrate - Get the clock rate for current mode
24 + * ath5k_hw_set_clockrate - Set common->clockrate for the current channel
25 *
26 * @ah: The &struct ath5k_hw
27 */
28 -unsigned int ath5k_hw_get_clockrate(struct ath5k_hw *ah)
29 +void ath5k_hw_set_clockrate(struct ath5k_hw *ah)
30 {
31 struct ieee80211_channel *channel = ah->ah_current_channel;
32 + struct ath_common *common = ath5k_hw_common(ah);
33 int clock;
34
35 if (channel->hw_value & CHANNEL_5GHZ)
36 @@ -240,7 +243,7 @@ unsigned int ath5k_hw_get_clockrate(stru
37 if (channel->hw_value & CHANNEL_TURBO)
38 clock *= 2;
39
40 - return clock;
41 + common->clockrate = clock;
42 }
43
44 /**
45 --- a/drivers/net/wireless/ath/ath5k/ath5k.h
46 +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
47 @@ -1201,7 +1201,7 @@ void ath5k_hw_set_ack_bitrate_high(struc
48 /* Clock rate related functions */
49 unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec);
50 unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock);
51 -unsigned int ath5k_hw_get_clockrate(struct ath5k_hw *ah);
52 +void ath5k_hw_set_clockrate(struct ath5k_hw *ah);
53
54 /* Queue Control Unit, DFS Control Unit Functions */
55 int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue,
56 --- a/drivers/net/wireless/ath/ath5k/phy.c
57 +++ b/drivers/net/wireless/ath/ath5k/phy.c
58 @@ -1093,6 +1093,7 @@ int ath5k_hw_channel(struct ath5k_hw *ah
59
60 ah->ah_current_channel = channel;
61 ah->ah_turbo = channel->hw_value == CHANNEL_T ? true : false;
62 + ath5k_hw_set_clockrate(ah);
63
64 return 0;
65 }