diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2016-01-09 18:37:55 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2016-01-09 18:37:55 +0000 |
commit | 437dd4cacf0e424048022c45ba4721534872e6b4 (patch) | |
tree | a2272fe98f0ce454bb68dcdb71795f2885981e23 /package/kernel/mac80211/patches/348-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch | |
parent | b44228e69a372360adc6253c5ca09b68b51df58a (diff) | |
download | upstream-437dd4cacf0e424048022c45ba4721534872e6b4.tar.gz upstream-437dd4cacf0e424048022c45ba4721534872e6b4.tar.bz2 upstream-437dd4cacf0e424048022c45ba4721534872e6b4.zip |
mac80211: group brcmfmac patches into sets as they were sent
It doesn't change any single patch (or order), it only renames files.
This creates some place for more backports, as we were already using
398 prefix which left only 1 slot.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/branches/chaos_calmer@48163 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/kernel/mac80211/patches/348-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch')
-rw-r--r-- | package/kernel/mac80211/patches/348-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/348-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch b/package/kernel/mac80211/patches/348-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch new file mode 100644 index 0000000000..0e65114f86 --- /dev/null +++ b/package/kernel/mac80211/patches/348-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch @@ -0,0 +1,57 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Date: Wed, 20 May 2015 11:01:08 +0200 +Subject: [PATCH] brcmfmac: simplify check finding NVRAM v1 device path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +With a simple use of snprintf and small buffer we can compare NVRAM +entry value with a full string. This way we avoid checking random chars +at magic offsets. +Tested on BCM43602 with NVRAM hacked to use v1 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 +@@ -222,6 +222,10 @@ static int brcmf_init_nvram_parser(struc + static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr, + u16 bus_nr) + { ++ /* Device path with a leading '=' key-value separator */ ++ char pcie_path[] = "=pcie/?/?"; ++ size_t pcie_len; ++ + u32 i, j; + bool found; + u8 *nvram; +@@ -238,6 +242,9 @@ static void brcmf_fw_strip_multi_v1(stru + /* First search for the devpathX and see if it is the configuration + * for domain_nr/bus_nr. Search complete nvp + */ ++ snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr, ++ bus_nr); ++ pcie_len = strlen(pcie_path); + found = false; + i = 0; + while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) { +@@ -245,13 +252,10 @@ static void brcmf_fw_strip_multi_v1(stru + * Y = domain_nr, Z = bus_nr, X = virtual ID + */ + if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) && +- (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) { +- if (((nvp->nvram[i + 14] - '0') == domain_nr) && +- ((nvp->nvram[i + 16] - '0') == bus_nr)) { +- id = nvp->nvram[i + 7] - '0'; +- found = true; +- break; +- } ++ (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) { ++ id = nvp->nvram[i + 7] - '0'; ++ found = true; ++ break; + } + while (nvp->nvram[i] != 0) + i++; |