From patchwork Fri Jul 6 22:09:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 1168091 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2797940135 for ; Fri, 6 Jul 2012 22:11:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933481Ab2GFWJQ (ORCPT ); Fri, 6 Jul 2012 18:09:16 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:29325 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932984Ab2GFWJP (ORCPT ); Fri, 6 Jul 2012 18:09:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1341612556; x=1373148556; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Uhhm8/ooC2vyTcAQuO0WM3NpNTWJCp+nqzf37pYLQjg=; b=RDCgNyE0SmBZ9lGV8CjhryNaCnLz5ZASUbH/hKvmHYHmOt+02iZApbgP mFfSVZw8po4HMFeaL0nMZr9BO+nCdyTKms78hs5Ka9fObfMd8BqkwZY2Q 67rD58B2BuahGMXfJ4zxkZC99XHuRthFH/qRIxLJBFs4mFThv2pbk7LJb Y=; X-IronPort-AV: E=McAfee;i="5400,1158,6764"; a="205838135" Received: from ironmsg03-r.qualcomm.com ([172.30.46.17]) by wolverine02.qualcomm.com with ESMTP; 06 Jul 2012 15:09:15 -0700 X-IronPort-AV: E=Sophos;i="4.77,540,1336374000"; d="scan'208";a="284885611" Received: from nasanexhc08.na.qualcomm.com ([172.30.39.7]) by Ironmsg03-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 06 Jul 2012 15:09:15 -0700 Received: from tux (172.30.39.5) by qcmail1.qualcomm.com (172.30.39.7) with Microsoft SMTP Server (TLS) id 14.2.309.2; Fri, 6 Jul 2012 15:09:13 -0700 Received: by tux (sSMTP sendmail emulation); Fri, 06 Jul 2012 15:09:11 -0700 Date: Fri, 6 Jul 2012 15:09:11 -0700 From: "Luis R. Rodriguez" To: Johannes Berg CC: , , , , , Subject: Re: [PATCH 4/4] cfg80211: add cellular base station regulatory hint support Message-ID: <20120706220911.GB28694@tux> References: <1341474303.4455.5.camel@jlt3.sipsolutions.net> <1341556785.4462.0.camel@jlt3.sipsolutions.net> <1341583919.16893.3.camel@jlt3.sipsolutions.net> <1341589880.16893.11.camel@jlt3.sipsolutions.net> <1341591350.16893.13.camel@jlt3.sipsolutions.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1341591350.16893.13.camel@jlt3.sipsolutions.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [172.30.39.5] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org FWIW, here's the delta I plan on adding that adds a device count for number of devices that support the base station hints and disregards the hints unless the core has 1 device that supports this. I'll roll this into a new series and later send ath5k / ath9k patches separately as I see now that cfg80211 changes go through you and driver updates through linville. --- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/wireless/core.c b/net/wireless/core.c index e13365f..153f7dc 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -537,6 +537,7 @@ int wiphy_register(struct wiphy *wiphy) } /* set up regulatory info */ + wiphy_regulatory_register(wiphy); regulatory_update(wiphy, NL80211_REGDOM_SET_BY_CORE); list_add_rcu(&rdev->list, &cfg80211_rdev_list); diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 3644159..05af62d 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -97,9 +97,16 @@ const struct ieee80211_regdomain *cfg80211_regdomain; * - cfg80211_world_regdom * - cfg80211_regdom * - last_request + * - reg_num_devs_support_basehint */ static DEFINE_MUTEX(reg_mutex); +/* + * Number of devices that registered to the core + * that support cellular base station regulatory hints + */ +static int reg_num_devs_support_basehint; + static inline void assert_reg_lock(void) { lockdep_assert_held(®_mutex); @@ -934,6 +941,9 @@ bool reg_last_request_cell_base(void) /* Core specific check */ static int reg_ignore_cell_hint(struct regulatory_request *pending_request) { + if (!reg_num_devs_support_basehint) + return -EOPNOTSUPP; + if (reg_request_cell_base(last_request)) { if (!regdom_changes(pending_request->alpha2)) return -EALREADY; @@ -2365,6 +2375,18 @@ int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env) } #endif /* CONFIG_HOTPLUG */ +void wiphy_regulatory_register(struct wiphy *wiphy) +{ + assert_cfg80211_lock(); + + mutex_lock(®_mutex); + + if (!reg_dev_ignore_cell_hint(wiphy)) + reg_num_devs_support_basehint++; + + mutex_unlock(®_mutex); +} + /* Caller must hold cfg80211_mutex */ void reg_device_remove(struct wiphy *wiphy) { @@ -2374,6 +2396,9 @@ void reg_device_remove(struct wiphy *wiphy) mutex_lock(®_mutex); + if (!reg_dev_ignore_cell_hint(wiphy)) + reg_num_devs_support_basehint--; + kfree(wiphy->regd); if (last_request) diff --git a/net/wireless/reg.h b/net/wireless/reg.h index ba1097e..519492f 100644 --- a/net/wireless/reg.h +++ b/net/wireless/reg.h @@ -26,6 +26,7 @@ int regulatory_hint_user(const char *alpha2, enum nl80211_user_reg_hint_type user_reg_hint_type); int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env); +void wiphy_regulatory_register(struct wiphy *wiphy); void reg_device_remove(struct wiphy *wiphy); int __init regulatory_init(void);