public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cfg80211: treat ieee80211_regdom hints as user hints
@ 2009-07-15  0:23 Luis R. Rodriguez
  2009-07-15  9:39 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Luis R. Rodriguez @ 2009-07-15  0:23 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez

We were treating ieee80211_regdom module parameter hints
as core hints, this means we were not letting the user help
compliance further when using the module parameter. It also
meant that users with a device with a custom regulatory
domain set (wiphy->custom_regulatory) using this module
parameter were being stuck to the original default core
static regualtory domain. We fix this by using the static
cfg80211_regdomain alpha2 as the core hint and treating the
module parameter separately.

All iwlwifi and ath5k/ath9k/ar9170 devices which world roam
set the wiphy->custom_regulatory. This change allows users
using this module parameter to have it trated as a a proper
user hint and not have it ignored.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 net/wireless/reg.c |   25 +++++++++----------------
 1 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 2b4a6c6..fb40428 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -113,11 +113,7 @@ static const struct ieee80211_regdomain world_regdom = {
 static const struct ieee80211_regdomain *cfg80211_world_regdom =
 	&world_regdom;
 
-#ifdef CONFIG_WIRELESS_OLD_REGULATORY
-static char *ieee80211_regdom = "US";
-#else
 static char *ieee80211_regdom = "00";
-#endif
 
 module_param(ieee80211_regdom, charp, 0444);
 MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code");
@@ -2287,22 +2283,12 @@ int regulatory_init(void)
 
 	printk(KERN_INFO "cfg80211: Using static regulatory domain info\n");
 	print_regdomain_info(cfg80211_regdomain);
-	/*
-	 * The old code still requests for a new regdomain and if
-	 * you have CRDA you get it updated, otherwise you get
-	 * stuck with the static values. Since "EU" is not a valid
-	 * ISO / IEC 3166 alpha2 code we can't expect userpace to
-	 * give us a regulatory domain for it. We need last_request
-	 * iniitalized though so lets just send a request which we
-	 * know will be ignored... this crap will be removed once
-	 * OLD_REG dies.
-	 */
-	err = regulatory_hint_core(ieee80211_regdom);
 #else
 	cfg80211_regdomain = cfg80211_world_regdom;
 
-	err = regulatory_hint_core(ieee80211_regdom);
 #endif
+	/* We always try to get an update for the static regdomain */
+	err = regulatory_hint_core(cfg80211_regdomain->alpha2);
 	if (err) {
 		if (err == -ENOMEM)
 			return err;
@@ -2321,6 +2307,13 @@ int regulatory_init(void)
 #endif
 	}
 
+	/*
+	 * Finally, if the user set the module parameter treat it
+	 * as a user hint.
+	 */
+	if (!is_world_regdom(ieee80211_regdom))
+		regulatory_hint_user(ieee80211_regdom);
+
 	return 0;
 }
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cfg80211: treat ieee80211_regdom hints as user hints
  2009-07-15  0:23 [PATCH] cfg80211: treat ieee80211_regdom hints as user hints Luis R. Rodriguez
@ 2009-07-15  9:39 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2009-07-15  9:39 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, linux-wireless, ath9k-devel

[-- Attachment #1: Type: text/plain, Size: 2979 bytes --]

On Tue, 2009-07-14 at 20:23 -0400, Luis R. Rodriguez wrote:
> We were treating ieee80211_regdom module parameter hints
> as core hints, this means we were not letting the user help
> compliance further when using the module parameter. It also
> meant that users with a device with a custom regulatory
> domain set (wiphy->custom_regulatory) using this module
> parameter were being stuck to the original default core
> static regualtory domain. We fix this by using the static
> cfg80211_regdomain alpha2 as the core hint and treating the
> module parameter separately.
> 
> All iwlwifi and ath5k/ath9k/ar9170 devices which world roam
> set the wiphy->custom_regulatory. This change allows users
> using this module parameter to have it trated as a a proper
> user hint and not have it ignored.
> 
> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>

Acked-by: Johannes Berg <johannes@sipsolutions.net>

> ---
>  net/wireless/reg.c |   25 +++++++++----------------
>  1 files changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index 2b4a6c6..fb40428 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -113,11 +113,7 @@ static const struct ieee80211_regdomain world_regdom = {
>  static const struct ieee80211_regdomain *cfg80211_world_regdom =
>  	&world_regdom;
>  
> -#ifdef CONFIG_WIRELESS_OLD_REGULATORY
> -static char *ieee80211_regdom = "US";
> -#else
>  static char *ieee80211_regdom = "00";
> -#endif
>  
>  module_param(ieee80211_regdom, charp, 0444);
>  MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code");
> @@ -2287,22 +2283,12 @@ int regulatory_init(void)
>  
>  	printk(KERN_INFO "cfg80211: Using static regulatory domain info\n");
>  	print_regdomain_info(cfg80211_regdomain);
> -	/*
> -	 * The old code still requests for a new regdomain and if
> -	 * you have CRDA you get it updated, otherwise you get
> -	 * stuck with the static values. Since "EU" is not a valid
> -	 * ISO / IEC 3166 alpha2 code we can't expect userpace to
> -	 * give us a regulatory domain for it. We need last_request
> -	 * iniitalized though so lets just send a request which we
> -	 * know will be ignored... this crap will be removed once
> -	 * OLD_REG dies.
> -	 */
> -	err = regulatory_hint_core(ieee80211_regdom);
>  #else
>  	cfg80211_regdomain = cfg80211_world_regdom;
>  
> -	err = regulatory_hint_core(ieee80211_regdom);
>  #endif
> +	/* We always try to get an update for the static regdomain */
> +	err = regulatory_hint_core(cfg80211_regdomain->alpha2);
>  	if (err) {
>  		if (err == -ENOMEM)
>  			return err;
> @@ -2321,6 +2307,13 @@ int regulatory_init(void)
>  #endif
>  	}
>  
> +	/*
> +	 * Finally, if the user set the module parameter treat it
> +	 * as a user hint.
> +	 */
> +	if (!is_world_regdom(ieee80211_regdom))
> +		regulatory_hint_user(ieee80211_regdom);
> +
>  	return 0;
>  }
>  

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-15  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-15  0:23 [PATCH] cfg80211: treat ieee80211_regdom hints as user hints Luis R. Rodriguez
2009-07-15  9:39 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox