From patchwork Tue Dec 3 17:33:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 3278001 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F1364C0D4A for ; Tue, 3 Dec 2013 17:34:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D3FB20414 for ; Tue, 3 Dec 2013 17:34:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E25BC201BC for ; Tue, 3 Dec 2013 17:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754145Ab3LCReL (ORCPT ); Tue, 3 Dec 2013 12:34:11 -0500 Received: from mail-we0-f170.google.com ([74.125.82.170]:63168 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754102Ab3LCReH (ORCPT ); Tue, 3 Dec 2013 12:34:07 -0500 Received: by mail-we0-f170.google.com with SMTP id w61so14041817wes.15 for ; Tue, 03 Dec 2013 09:34:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=jExWtfeRqkpLzeYCCnG/OMfPQ0YbkDNjrIdz6W6OpEE=; b=PApajYGciT5RAUDbVb3FwS6CVIW0Yday3ZyqMWDQncV2SJzBjd0gwpBZPFdjdgJWob YFAun1zTNG2G5eo5zYhbVVRKrG9JpOWhI3GgbvpDd18WY+qF+UF+4XzPFytyK8MoShwk R18OaoDpzPiqD15Pd9/+fp4oU6FKRN/Sc6AWdLKr3fjza2r8FTwRFfacMm3ehWCQqc+x w/nxSvoRzXgCa/6o6OuY6nRHYJgDEYk47tXk3GaZ9thQyKkN/Svx2NLIzAjHRFUo/NDo l9lvLQKnBzdUimzkxTLn1Rgr2GsweGDgoAL26BNGTo7F4qCzTqtL30+3N/4zWXSql/C+ gRJg== X-Received: by 10.180.14.226 with SMTP id s2mr3528904wic.41.1386092046800; Tue, 03 Dec 2013 09:34:06 -0800 (PST) Received: from mcgrof@gmail.com (cb2-luis.wifi.rsr.lip6.fr. [132.227.77.199]) by mx.google.com with ESMTPSA id n6sm7374970wix.3.2013.12.03.09.34.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Dec 2013 09:34:06 -0800 (PST) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Tue, 03 Dec 2013 18:34:05 +0100 From: "Luis R. Rodriguez" To: c_manoha@qca.qualcomm.com, linville@tuxdriver.com, johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, "Luis R. Rodriguez" Subject: [RFT 2/2] cfg80211: make regulatory_hint() remove REGULATORY_CUSTOM_REG Date: Tue, 3 Dec 2013 18:33:54 +0100 Message-Id: <1386092034-13442-3-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1386092034-13442-1-git-send-email-mcgrof@do-not-panic.com> References: <1386092034-13442-1-git-send-email-mcgrof@do-not-panic.com> 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_SIGNED, 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 The REGULATORY_CUSTOM_REG can be used during early init with the goal of overriding the wiphy's default regulatory settings in case the alpha2 of the device is not known. In the case that the alpha2 becomes known lets avoid having drivers having to clear the REGULATORY_CUSTOM_REG flag by doing it for them when regulatory_hint() is used. Cc: Sujith Manoharan Signed-off-by: Luis R. Rodriguez --- drivers/net/wireless/ath/regd.c | 2 -- include/net/regulatory.h | 4 ++++ net/wireless/reg.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c index 06b05d0..43d6234 100644 --- a/drivers/net/wireless/ath/regd.c +++ b/drivers/net/wireless/ath/regd.c @@ -622,8 +622,6 @@ ath_regd_init_wiphy(struct ath_regulatory *reg, } wiphy_apply_custom_regulatory(wiphy, regd); - if (!ath_is_world_regd(reg)) - wiphy->regulatory_flags &= ~REGULATORY_STRICT_REG; ath_reg_apply_radar_flags(wiphy); ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); return 0; diff --git a/include/net/regulatory.h b/include/net/regulatory.h index c96a0b8..b07cdc9 100644 --- a/include/net/regulatory.h +++ b/include/net/regulatory.h @@ -96,6 +96,10 @@ struct regulatory_request { * initiator is %REGDOM_SET_BY_CORE). Drivers that use * wiphy_apply_custom_regulatory() should have this flag set * or the regulatory core will set it for the wiphy. + * If you use regulatory_hint() *after* using + * wiphy_apply_custom_regulatory() the wireless core will + * clear the REGULATORY_CUSTOM_REG for your wiphy as it would be + * implied that the device somehow gained knowledge of its region. * @REGULATORY_STRICT_REG: tells us that the wiphy for this device * has regulatory domain that it wishes to be considered as the * superset for regulatory rules. After this device gets its regulatory diff --git a/net/wireless/reg.c b/net/wireless/reg.c index ec54e1a..edebd04 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -1826,6 +1826,8 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2) if (WARN_ON(!alpha2 || !wiphy)) return -EINVAL; + wiphy->regulatory_flags &= ~REGULATORY_STRICT_REG; + request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); if (!request) return -ENOMEM;