lkml.org 
[lkml]   [2010]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] ath9k_htc: cleanup eeprom endiannes handling

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

Signed-off-by: Pavel Machek <pma@sysgo.com>

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);
}
}


\
 
 \ /
  Last update: 2010-11-26 12:37    [W:0.089 / U:12.396 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site