Linux wireless drivers development
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <rodrigue@qca.qualcomm.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: <linville@tuxdriver.com>, <linux-wireless@vger.kernel.org>,
	<kvalo@qca.qualcomm.com>, <arend@broadcom.com>,
	<henry@logout.com>, <senthilb@qca.qualcomm.com>
Subject: Re: [PATCH 4/4] cfg80211: add cellular base station regulatory hint support
Date: Fri, 6 Jul 2012 15:09:11 -0700	[thread overview]
Message-ID: <20120706220911.GB28694@tux> (raw)
In-Reply-To: <1341591350.16893.13.camel@jlt3.sipsolutions.net>

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.

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(&reg_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(&reg_mutex);
+
+	if (!reg_dev_ignore_cell_hint(wiphy))
+		reg_num_devs_support_basehint++;
+
+	mutex_unlock(&reg_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(&reg_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);

      parent reply	other threads:[~2012-07-06 22:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-03 23:15 [PATCH 0/4] wireless: certification onus and cell regulatory hint Luis R. Rodriguez
2012-07-03 23:15 ` [PATCH 1/4] cfg80211: add CONFIG_CFG80211_CERTIFICATION_ONUS Luis R. Rodriguez
2012-07-03 23:15 ` [PATCH 2/4] ath5k: replace modparam_all_channels with CONFIG_ATH5K_TEST_CHANNELS Luis R. Rodriguez
2012-07-03 23:15 ` [PATCH 3/4] ath9k: make CONFIG_ATH9K_DFS_CERTIFIED depend on CFG80211_CERTIFICATION_ONUS Luis R. Rodriguez
2012-07-03 23:15 ` [PATCH 4/4] cfg80211: add cellular base station regulatory hint support Luis R. Rodriguez
2012-07-04  9:42   ` Johannes Berg
2012-07-04 16:26     ` Luis R. Rodriguez
2012-07-05  7:45       ` Johannes Berg
2012-07-05 16:48         ` Luis R. Rodriguez
2012-07-06  6:39           ` Johannes Berg
2012-07-06 14:05             ` Luis R. Rodriguez
2012-07-06 14:11               ` Johannes Berg
2012-07-06 15:47                 ` Luis R. Rodriguez
2012-07-06 15:51                   ` Johannes Berg
2012-07-06 16:07                     ` Luis R. Rodriguez
2012-07-06 16:15                       ` Johannes Berg
2012-07-06 16:31                         ` Luis R. Rodriguez
2012-07-06 16:53                           ` Luis R. Rodriguez
2012-07-06 22:09                         ` Luis R. Rodriguez [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120706220911.GB28694@tux \
    --to=rodrigue@qca.qualcomm.com \
    --cc=arend@broadcom.com \
    --cc=henry@logout.com \
    --cc=johannes@sipsolutions.net \
    --cc=kvalo@qca.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=senthilb@qca.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox