From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: mcgrof@gmail.com, linux-wireless@vger.kernel.org
Subject: [PATCH 4/4] wireless regulatory: move ignore_request
Date: Fri, 24 Oct 2008 20:32:23 +0200 [thread overview]
Message-ID: <20081024183323.955480000@sipsolutions.net> (raw)
In-Reply-To: 20081024183219.735241000@sipsolutions.net
This function is only used once, move it closer to its caller.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/wireless/reg.c | 126 ++++++++++++++++++++++++++---------------------------
1 file changed, 63 insertions(+), 63 deletions(-)
--- everything.orig/net/wireless/reg.c 2008-10-24 11:09:16.000000000 +0200
+++ everything/net/wireless/reg.c 2008-10-24 11:15:33.000000000 +0200
@@ -298,69 +298,6 @@ static int call_crda(const char *alpha2)
return kobject_uevent_env(®_pdev->dev.kobj, KOBJ_CHANGE, envp);
}
-/* This has the logic which determines when a new request
- * should be ignored. */
-static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
- const char *alpha2)
-{
- /* All initial requests are respected */
- if (!last_request)
- return 0;
-
- switch (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;
- case REGDOM_SET_BY_COUNTRY_IE:
- if (unlikely(!is_an_alpha2(alpha2)))
- return -EINVAL;
- if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) {
- if (last_request->wiphy != wiphy) {
- /*
- * Two cards with two APs claiming different
- * different Country IE alpha2s. We could
- * intersect them, but that seems unlikely
- * to be correct. Reject second one for now.
- */
- if (!alpha2_equal(alpha2,
- cfg80211_regdomain->alpha2))
- return -EOPNOTSUPP;
- return -EALREADY;
- }
- /* Two consecutive Country IE hints on the same wiphy */
- if (!alpha2_equal(cfg80211_regdomain->alpha2, alpha2))
- return 0;
- return -EALREADY;
- }
- /*
- * Ignore Country IE hints for now, need to think about
- * what we need to do to support multi-domain operation.
- */
- return -EOPNOTSUPP;
- case REGDOM_SET_BY_DRIVER:
- if (last_request->initiator == REGDOM_SET_BY_DRIVER)
- return -EALREADY;
- return 0;
- case REGDOM_SET_BY_USER:
- /*
- * If the user wants to override the AP's hint, we may
- * need to follow both and use the intersection. For now,
- * reject any such attempt (but we don't support country
- * IEs right now anyway.)
- */
- if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE)
- return -EOPNOTSUPP;
- return 0;
- }
-
- return -EINVAL;
-}
-
/* Used by nl80211 before kmalloc'ing our regulatory domain */
bool reg_is_valid_request(const char *alpha2)
{
@@ -531,6 +468,69 @@ void wiphy_update_regulatory(struct wiph
}
}
+/* This has the logic which determines when a new request
+ * should be ignored. */
+static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
+ const char *alpha2)
+{
+ /* All initial requests are respected */
+ if (!last_request)
+ return 0;
+
+ switch (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;
+ case REGDOM_SET_BY_COUNTRY_IE:
+ if (unlikely(!is_an_alpha2(alpha2)))
+ return -EINVAL;
+ if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) {
+ if (last_request->wiphy != wiphy) {
+ /*
+ * Two cards with two APs claiming different
+ * different Country IE alpha2s. We could
+ * intersect them, but that seems unlikely
+ * to be correct. Reject second one for now.
+ */
+ if (!alpha2_equal(alpha2,
+ cfg80211_regdomain->alpha2))
+ return -EOPNOTSUPP;
+ return -EALREADY;
+ }
+ /* Two consecutive Country IE hints on the same wiphy */
+ if (!alpha2_equal(cfg80211_regdomain->alpha2, alpha2))
+ return 0;
+ return -EALREADY;
+ }
+ /*
+ * Ignore Country IE hints for now, need to think about
+ * what we need to do to support multi-domain operation.
+ */
+ return -EOPNOTSUPP;
+ case REGDOM_SET_BY_DRIVER:
+ if (last_request->initiator == REGDOM_SET_BY_DRIVER)
+ return -EALREADY;
+ return 0;
+ case REGDOM_SET_BY_USER:
+ /*
+ * If the user wants to override the AP's hint, we may
+ * need to follow both and use the intersection. For now,
+ * reject any such attempt (but we don't support country
+ * IEs right now anyway.)
+ */
+ if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE)
+ return -EOPNOTSUPP;
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
/* Caller must hold &cfg80211_drv_mutex */
int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
const char *alpha2)
--
prev parent reply other threads:[~2008-10-24 18:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-24 18:32 [PATCH 0/4] wireless regulatory updates Johannes Berg
2008-10-24 12:01 ` Luis R. Rodriguez
2008-10-24 18:32 ` [PATCH 1/4] wireless: make regdom passing semantics simpler Johannes Berg
2008-10-24 18:32 ` [PATCH 2/4] wireless: remove struct regdom hinting Johannes Berg
2008-10-24 18:32 ` [PATCH 3/4] wireless: clean up regulatory ignore_request function Johannes Berg
2008-10-24 18:32 ` Johannes Berg [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=20081024183323.955480000@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mcgrof@gmail.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;
as well as URLs for NNTP newsgroup(s).