summaryrefslogtreecommitdiff
path: root/package/mac80211
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2012-03-25 08:51:08 +0000
committerJohn Crispin <john@openwrt.org>2012-03-25 08:51:08 +0000
commit2ad89262d0cb24a5bc5a0649f855fca1d69d7f3d (patch)
tree15e205ea4a8f6fe57da747b88b94870c399e1435 /package/mac80211
parent9f0e5e08410b531747a99d160c4c7ea038adf7a0 (diff)
downloadmtk-20170518-2ad89262d0cb24a5bc5a0649f855fca1d69d7f3d.zip
mtk-20170518-2ad89262d0cb24a5bc5a0649f855fca1d69d7f3d.tar.gz
mtk-20170518-2ad89262d0cb24a5bc5a0649f855fca1d69d7f3d.tar.bz2
adds eeprom endianess check to ath9k
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 31068
Diffstat (limited to 'package/mac80211')
-rw-r--r--package/mac80211/patches/999-ath9k.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/package/mac80211/patches/999-ath9k.patch b/package/mac80211/patches/999-ath9k.patch
new file mode 100644
index 0000000..25d5450
--- /dev/null
+++ b/package/mac80211/patches/999-ath9k.patch
@@ -0,0 +1,48 @@
+--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
++++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
+@@ -267,7 +267,7 @@ static int ath9k_hw_def_check_eeprom(str
+ struct ar5416_eeprom_def *eep =
+ (struct ar5416_eeprom_def *) &ah->eeprom.def;
+ struct ath_common *common = ath9k_hw_common(ah);
+- u16 *eepdata, temp, magic, magic2;
++ u16 *eepdata, temp, magic;
+ u32 sum = 0, el;
+ bool need_swap = false;
+ int i, addr, size;
+@@ -277,27 +277,15 @@ static int ath9k_hw_def_check_eeprom(str
+ return false;
+ }
+
+- if (!ath9k_hw_use_flash(ah)) {
+- ath_dbg(common, EEPROM, "Read Magic = 0x%04X\n", magic);
+-
+- if (magic != AR5416_EEPROM_MAGIC) {
+- magic2 = swab16(magic);
+-
+- if (magic2 == AR5416_EEPROM_MAGIC) {
+- size = sizeof(struct ar5416_eeprom_def);
+- need_swap = true;
+- eepdata = (u16 *) (&ah->eeprom);
+-
+- for (addr = 0; addr < size / sizeof(u16); addr++) {
+- temp = swab16(*eepdata);
+- *eepdata = temp;
+- eepdata++;
+- }
+- } else {
+- ath_err(common,
+- "Invalid EEPROM Magic. Endianness mismatch.\n");
+- return -EINVAL;
+- }
++ if (swab16(magic) == AR5416_EEPROM_MAGIC) {
++ size = sizeof(struct ar5416_eeprom_def);
++ need_swap = true;
++ eepdata = (u16 *) (&ah->eeprom);
++
++ for (addr = 0; addr < size / sizeof(u16); addr++) {
++ temp = swab16(*eepdata);
++ *eepdata = temp;
++ eepdata++;
+ }
+ }
+