> | if (ah->eep_ops->get_eepmisc(ah) & AR5416_EEPMISC_BIG_ENDIAN) { > | *swap_needed = true; > | ath_dbg(common, EEPROM, > | "Big Endian EEPROM detected according to EEPMISC register.\n"); > | } else { > | *swap_needed = false; > | } > > This doesn't take into consideration that swapping is not needed if > the data is in big endian format on a big endian device. So, this > could be changed so that the *swap_needed is only true if the flag and > device endiannes disagrees? There are versions of the macro which performs the swap which understands the CPU endianness and become a NOP when it is not required. htons()/ntohs() are the classic examples. So you need to consider: Despite swap_needed being true, it is possible no swap it actually happening, because such a macro is being used. and Maybe using these variant can make the code simpler, by just doing the NOP swap when the CPU endianess does not require it. Andrew