diff mbox

[RFC] brcmfmac: keep device specific settings when changing country

Message ID 1452233080-11569-1-git-send-email-zajec5@gmail.com (mailing list archive)
State RFC
Delegated to: Kalle Valo
Headers show

Commit Message

Rafał Miłecki Jan. 8, 2016, 6:04 a.m. UTC
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.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 17658b3..dcd8c8d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -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");