diff options
author | Pavel Roskin <proski@gnu.org> | 2010-02-18 20:28:41 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-09 15:02:55 -0500 |
commit | ec182d976345b5eb671fe879ad73b90fe29a34e9 (patch) | |
tree | 0a2fdacabd6f428dfbda52ac79cd7bb2a7b17245 /drivers/net/wireless | |
parent | a25d1e4cd7799570ecea6b5dcc4dbf5a6d5336bf (diff) |
ath5k: move ath5k_hw_register_timeout() into reset.c
ath5k_hw_register_timeout() was duplicated between phy.c and reset.c.
Since it is too big and too much used to be an inline function, move it
away from the ath5k.h header into reset.c. Remove _ATH5K_RESET and
_ATH5K_PHY defines.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/ath5k.h | 25 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/phy.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/reset.c | 25 |
3 files changed, 23 insertions, 31 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index f4e50ef84067..4de7fe03b9fc 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h | |||
@@ -1172,6 +1172,8 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial); | |||
1172 | int ath5k_hw_on_hold(struct ath5k_hw *ah); | 1172 | int ath5k_hw_on_hold(struct ath5k_hw *ah); |
1173 | int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | 1173 | int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, |
1174 | struct ieee80211_channel *channel, bool change_channel); | 1174 | struct ieee80211_channel *channel, bool change_channel); |
1175 | int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val, | ||
1176 | bool is_set); | ||
1175 | /* Power management functions */ | 1177 | /* Power management functions */ |
1176 | 1178 | ||
1177 | /* DMA Related Functions */ | 1179 | /* DMA Related Functions */ |
@@ -1328,29 +1330,6 @@ static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg) | |||
1328 | iowrite32(val, ah->ah_iobase + reg); | 1330 | iowrite32(val, ah->ah_iobase + reg); |
1329 | } | 1331 | } |
1330 | 1332 | ||
1331 | #if defined(_ATH5K_RESET) || defined(_ATH5K_PHY) | ||
1332 | /* | ||
1333 | * Check if a register write has been completed | ||
1334 | */ | ||
1335 | static int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, | ||
1336 | u32 val, bool is_set) | ||
1337 | { | ||
1338 | int i; | ||
1339 | u32 data; | ||
1340 | |||
1341 | for (i = AR5K_TUNE_REGISTER_TIMEOUT; i > 0; i--) { | ||
1342 | data = ath5k_hw_reg_read(ah, reg); | ||
1343 | if (is_set && (data & flag)) | ||
1344 | break; | ||
1345 | else if ((data & flag) == val) | ||
1346 | break; | ||
1347 | udelay(15); | ||
1348 | } | ||
1349 | |||
1350 | return (i <= 0) ? -EAGAIN : 0; | ||
1351 | } | ||
1352 | #endif | ||
1353 | |||
1354 | static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits) | 1333 | static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits) |
1355 | { | 1334 | { |
1356 | u32 retval = 0, bit, i; | 1335 | u32 retval = 0, bit, i; |
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index ac2a57aba6a7..10ad877c2cdf 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -20,8 +20,6 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #define _ATH5K_PHY | ||
24 | |||
25 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
26 | 24 | ||
27 | #include "ath5k.h" | 25 | #include "ath5k.h" |
@@ -3144,5 +3142,3 @@ int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower) | |||
3144 | 3142 | ||
3145 | return ath5k_hw_txpower(ah, channel, ee_mode, txpower); | 3143 | return ath5k_hw_txpower(ah, channel, ee_mode, txpower); |
3146 | } | 3144 | } |
3147 | |||
3148 | #undef _ATH5K_PHY | ||
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c index 8decf2126912..8bd62c130b26 100644 --- a/drivers/net/wireless/ath/ath5k/reset.c +++ b/drivers/net/wireless/ath/ath5k/reset.c | |||
@@ -19,8 +19,6 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define _ATH5K_RESET | ||
23 | |||
24 | /*****************************\ | 22 | /*****************************\ |
25 | Reset functions and helpers | 23 | Reset functions and helpers |
26 | \*****************************/ | 24 | \*****************************/ |
@@ -34,6 +32,27 @@ | |||
34 | #include "base.h" | 32 | #include "base.h" |
35 | #include "debug.h" | 33 | #include "debug.h" |
36 | 34 | ||
35 | /* | ||
36 | * Check if a register write has been completed | ||
37 | */ | ||
38 | int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val, | ||
39 | bool is_set) | ||
40 | { | ||
41 | int i; | ||
42 | u32 data; | ||
43 | |||
44 | for (i = AR5K_TUNE_REGISTER_TIMEOUT; i > 0; i--) { | ||
45 | data = ath5k_hw_reg_read(ah, reg); | ||
46 | if (is_set && (data & flag)) | ||
47 | break; | ||
48 | else if ((data & flag) == val) | ||
49 | break; | ||
50 | udelay(15); | ||
51 | } | ||
52 | |||
53 | return (i <= 0) ? -EAGAIN : 0; | ||
54 | } | ||
55 | |||
37 | /** | 56 | /** |
38 | * ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212 | 57 | * ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212 |
39 | * | 58 | * |
@@ -1386,5 +1405,3 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1386 | 1405 | ||
1387 | return 0; | 1406 | return 0; |
1388 | } | 1407 | } |
1389 | |||
1390 | #undef _ATH5K_RESET | ||