aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-05-28 10:39:11 +0000
committerRafał Miłecki <zajec5@gmail.com>2015-05-28 10:39:11 +0000
commitc1cc2217c24cbc419a642d896cf27d43038856a6 (patch)
treeebcc617bd2bf8b09badfbb7ee188b14dc03e37cb /package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
parent597d2060c58b9c2c8de76b2d0bc577f66af9ee71 (diff)
downloadupstream-c1cc2217c24cbc419a642d896cf27d43038856a6.tar.gz
upstream-c1cc2217c24cbc419a642d896cf27d43038856a6.tar.bz2
upstream-c1cc2217c24cbc419a642d896cf27d43038856a6.zip
mac80211: backport today's brcmfmac changes
This fixes various problems with parsing platform NVRAM. It's required to get BCM43602 working in most cases. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 45802
Diffstat (limited to 'package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch')
-rw-r--r--package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch b/package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
new file mode 100644
index 0000000000..2bfd44f998
--- /dev/null
+++ b/package/kernel/mac80211/patches/375-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
@@ -0,0 +1,56 @@
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 20 May 2015 09:34:21 +0200
+Subject: [PATCH] brcmfmac: simplify check stripping v2 NVRAM
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Comparing NVRAM entry with a full filtering string is simpler than
+comparing it with a short prefix and then checking random chars at magic
+offsets. The cost of snprintf relatively low, we execute it just once.
+Tested on BCM43602 with NVRAM hacked to use V2 format.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+
+--- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
+@@ -25,7 +25,7 @@
+
+ #define BRCMF_FW_MAX_NVRAM_SIZE 64000
+ #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
+-#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
++#define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
+
+ char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
+ module_param_string(firmware_path, brcmf_firmware_path,
+@@ -297,6 +297,8 @@ fail:
+ static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
+ u16 bus_nr)
+ {
++ char prefix[BRCMF_FW_NVRAM_PCIEDEV_LEN];
++ size_t len;
+ u32 i, j;
+ u8 *nvram;
+
+@@ -308,14 +310,13 @@ static void brcmf_fw_strip_multi_v2(stru
+ * Valid entries are of type pcie/X/Y/ where X = domain_nr and
+ * Y = bus_nr.
+ */
++ snprintf(prefix, sizeof(prefix), "pcie/%d/%d/", domain_nr, bus_nr);
++ len = strlen(prefix);
+ i = 0;
+ j = 0;
+- while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
+- if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
+- (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
+- ((nvp->nvram[i + 5] - '0') == domain_nr) &&
+- ((nvp->nvram[i + 7] - '0') == bus_nr)) {
+- i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
++ while (i < nvp->nvram_len - len) {
++ if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
++ i += len;
+ while (nvp->nvram[i] != 0) {
+ nvram[j] = nvp->nvram[i];
+ i++;