From patchwork Fri Jan 8 06:04:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 7982781 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4D763BEEE5 for ; Fri, 8 Jan 2016 06:04:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7A9CC20142 for ; Fri, 8 Jan 2016 06:04:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8036D2013D for ; Fri, 8 Jan 2016 06:04:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751439AbcAHGE4 (ORCPT ); Fri, 8 Jan 2016 01:04:56 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:35301 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135AbcAHGEz (ORCPT ); Fri, 8 Jan 2016 01:04:55 -0500 Received: by mail-lf0-f43.google.com with SMTP id c192so169342111lfe.2 for ; Thu, 07 Jan 2016 22:04:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=cvxFekhpmEk3DaYUd2NDgkR0NuLTESGd9+c490UFqZM=; b=nT9IccA7srYoNGgPbKxOGAKy+nqCoNZNU7bTxH9Y8Wxc2/OT6RWarVHDMtsQbJa8q+ CYd8DkzWEk5RVm6uIlEy6CvJcJM45pK6qu13/34SLdUyICHRVFGC6Lyn6MWt9eTN+CJM KjUO9BBYuIeGTCGbAU9MNKQnWDc/YGtCU+fQ+ijJYhNFQKg3yoAnY/zb8RIzZWC4JMb+ +j4Hx5u9ehANAo5N2IgJIG/24cFsDsdlzpleGqX1drmbhz6H6jgO/kOMwrmLak5fJt/m grZZPsWltdCvRsrvXezCJeB+uduKr6mt22q3XJrToK8Yw311zMa37xUCpLmTaMmH9PRG 0o+A== X-Received: by 10.25.1.75 with SMTP id 72mr14301428lfb.12.1452233093640; Thu, 07 Jan 2016 22:04:53 -0800 (PST) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id g16sm11179586lfe.0.2016.01.07.22.04.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jan 2016 22:04:52 -0800 (PST) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list@broadcom.com, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [RFC PATCH] brcmfmac: keep device specific settings when changing country Date: Fri, 8 Jan 2016 07:04:40 +0100 Message-Id: <1452233080-11569-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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");