aboutsummaryrefslogtreecommitdiff
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-24 20:32:21 +0200
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:02:30 -0400
commitbe3d48106c1e5d075784e5e67928a6b5ffc0f3b6 (patch)
tree40f9a5d6beefa0f6812f06368a94f0b17658f247 /net/wireless/reg.c
parentd2372b315289aec9f565a855023c40654a5bff68 (diff)
wireless: remove struct regdom hinting
The code needs to be split out and cleaned up, so as a first step remove the capability, to add it back in a subsequent patch as a separate function. Also remove the publically facing return value of the function and the wiphy argument. A number of internal functions go from being generic helpers to just being used for alpha2 setting. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c63
1 files changed, 16 insertions, 47 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 038f8f133c5..dc10071deaa 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -42,7 +42,10 @@
#include "core.h"
#include "reg.h"
-/* wiphy is set if this request's initiator is REGDOM_SET_BY_DRIVER */
+/*
+ * wiphy is set if this request's initiator is
+ * REGDOM_SET_BY_COUNTRY_IE or _DRIVER
+ */
struct regulatory_request {
struct wiphy *wiphy;
enum reg_set_by initiator;
@@ -298,7 +301,7 @@ static int call_crda(const char *alpha2)
/* 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,
- char *alpha2, struct ieee80211_regdomain *rd)
+ const char *alpha2)
{
/* All initial requests are respected */
if (!last_request)
@@ -343,22 +346,8 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
return 1;
case REGDOM_SET_BY_DRIVER:
BUG_ON(!wiphy);
- if (last_request->initiator == REGDOM_SET_BY_DRIVER) {
- /* Two separate drivers hinting different things,
- * this is possible if you have two devices present
- * on a system with different EEPROM regulatory
- * readings. XXX: Do intersection, we support only
- * the first regulatory hint for now */
- if (last_request->wiphy != wiphy)
- return -EALREADY;
- if (rd)
- return -EALREADY;
- /* Driver should not be trying to hint different
- * regulatory domains! */
- BUG_ON(!alpha2_equal(alpha2,
- cfg80211_regdomain->alpha2));
+ if (last_request->initiator == REGDOM_SET_BY_DRIVER)
return -EALREADY;
- }
if (last_request->initiator == REGDOM_SET_BY_CORE)
return 0;
/* XXX: Handle intersection, and add the
@@ -557,40 +546,32 @@ void wiphy_update_regulatory(struct wiphy *wiphy, enum reg_set_by setby)
/* Caller must hold &cfg80211_drv_mutex */
int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
- const char *alpha2, struct ieee80211_regdomain *rd)
+ const char *alpha2)
{
struct regulatory_request *request;
- char *rd_alpha2;
int r = 0;
- r = ignore_request(wiphy, set_by, (char *) alpha2, rd);
+ r = ignore_request(wiphy, set_by, alpha2);
if (r)
return r;
- if (rd)
- rd_alpha2 = rd->alpha2;
- else
- rd_alpha2 = (char *) alpha2;
-
switch (set_by) {
case REGDOM_SET_BY_CORE:
case REGDOM_SET_BY_COUNTRY_IE:
case REGDOM_SET_BY_DRIVER:
case REGDOM_SET_BY_USER:
request = kzalloc(sizeof(struct regulatory_request),
- GFP_KERNEL);
+ GFP_KERNEL);
if (!request)
return -ENOMEM;
- request->alpha2[0] = rd_alpha2[0];
- request->alpha2[1] = rd_alpha2[1];
+ request->alpha2[0] = alpha2[0];
+ request->alpha2[1] = alpha2[1];
request->initiator = set_by;
request->wiphy = wiphy;
kfree(last_request);
last_request = request;
- if (rd)
- break;
r = call_crda(alpha2);
#ifndef CONFIG_WIRELESS_OLD_REGULATORY
if (r)
@@ -605,25 +586,13 @@ int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
return r;
}
-int regulatory_hint(struct wiphy *wiphy, const char *alpha2,
- struct ieee80211_regdomain *rd)
+void regulatory_hint(struct wiphy *wiphy, const char *alpha2)
{
- int r;
- BUG_ON(!rd && !alpha2);
+ BUG_ON(!alpha2);
mutex_lock(&cfg80211_drv_mutex);
-
- r = __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER, alpha2, rd);
- if (r || !rd)
- goto unlock_and_exit;
-
- /* If the driver passed a regulatory domain we skipped asking
- * userspace for one so we can now go ahead and set it */
- r = set_regdom(rd);
-
-unlock_and_exit:
+ __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER, alpha2);
mutex_unlock(&cfg80211_drv_mutex);
- return r;
}
EXPORT_SYMBOL(regulatory_hint);
@@ -792,11 +761,11 @@ int regulatory_init(void)
* 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, NULL);
+ ieee80211_regdom);
#else
cfg80211_regdomain = cfg80211_world_regdom;
- err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE, "00", NULL);
+ err = __regulatory_hint(NULL, REGDOM_SET_BY_CORE, "00");
if (err)
printk(KERN_ERR "cfg80211: calling CRDA failed - "
"unable to update world regulatory domain, "