Skip to content

Commit b0b524f

Browse files
shawnguo2Kalle Valo
authored andcommitted
brcmfmac: use ISO3166 country code and 0 rev as fallback
Instead of aborting country code setup in firmware, use ISO3166 country code and 0 rev as fallback, when country_codes mapping table is not configured. This fallback saves the country_codes table setup for recent brcmfmac chipsets/firmwares, which just use ISO3166 code and require no revision number. Signed-off-by: Shawn Guo <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 573f1af commit b0b524f

File tree

1 file changed

+11
-6
lines changed
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac

1 file changed

+11
-6
lines changed

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7442,18 +7442,23 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2],
74427442
s32 found_index;
74437443
int i;
74447444

7445-
country_codes = drvr->settings->country_codes;
7446-
if (!country_codes) {
7447-
brcmf_dbg(TRACE, "No country codes configured for device\n");
7448-
return -EINVAL;
7449-
}
7450-
74517445
if ((alpha2[0] == ccreq->country_abbrev[0]) &&
74527446
(alpha2[1] == ccreq->country_abbrev[1])) {
74537447
brcmf_dbg(TRACE, "Country code already set\n");
74547448
return -EAGAIN;
74557449
}
74567450

7451+
country_codes = drvr->settings->country_codes;
7452+
if (!country_codes) {
7453+
brcmf_dbg(TRACE, "No country codes configured for device, using ISO3166 code and 0 rev\n");
7454+
memset(ccreq, 0, sizeof(*ccreq));
7455+
ccreq->country_abbrev[0] = alpha2[0];
7456+
ccreq->country_abbrev[1] = alpha2[1];
7457+
ccreq->ccode[0] = alpha2[0];
7458+
ccreq->ccode[1] = alpha2[1];
7459+
return 0;
7460+
}
7461+
74577462
found_index = -1;
74587463
for (i = 0; i < country_codes->table_size; i++) {
74597464
cc = &country_codes->table[i];

0 commit comments

Comments
 (0)