From: blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Sun, 25 Mar 2012 09:07:09 +0000 (+0000)
Subject: [mac80211] fixes #31068, rename 999-ath9k.patch to 501-ath9k-eeprom_endianess.patch
X-Git-Url: https://git.rohieb.name/openwrt.git/commitdiff_plain/e2947f4ff34ad1c26c3b7aae778a3b26be675e36

[mac80211] fixes #31068, rename 999-ath9k.patch to 501-ath9k-eeprom_endianess.patch

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31071 3c298f89-4303-0410-b956-a3cf2f4a3e73
---

diff --git a/package/mac80211/patches/501-ath9k-eeprom_endianess.patch b/package/mac80211/patches/501-ath9k-eeprom_endianess.patch
new file mode 100644
index 000000000..25d5450a7
--- /dev/null
+++ b/package/mac80211/patches/501-ath9k-eeprom_endianess.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++;
+ 		}
+ 	}
+ 
diff --git a/package/mac80211/patches/999-ath9k.patch b/package/mac80211/patches/999-ath9k.patch
deleted file mode 100644
index 25d5450a7..000000000
--- a/package/mac80211/patches/999-ath9k.patch
+++ /dev/null
@@ -1,48 +0,0 @@
---- 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++;
- 		}
- 	}
-