From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: linville@tuxdriver.com, johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
"Luis R. Rodriguez" <lrodriguez@atheros.com>
Subject: [PATCH v5 05/15] cfg80211: add regulatory_hint_core() to separate the core reg hint
Date: Fri, 20 Feb 2009 00:42:40 -0500 [thread overview]
Message-ID: <1235108570-17652-6-git-send-email-lrodriguez@atheros.com> (raw)
In-Reply-To: <1235108570-17652-1-git-send-email-lrodriguez@atheros.com>
This makes the core hint path more readable and allows for us to
later make it obvious under what circumstances we need locking or not.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
net/wireless/reg.c | 34 +++++++++++++++++++++++++---------
1 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index ba82312..6373a78 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1050,11 +1050,7 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
case REGDOM_SET_BY_INIT:
return -EINVAL;
case REGDOM_SET_BY_CORE:
- /*
- * Always respect new wireless core hints, should only happen
- * when updating the world regulatory domain at init.
- */
- return 0;
+ return -EINVAL;
case REGDOM_SET_BY_COUNTRY_IE:
if (unlikely(!is_an_alpha2(alpha2)))
return -EINVAL;
@@ -1183,6 +1179,26 @@ new_request:
return call_crda(alpha2);
}
+static int regulatory_hint_core(const char *alpha2)
+{
+ struct regulatory_request *request;
+
+ BUG_ON(last_request);
+
+ request = kzalloc(sizeof(struct regulatory_request),
+ GFP_KERNEL);
+ if (!request)
+ return -ENOMEM;
+
+ request->alpha2[0] = alpha2[0];
+ request->alpha2[1] = alpha2[1];
+ request->initiator = REGDOM_SET_BY_CORE;
+
+ last_request = request;
+
+ return call_crda(alpha2);
+}
+
void regulatory_hint(struct wiphy *wiphy, const char *alpha2)
{
int r;
@@ -1616,16 +1632,16 @@ int regulatory_init(void)
* stuck with the static values. We ignore "EU" code as
* that is not a valid ISO / IEC 3166 alpha2 */
if (ieee80211_regdom[0] != 'E' || ieee80211_regdom[1] != 'U')
- err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE,
- ieee80211_regdom, 0, ENVIRON_ANY);
+ err = regulatory_hint_core(ieee80211_regdom);
#else
cfg80211_regdomain = cfg80211_world_regdom;
- err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE, "00", 0, ENVIRON_ANY);
- if (err)
+ err = regulatory_hint_core("00");
+ if (err) {
printk(KERN_ERR "cfg80211: calling CRDA failed - "
"unable to update world regulatory domain, "
"using static definition\n");
+ }
#endif
return 0;
--
1.6.0.3
next prev parent reply other threads:[~2009-02-20 5:42 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-20 5:42 [PATCH v5 00/15] cfg80211: add a workqueue for regulatory processing Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 01/15] cfg80211: rename cfg80211_registered_device's idx to wiphy_idx Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 02/15] cfg80211: add wiphy_idx_valid to check for wiphy_idx sanity Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 03/15] cfg80211: rename cfg80211_drv_mutex to cfg80211_mutex Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 04/15] nl80211: disallow user requests prior to regulatory_init() Luis R. Rodriguez
2009-02-20 5:42 ` Luis R. Rodriguez [this message]
2009-02-20 5:42 ` [PATCH v5 06/15] cfg80211: propagate -ENOMEM during regulatory_init() Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 07/15] cfg80211: add assert_cfg80211_lock() to ensure proper protection Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 08/15] cfg80211: make regulatory_request use wiphy_idx instead of wiphy Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 09/15] cfg80211: protect first access of last_request on 11d hint under mutex Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 10/15] cfg80211: remove likely from an 11d hint case Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 11/15] cfg80211: free rd on unlikely event on 11d hint Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 12/15] cfg80211: move all regulatory hints to workqueue Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 13/15] cfg80211: comments style cleanup Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 14/15] cfg80211: allow drivers that agree on regulatory to agree Luis R. Rodriguez
2009-02-20 5:42 ` [PATCH v5 15/15] cfg80211: rename regdom_changed to regdom_changes() and use it Luis R. Rodriguez
2009-02-20 17:03 ` [PATCH v5 00/15] cfg80211: add a workqueue for regulatory processing Johannes Berg
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=1235108570-17652-6-git-send-email-lrodriguez@atheros.com \
--to=lrodriguez@atheros.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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