Skip to contentSkip to conversation

brcmfmac: keep device specific settings when changing country

RFC PATCH New Rafał Miłecki 1 participant 1 message Jan 8, 2016 Broadcom BRCM80211 IEEE802.11 wireless drivers

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 brcmfmac: keep device specific settings when changing country

When changing country driver has to submit two values: alpha2 and rev(ision). We don't want to change revision as it's device specific. So far we were submitting value -1 in hope firmware will treat it as invalid and will simply keep using the old one. It doesn't work however, firmware treats -1 as 0 which may result in setting wrong revision.

Solve it by reading current value and submit it back with changed country.

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +7 -1
index 17658b3..dcd8c8d 100644
@@ -6236,8 +6236,14 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
 			brcmf_err("not a ISO3166 code\n");
 			return;
 		}
+
 	memset(&ccreq, 0, sizeof(ccreq));
-	ccreq.rev = cpu_to_le32(-1);
+	if (brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq))) {
+		brcmf_err("could not obtain country info\n");
+		return;
+	}
+
+	memset(ccreq.country_abbrev, 0, sizeof(ccreq.country_abbrev));
 	memcpy(ccreq.ccode, req->alpha2, sizeof(req->alpha2));
 	if (brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq))) {
 		brcmf_err("firmware rejected country setting\n");
Signature · 1 line
1.8.4.5