linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ath9k: fix custom regulatory call position
@ 2009-05-19 21:49 Luis R. Rodriguez
  2009-05-19 21:49 ` [PATCH 2/3] ath9k: set max default eirp to 20 dBm Luis R. Rodriguez
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Luis R. Rodriguez @ 2009-05-19 21:49 UTC (permalink / raw)
  To: linville; +Cc: johannes, linux-wireless, Luis R. Rodriguez

ath_regd_init() needs to be called with the wiphy already
properly set with the bands. Without this the custom regulatory
settings were not taking effect, and the device would get
the default channel settings from ath9k_[25]ghz_chantable.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/main.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index c161b75..7fab2d4 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1412,8 +1412,6 @@ static int ath_init(u16 devid, struct ath_softc *sc)
 	for (i = 0; i < sc->keymax; i++)
 		ath9k_hw_keyreset(ah, (u16) i);
 
-	error = ath_regd_init(&sc->sc_ah->regulatory, sc->hw->wiphy,
-			      ath9k_reg_notifier);
 	if (error)
 		goto bad;
 
@@ -1626,14 +1624,19 @@ int ath_attach(u16 devid, struct ath_softc *sc)
 	if (error != 0)
 		return error;
 
-	reg = &sc->sc_ah->regulatory;
-
 	/* get mac address from hardware and set in mac80211 */
 
 	SET_IEEE80211_PERM_ADDR(hw, sc->sc_ah->macaddr);
 
 	ath_set_hw_capab(sc, hw);
 
+        error = ath_regd_init(&sc->sc_ah->regulatory, sc->hw->wiphy,
+			      ath9k_reg_notifier);
+	if (error)
+		return error;
+
+	reg = &sc->sc_ah->regulatory;
+
 	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
 		setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
 		if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes))
-- 
1.6.0.6


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

* [PATCH 2/3] ath9k: set max default eirp to 20 dBm
  2009-05-19 21:49 [PATCH 1/3] ath9k: fix custom regulatory call position Luis R. Rodriguez
@ 2009-05-19 21:49 ` Luis R. Rodriguez
  2009-05-19 21:49 ` [PATCH 3/3] cfg80211: warn when wiphy_apply_custom_regulatory() does nothing Luis R. Rodriguez
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Luis R. Rodriguez @ 2009-05-19 21:49 UTC (permalink / raw)
  To: linville; +Cc: johannes, linux-wireless, Luis R. Rodriguez

This is always discarded anyway but lets just set this to our
safest lowest.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath9k/main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 7fab2d4..72ead61 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -35,14 +35,14 @@ MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption");
 #define CHAN2G(_freq, _idx)  { \
 	.center_freq = (_freq), \
 	.hw_value = (_idx), \
-	.max_power = 30, \
+	.max_power = 20, \
 }
 
 #define CHAN5G(_freq, _idx) { \
 	.band = IEEE80211_BAND_5GHZ, \
 	.center_freq = (_freq), \
 	.hw_value = (_idx), \
-	.max_power = 30, \
+	.max_power = 20, \
 }
 
 /* Some 2 GHz radios are actually tunable on 2312-2732
-- 
1.6.0.6


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

* [PATCH 3/3] cfg80211: warn when wiphy_apply_custom_regulatory() does nothing
  2009-05-19 21:49 [PATCH 1/3] ath9k: fix custom regulatory call position Luis R. Rodriguez
  2009-05-19 21:49 ` [PATCH 2/3] ath9k: set max default eirp to 20 dBm Luis R. Rodriguez
@ 2009-05-19 21:49 ` Luis R. Rodriguez
  2009-05-19 22:05 ` [PATCH 1/3] ath9k: fix custom regulatory call position Johannes Berg
  2009-05-19 22:33 ` Bob Copeland
  3 siblings, 0 replies; 8+ messages in thread
From: Luis R. Rodriguez @ 2009-05-19 21:49 UTC (permalink / raw)
  To: linville; +Cc: johannes, linux-wireless, Luis R. Rodriguez

Device drivers using wiphy_apply_custom_regulatory() want some
regulatory settings applied to their wiphy, if no bands were
configured on the wiphy then something went wrong.

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

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 48db569..0eac285 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1342,13 +1342,22 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
 				   const struct ieee80211_regdomain *regd)
 {
 	enum ieee80211_band band;
+	unsigned int bands_set = 0;
 
 	mutex_lock(&cfg80211_mutex);
 	for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
-		if (wiphy->bands[band])
-			handle_band_custom(wiphy, band, regd);
+		if (!wiphy->bands[band])
+			continue;
+		handle_band_custom(wiphy, band, regd);
+		bands_set++;
 	}
 	mutex_unlock(&cfg80211_mutex);
+
+	/*
+	 * no point in calling this if it won't have any effect
+	 * on your device's supportd bands.
+	 */
+	WARN_ON(!bands_set);
 }
 EXPORT_SYMBOL(wiphy_apply_custom_regulatory);
 
-- 
1.6.0.6


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

* Re: [PATCH 1/3] ath9k: fix custom regulatory call position
  2009-05-19 21:49 [PATCH 1/3] ath9k: fix custom regulatory call position Luis R. Rodriguez
  2009-05-19 21:49 ` [PATCH 2/3] ath9k: set max default eirp to 20 dBm Luis R. Rodriguez
  2009-05-19 21:49 ` [PATCH 3/3] cfg80211: warn when wiphy_apply_custom_regulatory() does nothing Luis R. Rodriguez
@ 2009-05-19 22:05 ` Johannes Berg
  2009-05-19 22:33 ` Bob Copeland
  3 siblings, 0 replies; 8+ messages in thread
From: Johannes Berg @ 2009-05-19 22:05 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, linux-wireless

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

On Tue, 2009-05-19 at 17:49 -0400, Luis R. Rodriguez wrote:

>  	ath_set_hw_capab(sc, hw);
>  
> +        error = ath_regd_init(&sc->sc_ah->regulatory, sc->hw->wiphy,
> +			      ath9k_reg_notifier);
> +	if (error)

that looks like a whitespace problem

johannes

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

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

* Re: [PATCH 1/3] ath9k: fix custom regulatory call position
  2009-05-19 21:49 [PATCH 1/3] ath9k: fix custom regulatory call position Luis R. Rodriguez
                   ` (2 preceding siblings ...)
  2009-05-19 22:05 ` [PATCH 1/3] ath9k: fix custom regulatory call position Johannes Berg
@ 2009-05-19 22:33 ` Bob Copeland
  2009-05-19 22:42   ` Luis R. Rodriguez
  3 siblings, 1 reply; 8+ messages in thread
From: Bob Copeland @ 2009-05-19 22:33 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, johannes, linux-wireless

On Tue, May 19, 2009 at 5:49 PM, Luis R. Rodriguez > ---
a/drivers/net/wireless/ath/ath9k/main.c
> +++ b/drivers/net/wireless/ath/ath9k/main.c
> @@ -1412,8 +1412,6 @@ static int ath_init(u16 devid, struct ath_softc *sc)
>        for (i = 0; i < sc->keymax; i++)
>                ath9k_hw_keyreset(ah, (u16) i);
>
> -       error = ath_regd_init(&sc->sc_ah->regulatory, sc->hw->wiphy,
> -                             ath9k_reg_notifier);
>        if (error)
>                goto bad;

Is the "if (error)" check still valid?

-- 
Bob Copeland %% www.bobcopeland.com

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

* Re: [PATCH 1/3] ath9k: fix custom regulatory call position
  2009-05-19 22:33 ` Bob Copeland
@ 2009-05-19 22:42   ` Luis R. Rodriguez
  2009-05-20  0:51     ` Bob Copeland
  0 siblings, 1 reply; 8+ messages in thread
From: Luis R. Rodriguez @ 2009-05-19 22:42 UTC (permalink / raw)
  To: Bob Copeland; +Cc: linville, johannes, linux-wireless

On Tue, May 19, 2009 at 3:33 PM, Bob Copeland <me@bobcopeland.com> wrote:
> On Tue, May 19, 2009 at 5:49 PM, Luis R. Rodriguez > ---
> a/drivers/net/wireless/ath/ath9k/main.c
>> +++ b/drivers/net/wireless/ath/ath9k/main.c
>> @@ -1412,8 +1412,6 @@ static int ath_init(u16 devid, struct ath_softc *sc)
>>        for (i = 0; i < sc->keymax; i++)
>>                ath9k_hw_keyreset(ah, (u16) i);
>>
>> -       error = ath_regd_init(&sc->sc_ah->regulatory, sc->hw->wiphy,
>> -                             ath9k_reg_notifier);
>>        if (error)
>>                goto bad;
>
> Is the "if (error)" check still valid?

Sure, although we'll never hit it, we should just make ath_regd_init() void.

  Luis

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

* Re: [PATCH 1/3] ath9k: fix custom regulatory call position
  2009-05-19 22:42   ` Luis R. Rodriguez
@ 2009-05-20  0:51     ` Bob Copeland
  2009-05-20  1:25       ` Luis R. Rodriguez
  0 siblings, 1 reply; 8+ messages in thread
From: Bob Copeland @ 2009-05-20  0:51 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, johannes, linux-wireless

On Tue, May 19, 2009 at 03:42:56PM -0700, Luis R. Rodriguez wrote:
> >> @@ -1412,8 +1412,6 @@ static int ath_init(u16 devid, struct ath_softc *sc)
> >>        for (i = 0; i < sc->keymax; i++)
> >>                ath9k_hw_keyreset(ah, (u16) i);
> >>
> >> -       error = ath_regd_init(&sc->sc_ah->regulatory, sc->hw->wiphy,
> >> -                             ath9k_reg_notifier);
> >>        if (error)
> >>                goto bad;
> >
> > Is the "if (error)" check still valid?
> 
> Sure, although we'll never hit it, we should just make ath_regd_init() void

I should rephrase that as a statement :)  You moved the ath_regd_init
but forgot to remove the "if (error) goto bad" part.

-- 
Bob Copeland %% www.bobcopeland.com


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

* Re: [PATCH 1/3] ath9k: fix custom regulatory call position
  2009-05-20  0:51     ` Bob Copeland
@ 2009-05-20  1:25       ` Luis R. Rodriguez
  0 siblings, 0 replies; 8+ messages in thread
From: Luis R. Rodriguez @ 2009-05-20  1:25 UTC (permalink / raw)
  To: Bob Copeland
  Cc: Luis Rodriguez, linville@tuxdriver.com, johannes@sipsolutions.net,
	linux-wireless@vger.kernel.org

On Tue, May 19, 2009 at 05:51:01PM -0700, Bob Copeland wrote:
> On Tue, May 19, 2009 at 03:42:56PM -0700, Luis R. Rodriguez wrote:
> > >> @@ -1412,8 +1412,6 @@ static int ath_init(u16 devid, struct ath_softc *sc)
> > >>        for (i = 0; i < sc->keymax; i++)
> > >>                ath9k_hw_keyreset(ah, (u16) i);
> > >>
> > >> -       error = ath_regd_init(&sc->sc_ah->regulatory, sc->hw->wiphy,
> > >> -                             ath9k_reg_notifier);
> > >>        if (error)
> > >>                goto bad;
> > >
> > > Is the "if (error)" check still valid?
> >
> > Sure, although we'll never hit it, we should just make ath_regd_init() void
> 
> I should rephrase that as a statement :)  You moved the ath_regd_init
> but forgot to remove the "if (error) goto bad" part.

Heh... thanks, will resend.

  Luis

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

end of thread, other threads:[~2009-05-20  1:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-19 21:49 [PATCH 1/3] ath9k: fix custom regulatory call position Luis R. Rodriguez
2009-05-19 21:49 ` [PATCH 2/3] ath9k: set max default eirp to 20 dBm Luis R. Rodriguez
2009-05-19 21:49 ` [PATCH 3/3] cfg80211: warn when wiphy_apply_custom_regulatory() does nothing Luis R. Rodriguez
2009-05-19 22:05 ` [PATCH 1/3] ath9k: fix custom regulatory call position Johannes Berg
2009-05-19 22:33 ` Bob Copeland
2009-05-19 22:42   ` Luis R. Rodriguez
2009-05-20  0:51     ` Bob Copeland
2009-05-20  1:25       ` 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).