* [PATCH] wireless: remove struct regdom hinting
@ 2008-10-21 10:30 Johannes Berg
2008-10-22 11:39 ` Luis R. Rodriguez
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2008-10-21 10:30 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
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.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
drivers/net/wireless/zd1211rw/zd_mac.c | 2 -
include/net/wireless.h | 22 +-----------
net/wireless/nl80211.c | 2 -
net/wireless/reg.c | 60 +++++++--------------------------
net/wireless/reg.h | 23 +++---------
5 files changed, 24 insertions(+), 85 deletions(-)
--- everything.orig/include/net/wireless.h 2008-10-21 11:13:57.000000000 +0200
+++ everything/include/net/wireless.h 2008-10-21 11:50:01.000000000 +0200
@@ -342,35 +342,17 @@ ieee80211_get_channel(struct wiphy *wiph
/**
* regulatory_hint - driver hint to the wireless core a regulatory domain
- * @wiphy: the driver's very own &struct wiphy
* @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
* should be in. If @rd is set this should be NULL. Note that if you
* set this to NULL you should still set rd->alpha2 to some accepted
* alpha2.
- * @rd: a complete regulatory domain provided by the driver. If passed
- * the driver does not need to worry about freeing it.
*
* Wireless drivers can use this function to hint to the wireless core
* what it believes should be the current regulatory domain by
* giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
* domain should be in or by providing a completely build regulatory domain.
* If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
- * for a regulatory domain structure for the respective country. If
- * a regulatory domain is build and passed you should set the alpha2
- * if possible, otherwise set it to the special value of "99" which tells
- * the wireless core it is unknown. If you pass a built regulatory domain
- * and we return non zero you are in charge of kfree()'ing the structure.
- *
- * Returns -EALREADY if *a regulatory domain* has already been set. Note that
- * this could be by another driver. It is safe for drivers to continue if
- * -EALREADY is returned, if drivers are not capable of world roaming they
- * should not register more channels than they support. Right now we only
- * support listening to the first driver hint. If the driver is capable
- * of world roaming but wants to respect its own EEPROM mappings for
- * specific regulatory domains it should register the @reg_notifier callback
- * on the &struct wiphy. Returns 0 if the hint went through fine or through an
- * intersection operation. Otherwise a standard error code is returned.
+ * for a regulatory domain structure for the respective country.
*/
-extern int regulatory_hint(struct wiphy *wiphy,
- const char *alpha2, struct ieee80211_regdomain *rd);
+extern void regulatory_hint(const char *alpha2);
#endif /* __NET_WIRELESS_H */
--- everything.orig/drivers/net/wireless/zd1211rw/zd_mac.c 2008-10-21 11:15:28.000000000 +0200
+++ everything/drivers/net/wireless/zd1211rw/zd_mac.c 2008-10-21 11:42:12.000000000 +0200
@@ -171,7 +171,7 @@ int zd_mac_init_hw(struct ieee80211_hw *
r = zd_reg2alpha2(mac->regdomain, alpha2);
if (!r)
- regulatory_hint(hw->wiphy, alpha2, NULL);
+ regulatory_hint(alpha2);
r = 0;
disable_int:
--- everything.orig/net/wireless/nl80211.c 2008-10-21 11:20:23.000000000 +0200
+++ everything/net/wireless/nl80211.c 2008-10-21 11:20:26.000000000 +0200
@@ -1693,7 +1693,7 @@ static int nl80211_req_set_reg(struct sk
return -EINVAL;
#endif
mutex_lock(&cfg80211_drv_mutex);
- r = __regulatory_hint(NULL, REGDOM_SET_BY_USER, data, NULL);
+ r = __regulatory_hint(NULL, REGDOM_SET_BY_USER, data);
mutex_unlock(&cfg80211_drv_mutex);
return r;
}
--- everything.orig/net/wireless/reg.c 2008-10-21 11:15:49.000000000 +0200
+++ everything/net/wireless/reg.c 2008-10-21 11:50:14.000000000 +0200
@@ -42,7 +42,7 @@
#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 */
struct regulatory_request {
struct wiphy *wiphy;
int granted;
@@ -299,7 +299,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)
@@ -344,22 +344,8 @@ static int ignore_request(struct wiphy *
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
@@ -558,40 +544,32 @@ void wiphy_update_regulatory(struct wiph
/* 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)
@@ -606,25 +584,13 @@ int __regulatory_hint(struct wiphy *wiph
return r;
}
-int regulatory_hint(struct wiphy *wiphy, const char *alpha2,
- struct ieee80211_regdomain *rd)
+void regulatory_hint(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(NULL, REGDOM_SET_BY_DRIVER, alpha2);
mutex_unlock(&cfg80211_drv_mutex);
- return r;
}
EXPORT_SYMBOL(regulatory_hint);
@@ -794,11 +760,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, "
--- everything.orig/net/wireless/reg.h 2008-10-21 11:16:54.000000000 +0200
+++ everything/net/wireless/reg.h 2008-10-21 11:43:18.000000000 +0200
@@ -11,30 +11,21 @@ int set_regdom(const struct ieee80211_re
/**
* __regulatory_hint - hint to the wireless core a regulatory domain
- * @wiphy: if a driver is providing the hint this is the driver's very
- * own &struct wiphy
+ * @wiphy: if the hint comes from country information from an AP, this
+ * is required to be set to the wiphy that received the information
* @alpha2: the ISO/IEC 3166 alpha2 being claimed the regulatory domain
- * should be in. If @rd is set this should be NULL
- * @rd: a complete regulatory domain, if passed the caller need not worry
- * about freeing it
+ * should be in. If @rd is set this should be NULL
*
* The Wireless subsystem can use this function to hint to the wireless core
* what it believes should be the current regulatory domain by
* giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
- * domain should be in or by providing a completely build regulatory domain.
+ * domain should be in.
*
- * Returns -EALREADY if *a regulatory domain* has already been set. Note that
- * this could be by another driver. It is safe for drivers to continue if
- * -EALREADY is returned, if drivers are not capable of world roaming they
- * should not register more channels than they support. Right now we only
- * support listening to the first driver hint. If the driver is capable
- * of world roaming but wants to respect its own EEPROM mappings for
- * specific regulatory domains it should register the @reg_notifier callback
- * on the &struct wiphy. Returns 0 if the hint went through fine or through an
- * intersection operation. Otherwise a standard error code is returned.
+ * Returns zero if all went fine, %-EALREADY if a regulatory domain had
+ * already been set or other standard error codes.
*
*/
extern int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
- const char *alpha2, struct ieee80211_regdomain *rd);
+ const char *alpha2);
#endif /* __NET_WIRELESS_REG_H */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] wireless: remove struct regdom hinting
2008-10-21 10:30 [PATCH] wireless: remove struct regdom hinting Johannes Berg
@ 2008-10-22 11:39 ` Luis R. Rodriguez
2008-10-22 18:51 ` [PATCH v2] " Johannes Berg
0 siblings, 1 reply; 8+ messages in thread
From: Luis R. Rodriguez @ 2008-10-22 11:39 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless
On Tue, Oct 21, 2008 at 03:30:42AM -0700, Johannes Berg wrote:
> --- everything.orig/net/wireless/reg.h 2008-10-21 11:16:54.000000000 +0200
> +++ everything/net/wireless/reg.h 2008-10-21 11:43:18.000000000 +0200
> @@ -11,30 +11,21 @@ int set_regdom(const struct ieee80211_re
>
> /**
> * __regulatory_hint - hint to the wireless core a regulatory domain
> - * @wiphy: if a driver is providing the hint this is the driver's very
> - * own &struct wiphy
> + * @wiphy: if the hint comes from country information from an AP, this
> + * is required to be set to the wiphy that received the information
> * @alpha2: the ISO/IEC 3166 alpha2 being claimed the regulatory domain
> - * should be in. If @rd is set this should be NULL
> - * @rd: a complete regulatory domain, if passed the caller need not worry
> - * about freeing it
> + * should be in. If @rd is set this should be NULL
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That can be removed from kdoc as @rd is gone now. Also can you
please update Documentation/networking/regulatory.txt to reflect the
new changes for mortals?
Luis
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] wireless: remove struct regdom hinting
2008-10-22 18:51 ` [PATCH v2] " Johannes Berg
@ 2008-10-22 12:29 ` Luis R. Rodriguez
2008-10-22 19:31 ` Johannes Berg
0 siblings, 1 reply; 8+ messages in thread
From: Luis R. Rodriguez @ 2008-10-22 12:29 UTC (permalink / raw)
To: Johannes Berg; +Cc: Luis Rodriguez, John Linville, linux-wireless
On Wed, Oct 22, 2008 at 11:51:36AM -0700, Johannes Berg wrote:
> -/* 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 */
Why don't we want to keep track of the wiphy if the driver set it?
Luis
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] wireless: remove struct regdom hinting
2008-10-22 19:31 ` Johannes Berg
@ 2008-10-22 12:41 ` Luis R. Rodriguez
2008-10-22 19:43 ` Johannes Berg
0 siblings, 1 reply; 8+ messages in thread
From: Luis R. Rodriguez @ 2008-10-22 12:41 UTC (permalink / raw)
To: Johannes Berg; +Cc: Luis Rodriguez, John Linville, linux-wireless
On Wed, Oct 22, 2008 at 12:31:09PM -0700, Johannes Berg wrote:
> On Wed, 2008-10-22 at 05:29 -0700, Luis R. Rodriguez wrote:
> > On Wed, Oct 22, 2008 at 11:51:36AM -0700, Johannes Berg wrote:
> > > -/* 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 */
> >
> > Why don't we want to keep track of the wiphy if the driver set it?
>
> Why would we? I removed it from the hinting functions so that we don't
> need to have a valid wiphy to call a hint, which seems quite possible?
Well, the alpha2 hint from country IE we'd built it from the IE
and then try call an rd hint routine, I take it now it would be the new
struct one. OK -- in that one we have the wiphy. In that case that
routine needs to be updated to check to see if the initiator is
country IE and if so mark XXX do to intersection.
Then the reason I kept the wiphy around for the regular alpha2 case is
you will want to keep track if a different wiphy sent this new alpha2
request. If so I think we do interesection then, or let the user disable
one or something.
But yea its useful to keep track of I think. I thought you didn't remove
it from ignore_request(), hm.. that's where we use it to do all these
checks.
Luis
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] wireless: remove struct regdom hinting
2008-10-22 19:43 ` Johannes Berg
@ 2008-10-22 14:36 ` Luis R. Rodriguez
0 siblings, 0 replies; 8+ messages in thread
From: Luis R. Rodriguez @ 2008-10-22 14:36 UTC (permalink / raw)
To: Johannes Berg; +Cc: Luis Rodriguez, John Linville, linux-wireless
On Wed, Oct 22, 2008 at 12:43:42PM -0700, Johannes Berg wrote:
> On Wed, 2008-10-22 at 05:41 -0700, Luis R. Rodriguez wrote:
>
> > Well, the alpha2 hint from country IE we'd built it from the IE
> > and then try call an rd hint routine, I take it now it would be the new
> > struct one.
>
> No, we'll have to add a new one for that
OK fair enough. Should make it easier to read too.
Luis
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] wireless: remove struct regdom hinting
2008-10-22 11:39 ` Luis R. Rodriguez
@ 2008-10-22 18:51 ` Johannes Berg
2008-10-22 12:29 ` Luis R. Rodriguez
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2008-10-22 18:51 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: John Linville, linux-wireless
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.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
drivers/net/wireless/zd1211rw/zd_mac.c | 2 -
include/net/wireless.h | 22 +-----------
net/wireless/nl80211.c | 2 -
net/wireless/reg.c | 60 +++++++--------------------------
net/wireless/reg.h | 23 +++---------
5 files changed, 24 insertions(+), 85 deletions(-)
--- everything.orig/include/net/wireless.h 2008-10-22 10:28:19.000000000 +0200
+++ everything/include/net/wireless.h 2008-10-22 20:50:18.000000000 +0200
@@ -342,35 +342,17 @@ ieee80211_get_channel(struct wiphy *wiph
/**
* regulatory_hint - driver hint to the wireless core a regulatory domain
- * @wiphy: the driver's very own &struct wiphy
* @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
* should be in. If @rd is set this should be NULL. Note that if you
* set this to NULL you should still set rd->alpha2 to some accepted
* alpha2.
- * @rd: a complete regulatory domain provided by the driver. If passed
- * the driver does not need to worry about freeing it.
*
* Wireless drivers can use this function to hint to the wireless core
* what it believes should be the current regulatory domain by
* giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
* domain should be in or by providing a completely build regulatory domain.
* If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
- * for a regulatory domain structure for the respective country. If
- * a regulatory domain is build and passed you should set the alpha2
- * if possible, otherwise set it to the special value of "99" which tells
- * the wireless core it is unknown. If you pass a built regulatory domain
- * and we return non zero you are in charge of kfree()'ing the structure.
- *
- * Returns -EALREADY if *a regulatory domain* has already been set. Note that
- * this could be by another driver. It is safe for drivers to continue if
- * -EALREADY is returned, if drivers are not capable of world roaming they
- * should not register more channels than they support. Right now we only
- * support listening to the first driver hint. If the driver is capable
- * of world roaming but wants to respect its own EEPROM mappings for
- * specific regulatory domains it should register the @reg_notifier callback
- * on the &struct wiphy. Returns 0 if the hint went through fine or through an
- * intersection operation. Otherwise a standard error code is returned.
+ * for a regulatory domain structure for the respective country.
*/
-extern int regulatory_hint(struct wiphy *wiphy,
- const char *alpha2, struct ieee80211_regdomain *rd);
+extern void regulatory_hint(const char *alpha2);
#endif /* __NET_WIRELESS_H */
--- everything.orig/drivers/net/wireless/zd1211rw/zd_mac.c 2008-10-22 10:27:51.000000000 +0200
+++ everything/drivers/net/wireless/zd1211rw/zd_mac.c 2008-10-22 10:28:24.000000000 +0200
@@ -171,7 +171,7 @@ int zd_mac_init_hw(struct ieee80211_hw *
r = zd_reg2alpha2(mac->regdomain, alpha2);
if (!r)
- regulatory_hint(hw->wiphy, alpha2, NULL);
+ regulatory_hint(alpha2);
r = 0;
disable_int:
--- everything.orig/net/wireless/nl80211.c 2008-10-22 10:28:22.000000000 +0200
+++ everything/net/wireless/nl80211.c 2008-10-22 20:50:16.000000000 +0200
@@ -1693,7 +1693,7 @@ static int nl80211_req_set_reg(struct sk
return -EINVAL;
#endif
mutex_lock(&cfg80211_drv_mutex);
- r = __regulatory_hint(NULL, REGDOM_SET_BY_USER, data, NULL);
+ r = __regulatory_hint(NULL, REGDOM_SET_BY_USER, data);
mutex_unlock(&cfg80211_drv_mutex);
return r;
}
--- everything.orig/net/wireless/reg.c 2008-10-22 10:28:23.000000000 +0200
+++ everything/net/wireless/reg.c 2008-10-22 20:50:18.000000000 +0200
@@ -42,7 +42,7 @@
#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 */
struct regulatory_request {
struct wiphy *wiphy;
int granted;
@@ -299,7 +299,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)
@@ -344,22 +344,8 @@ static int ignore_request(struct wiphy *
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
@@ -558,40 +544,32 @@ void wiphy_update_regulatory(struct wiph
/* 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)
@@ -606,25 +584,13 @@ int __regulatory_hint(struct wiphy *wiph
return r;
}
-int regulatory_hint(struct wiphy *wiphy, const char *alpha2,
- struct ieee80211_regdomain *rd)
+void regulatory_hint(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(NULL, REGDOM_SET_BY_DRIVER, alpha2);
mutex_unlock(&cfg80211_drv_mutex);
- return r;
}
EXPORT_SYMBOL(regulatory_hint);
@@ -794,11 +760,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, "
--- everything.orig/net/wireless/reg.h 2008-10-22 10:28:20.000000000 +0200
+++ everything/net/wireless/reg.h 2008-10-22 20:50:34.000000000 +0200
@@ -11,30 +11,21 @@ int set_regdom(const struct ieee80211_re
/**
* __regulatory_hint - hint to the wireless core a regulatory domain
- * @wiphy: if a driver is providing the hint this is the driver's very
- * own &struct wiphy
+ * @wiphy: if the hint comes from country information from an AP, this
+ * is required to be set to the wiphy that received the information
* @alpha2: the ISO/IEC 3166 alpha2 being claimed the regulatory domain
- * should be in. If @rd is set this should be NULL
- * @rd: a complete regulatory domain, if passed the caller need not worry
- * about freeing it
+ * should be in.
*
* The Wireless subsystem can use this function to hint to the wireless core
* what it believes should be the current regulatory domain by
* giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
- * domain should be in or by providing a completely build regulatory domain.
+ * domain should be in.
*
- * Returns -EALREADY if *a regulatory domain* has already been set. Note that
- * this could be by another driver. It is safe for drivers to continue if
- * -EALREADY is returned, if drivers are not capable of world roaming they
- * should not register more channels than they support. Right now we only
- * support listening to the first driver hint. If the driver is capable
- * of world roaming but wants to respect its own EEPROM mappings for
- * specific regulatory domains it should register the @reg_notifier callback
- * on the &struct wiphy. Returns 0 if the hint went through fine or through an
- * intersection operation. Otherwise a standard error code is returned.
+ * Returns zero if all went fine, %-EALREADY if a regulatory domain had
+ * already been set or other standard error codes.
*
*/
extern int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
- const char *alpha2, struct ieee80211_regdomain *rd);
+ const char *alpha2);
#endif /* __NET_WIRELESS_REG_H */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] wireless: remove struct regdom hinting
2008-10-22 12:29 ` Luis R. Rodriguez
@ 2008-10-22 19:31 ` Johannes Berg
2008-10-22 12:41 ` Luis R. Rodriguez
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2008-10-22 19:31 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: Luis Rodriguez, John Linville, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 517 bytes --]
On Wed, 2008-10-22 at 05:29 -0700, Luis R. Rodriguez wrote:
> On Wed, Oct 22, 2008 at 11:51:36AM -0700, Johannes Berg wrote:
> > -/* 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 */
>
> Why don't we want to keep track of the wiphy if the driver set it?
Why would we? I removed it from the hinting functions so that we don't
need to have a valid wiphy to call a hint, which seems quite possible?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] wireless: remove struct regdom hinting
2008-10-22 12:41 ` Luis R. Rodriguez
@ 2008-10-22 19:43 ` Johannes Berg
2008-10-22 14:36 ` Luis R. Rodriguez
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2008-10-22 19:43 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: Luis Rodriguez, John Linville, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 592 bytes --]
On Wed, 2008-10-22 at 05:41 -0700, Luis R. Rodriguez wrote:
> Well, the alpha2 hint from country IE we'd built it from the IE
> and then try call an rd hint routine, I take it now it would be the new
> struct one.
No, we'll have to add a new one for that
> But yea its useful to keep track of I think. I thought you didn't remove
> it from ignore_request(), hm.. that's where we use it to do all these
> checks.
Actually there was only one pointless warning where a driver does two
hints for the same wiphy (that's just a code bug), and it's otherwise
unused.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-10-22 21:37 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-21 10:30 [PATCH] wireless: remove struct regdom hinting Johannes Berg
2008-10-22 11:39 ` Luis R. Rodriguez
2008-10-22 18:51 ` [PATCH v2] " Johannes Berg
2008-10-22 12:29 ` Luis R. Rodriguez
2008-10-22 19:31 ` Johannes Berg
2008-10-22 12:41 ` Luis R. Rodriguez
2008-10-22 19:43 ` Johannes Berg
2008-10-22 14:36 ` Luis R. Rodriguez
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).