diff options
author | Pavel Roskin <proski@gnu.org> | 2011-07-15 19:06:33 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-07-18 14:29:42 -0400 |
commit | 78fa99abd7a7ecfd7364e7b7198c9ecc27766855 (patch) | |
tree | 6454afa1ea8d688d7fe050478f03b4e9c98a9127 | |
parent | d47d78dff4d6d72eec59dcdf0f6dd44064088112 (diff) |
ath9k: use get_unaligned_{b16, le16, le32} where possible
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_4k.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_9287.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_def.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hif_usb.c | 5 |
5 files changed, 23 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 1d09f22fee4d..33a1600de34a 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <asm/unaligned.h> | ||
17 | #include "hw.h" | 18 | #include "hw.h" |
18 | #include "ar9003_phy.h" | 19 | #include "ar9003_phy.h" |
19 | #include "ar9003_eeprom.h" | 20 | #include "ar9003_eeprom.h" |
@@ -3006,11 +3007,11 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah, | |||
3006 | 3007 | ||
3007 | switch (param) { | 3008 | switch (param) { |
3008 | case EEP_MAC_LSW: | 3009 | case EEP_MAC_LSW: |
3009 | return eep->macAddr[0] << 8 | eep->macAddr[1]; | 3010 | return get_unaligned_be16(eep->macAddr); |
3010 | case EEP_MAC_MID: | 3011 | case EEP_MAC_MID: |
3011 | return eep->macAddr[2] << 8 | eep->macAddr[3]; | 3012 | return get_unaligned_be16(eep->macAddr + 2); |
3012 | case EEP_MAC_MSW: | 3013 | case EEP_MAC_MSW: |
3013 | return eep->macAddr[4] << 8 | eep->macAddr[5]; | 3014 | return get_unaligned_be16(eep->macAddr + 4); |
3014 | case EEP_REG_0: | 3015 | case EEP_REG_0: |
3015 | return le16_to_cpu(pBase->regDmn[0]); | 3016 | return le16_to_cpu(pBase->regDmn[0]); |
3016 | case EEP_REG_1: | 3017 | case EEP_REG_1: |
@@ -3380,8 +3381,7 @@ found: | |||
3380 | osize = length; | 3381 | osize = length; |
3381 | read(ah, cptr, word, COMP_HDR_LEN + osize + COMP_CKSUM_LEN); | 3382 | read(ah, cptr, word, COMP_HDR_LEN + osize + COMP_CKSUM_LEN); |
3382 | checksum = ar9300_comp_cksum(&word[COMP_HDR_LEN], length); | 3383 | checksum = ar9300_comp_cksum(&word[COMP_HDR_LEN], length); |
3383 | mchecksum = word[COMP_HDR_LEN + osize] | | 3384 | mchecksum = get_unaligned_le16(&word[COMP_HDR_LEN + osize]); |
3384 | (word[COMP_HDR_LEN + osize + 1] << 8); | ||
3385 | ath_dbg(common, ATH_DBG_EEPROM, | 3385 | ath_dbg(common, ATH_DBG_EEPROM, |
3386 | "checksum %x %x\n", checksum, mchecksum); | 3386 | "checksum %x %x\n", checksum, mchecksum); |
3387 | if (checksum == mchecksum) { | 3387 | if (checksum == mchecksum) { |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c index 5b1e894f3d67..47cc95086e6e 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <asm/unaligned.h> | ||
17 | #include "hw.h" | 18 | #include "hw.h" |
18 | #include "ar9002_phy.h" | 19 | #include "ar9002_phy.h" |
19 | 20 | ||
@@ -203,11 +204,11 @@ static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah, | |||
203 | case EEP_NFTHRESH_2: | 204 | case EEP_NFTHRESH_2: |
204 | return pModal->noiseFloorThreshCh[0]; | 205 | return pModal->noiseFloorThreshCh[0]; |
205 | case EEP_MAC_LSW: | 206 | case EEP_MAC_LSW: |
206 | return pBase->macAddr[0] << 8 | pBase->macAddr[1]; | 207 | return get_unaligned_be16(pBase->macAddr); |
207 | case EEP_MAC_MID: | 208 | case EEP_MAC_MID: |
208 | return pBase->macAddr[2] << 8 | pBase->macAddr[3]; | 209 | return get_unaligned_be16(pBase->macAddr + 2); |
209 | case EEP_MAC_MSW: | 210 | case EEP_MAC_MSW: |
210 | return pBase->macAddr[4] << 8 | pBase->macAddr[5]; | 211 | return get_unaligned_be16(pBase->macAddr + 4); |
211 | case EEP_REG_0: | 212 | case EEP_REG_0: |
212 | return pBase->regDmn[0]; | 213 | return pBase->regDmn[0]; |
213 | case EEP_REG_1: | 214 | case EEP_REG_1: |
@@ -331,10 +332,7 @@ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah, | |||
331 | 332 | ||
332 | regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset; | 333 | regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset; |
333 | for (j = 0; j < 32; j++) { | 334 | for (j = 0; j < 32; j++) { |
334 | reg32 = ((pdadcValues[4 * j + 0] & 0xFF) << 0) | | 335 | reg32 = get_unaligned_le32(&pdadcValues[4 * j]); |
335 | ((pdadcValues[4 * j + 1] & 0xFF) << 8) | | ||
336 | ((pdadcValues[4 * j + 2] & 0xFF) << 16)| | ||
337 | ((pdadcValues[4 * j + 3] & 0xFF) << 24); | ||
338 | REG_WRITE(ah, regOffset, reg32); | 336 | REG_WRITE(ah, regOffset, reg32); |
339 | 337 | ||
340 | ath_dbg(common, ATH_DBG_EEPROM, | 338 | ath_dbg(common, ATH_DBG_EEPROM, |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index 343fc9f946db..d6f6b192f450 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <asm/unaligned.h> | ||
17 | #include "hw.h" | 18 | #include "hw.h" |
18 | #include "ar9002_phy.h" | 19 | #include "ar9002_phy.h" |
19 | 20 | ||
@@ -195,11 +196,11 @@ static u32 ath9k_hw_ar9287_get_eeprom(struct ath_hw *ah, | |||
195 | case EEP_NFTHRESH_2: | 196 | case EEP_NFTHRESH_2: |
196 | return pModal->noiseFloorThreshCh[0]; | 197 | return pModal->noiseFloorThreshCh[0]; |
197 | case EEP_MAC_LSW: | 198 | case EEP_MAC_LSW: |
198 | return pBase->macAddr[0] << 8 | pBase->macAddr[1]; | 199 | return get_unaligned_be16(pBase->macAddr); |
199 | case EEP_MAC_MID: | 200 | case EEP_MAC_MID: |
200 | return pBase->macAddr[2] << 8 | pBase->macAddr[3]; | 201 | return get_unaligned_be16(pBase->macAddr + 2); |
201 | case EEP_MAC_MSW: | 202 | case EEP_MAC_MSW: |
202 | return pBase->macAddr[4] << 8 | pBase->macAddr[5]; | 203 | return get_unaligned_be16(pBase->macAddr + 4); |
203 | case EEP_REG_0: | 204 | case EEP_REG_0: |
204 | return pBase->regDmn[0]; | 205 | return pBase->regDmn[0]; |
205 | case EEP_REG_1: | 206 | case EEP_REG_1: |
@@ -434,10 +435,7 @@ static void ath9k_hw_set_ar9287_power_cal_table(struct ath_hw *ah, | |||
434 | (672 << 2) + regChainOffset; | 435 | (672 << 2) + regChainOffset; |
435 | 436 | ||
436 | for (j = 0; j < 32; j++) { | 437 | for (j = 0; j < 32; j++) { |
437 | reg32 = ((pdadcValues[4*j + 0] & 0xFF) << 0) | 438 | reg32 = get_unaligned_le32(&pdadcValues[4 * j]); |
438 | | ((pdadcValues[4*j + 1] & 0xFF) << 8) | ||
439 | | ((pdadcValues[4*j + 2] & 0xFF) << 16) | ||
440 | | ((pdadcValues[4*j + 3] & 0xFF) << 24); | ||
441 | 439 | ||
442 | REG_WRITE(ah, regOffset, reg32); | 440 | REG_WRITE(ah, regOffset, reg32); |
443 | regOffset += 4; | 441 | regOffset += 4; |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c index 17f0a6806207..b9540a992616 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <asm/unaligned.h> | ||
17 | #include "hw.h" | 18 | #include "hw.h" |
18 | #include "ar9002_phy.h" | 19 | #include "ar9002_phy.h" |
19 | 20 | ||
@@ -276,11 +277,11 @@ static u32 ath9k_hw_def_get_eeprom(struct ath_hw *ah, | |||
276 | case EEP_NFTHRESH_2: | 277 | case EEP_NFTHRESH_2: |
277 | return pModal[1].noiseFloorThreshCh[0]; | 278 | return pModal[1].noiseFloorThreshCh[0]; |
278 | case EEP_MAC_LSW: | 279 | case EEP_MAC_LSW: |
279 | return pBase->macAddr[0] << 8 | pBase->macAddr[1]; | 280 | return get_unaligned_be16(pBase->macAddr); |
280 | case EEP_MAC_MID: | 281 | case EEP_MAC_MID: |
281 | return pBase->macAddr[2] << 8 | pBase->macAddr[3]; | 282 | return get_unaligned_be16(pBase->macAddr + 2); |
282 | case EEP_MAC_MSW: | 283 | case EEP_MAC_MSW: |
283 | return pBase->macAddr[4] << 8 | pBase->macAddr[5]; | 284 | return get_unaligned_be16(pBase->macAddr + 4); |
284 | case EEP_REG_0: | 285 | case EEP_REG_0: |
285 | return pBase->regDmn[0]; | 286 | return pBase->regDmn[0]; |
286 | case EEP_REG_1: | 287 | case EEP_REG_1: |
@@ -831,10 +832,7 @@ static void ath9k_hw_set_def_power_cal_table(struct ath_hw *ah, | |||
831 | 832 | ||
832 | regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset; | 833 | regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset; |
833 | for (j = 0; j < 32; j++) { | 834 | for (j = 0; j < 32; j++) { |
834 | reg32 = ((pdadcValues[4 * j + 0] & 0xFF) << 0) | | 835 | reg32 = get_unaligned_le32(&pdadcValues[4 * j]); |
835 | ((pdadcValues[4 * j + 1] & 0xFF) << 8) | | ||
836 | ((pdadcValues[4 * j + 2] & 0xFF) << 16)| | ||
837 | ((pdadcValues[4 * j + 3] & 0xFF) << 24); | ||
838 | REG_WRITE(ah, regOffset, reg32); | 836 | REG_WRITE(ah, regOffset, reg32); |
839 | 837 | ||
840 | ath_dbg(common, ATH_DBG_EEPROM, | 838 | ath_dbg(common, ATH_DBG_EEPROM, |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 8028fe90f666..1d11ae101d67 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <asm/unaligned.h> | ||
17 | #include "htc.h" | 18 | #include "htc.h" |
18 | 19 | ||
19 | /* identify firmware images */ | 20 | /* identify firmware images */ |
@@ -557,8 +558,8 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, | |||
557 | 558 | ||
558 | ptr = (u8 *) skb->data; | 559 | ptr = (u8 *) skb->data; |
559 | 560 | ||
560 | pkt_len = ptr[index] + (ptr[index+1] << 8); | 561 | pkt_len = get_unaligned_le16(ptr + index); |
561 | pkt_tag = ptr[index+2] + (ptr[index+3] << 8); | 562 | pkt_tag = get_unaligned_le16(ptr + index + 2); |
562 | 563 | ||
563 | if (pkt_tag != ATH_USB_RX_STREAM_MODE_TAG) { | 564 | if (pkt_tag != ATH_USB_RX_STREAM_MODE_TAG) { |
564 | RX_STAT_INC(skb_dropped); | 565 | RX_STAT_INC(skb_dropped); |