Search Linux Wireless

[PATCH] ath9k_htc: cleanup eeprom endiannes handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are already in-place byte swapping macros in Linux, use them.

Signed-off-by: Pavel Machek <pma@xxxxxxxxx>

diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
index 4fa4d8e..ee4e893 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
@@ -117,47 +117,25 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
 		sum ^= *eepdata++;
 
 	if (need_swap) {
-		u32 integer;
-		u16 word;
-
 		ath_print(common, ATH_DBG_EEPROM,
 			  "EEPROM Endianness is not native.. Changing\n");
 
-		word = swab16(eep->baseEepHeader.length);
-		eep->baseEepHeader.length = word;
-
-		word = swab16(eep->baseEepHeader.checksum);
-		eep->baseEepHeader.checksum = word;
-
-		word = swab16(eep->baseEepHeader.version);
-		eep->baseEepHeader.version = word;
-
-		word = swab16(eep->baseEepHeader.regDmn[0]);
-		eep->baseEepHeader.regDmn[0] = word;
-
-		word = swab16(eep->baseEepHeader.regDmn[1]);
-		eep->baseEepHeader.regDmn[1] = word;
-
-		word = swab16(eep->baseEepHeader.rfSilent);
-		eep->baseEepHeader.rfSilent = word;
-
-		word = swab16(eep->baseEepHeader.blueToothOptions);
-		eep->baseEepHeader.blueToothOptions = word;
-
-		word = swab16(eep->baseEepHeader.deviceCap);
-		eep->baseEepHeader.deviceCap = word;
-
-		integer = swab32(eep->modalHeader.antCtrlCommon);
-		eep->modalHeader.antCtrlCommon = integer;
+		swab16s(&eep->baseEepHeader.length);
+		swab16s(&eep->baseEepHeader.checksum);
+		swab16s(&eep->baseEepHeader.version);
+		swab16s(&eep->baseEepHeader.regDmn[0]);
+		swab16s(&eep->baseEepHeader.regDmn[1]);
+		swab16s(&eep->baseEepHeader.rfSilent);
+		swab16s(&eep->baseEepHeader.blueToothOptions);
+		swab16s(&eep->baseEepHeader.deviceCap);
+		swab32s(&eep->modalHeader.antCtrlCommon);
 
 		for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
-			integer = swab32(eep->modalHeader.antCtrlChain[i]);
-			eep->modalHeader.antCtrlChain[i] = integer;
+			swab32s(&eep->modalHeader.antCtrlChain[i]);
 		}
 
 		for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) {
-			word = swab16(eep->modalHeader.spurChans[i].spurChan);
-			eep->modalHeader.spurChans[i].spurChan = word;
+			swab16s(&eep->modalHeader.spurChans[i].spurChan);
 		}
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux