linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath9k: enable 2GHz band only if the device supports it
@ 2009-11-25 20:29 Gabor Juhos
  2009-11-25 21:38 ` [ath9k-devel] " Luis R. Rodriguez
  0 siblings, 1 reply; 4+ messages in thread
From: Gabor Juhos @ 2009-11-25 20:29 UTC (permalink / raw)
  To: John Linville
  Cc: ath9k-devel@lists.ath9k.org, linux-wireless@vger.kernel.org,
	Gabor Juhos

Currently, the 2GHz band is enabled unconditionally, even if the device
does not support it.

Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 drivers/net/wireless/ath/ath9k/main.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index cbf5d2a..c0daef0 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1826,12 +1826,14 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
 
 	/* setup channels and rates */
 
-	sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable;
-	sc->sbands[IEEE80211_BAND_2GHZ].bitrates =
-		sc->rates[IEEE80211_BAND_2GHZ];
-	sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ;
-	sc->sbands[IEEE80211_BAND_2GHZ].n_channels =
-		ARRAY_SIZE(ath9k_2ghz_chantable);
+	if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) {
+		sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable;
+		sc->sbands[IEEE80211_BAND_2GHZ].bitrates =
+			sc->rates[IEEE80211_BAND_2GHZ];
+		sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ;
+		sc->sbands[IEEE80211_BAND_2GHZ].n_channels =
+			ARRAY_SIZE(ath9k_2ghz_chantable);
+	}
 
 	if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) {
 		sc->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_chantable;
@@ -1906,8 +1908,9 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 
 	hw->rate_control_algorithm = "ath9k_rate_control";
 
-	hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
-		&sc->sbands[IEEE80211_BAND_2GHZ];
+	if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes))
+		hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+			&sc->sbands[IEEE80211_BAND_2GHZ];
 	if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes))
 		hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
 			&sc->sbands[IEEE80211_BAND_5GHZ];
@@ -1946,9 +1949,12 @@ int ath_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
 	reg = &common->regulatory;
 
 	if (ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
-		setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
+		if (test_bit(ATH9K_MODE_11G, ah->caps.wireless_modes))
+			setup_ht_cap(sc,
+				     &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
 		if (test_bit(ATH9K_MODE_11A, ah->caps.wireless_modes))
-			setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
+			setup_ht_cap(sc,
+				     &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
 	}
 
 	/* initialize tx/rx engine */
-- 
1.5.3.2


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

* Re: [ath9k-devel] [PATCH] ath9k: enable 2GHz band only if the device supports it
  2009-11-25 20:29 [PATCH] ath9k: enable 2GHz band only if the device supports it Gabor Juhos
@ 2009-11-25 21:38 ` Luis R. Rodriguez
  2009-11-26  0:30   ` Felix Fietkau
  0 siblings, 1 reply; 4+ messages in thread
From: Luis R. Rodriguez @ 2009-11-25 21:38 UTC (permalink / raw)
  To: Gabor Juhos
  Cc: John Linville, ath9k-devel@lists.ath9k.org,
	linux-wireless@vger.kernel.org

On Wed, Nov 25, 2009 at 12:29:15PM -0800, Gabor Juhos wrote:
> Currently, the 2GHz band is enabled unconditionally, even if the device
> does not support it.

This is true, but we don't have any 11n 5 GHz only devices,
The patch is fine too though but it'd be better if you fail
with a proper ath_print ATH_DBG_FATAL message if neither band
has been marked as supported.

  Luis

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

* Re: [ath9k-devel] [PATCH] ath9k: enable 2GHz band only if the device supports it
  2009-11-25 21:38 ` [ath9k-devel] " Luis R. Rodriguez
@ 2009-11-26  0:30   ` Felix Fietkau
  2009-11-26  0:41     ` Luis R. Rodriguez
  0 siblings, 1 reply; 4+ messages in thread
From: Felix Fietkau @ 2009-11-26  0:30 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Gabor Juhos, John Linville, ath9k-devel@lists.ath9k.org,
	linux-wireless@vger.kernel.org

Luis R. Rodriguez wrote:
> On Wed, Nov 25, 2009 at 12:29:15PM -0800, Gabor Juhos wrote:
>> Currently, the 2GHz band is enabled unconditionally, even if the device
>> does not support it.
> 
> This is true, but we don't have any 11n 5 GHz only devices,
> The patch is fine too though but it'd be better if you fail
> with a proper ath_print ATH_DBG_FATAL message if neither band
> has been marked as supported.
We do have some ;)
Ubiquiti Networks has a few Python+Merlin based devices that are 5GHz
only, and we're working on supporting them.

- Felix

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

* Re: [ath9k-devel] [PATCH] ath9k: enable 2GHz band only if the device supports it
  2009-11-26  0:30   ` Felix Fietkau
@ 2009-11-26  0:41     ` Luis R. Rodriguez
  0 siblings, 0 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2009-11-26  0:41 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: Gabor Juhos, John Linville, ath9k-devel@lists.ath9k.org,
	linux-wireless@vger.kernel.org

On Wed, Nov 25, 2009 at 4:30 PM, Felix Fietkau <nbd@openwrt.org> wrote:
> Luis R. Rodriguez wrote:
>> On Wed, Nov 25, 2009 at 12:29:15PM -0800, Gabor Juhos wrote:
>>> Currently, the 2GHz band is enabled unconditionally, even if the device
>>> does not support it.
>>
>> This is true, but we don't have any 11n 5 GHz only devices,
>> The patch is fine too though but it'd be better if you fail
>> with a proper ath_print ATH_DBG_FATAL message if neither band
>> has been marked as supported.
> We do have some ;)
> Ubiquiti Networks has a few Python+Merlin based devices that are 5GHz
> only, and we're working on supporting them.

Sexy!

  Luis

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

end of thread, other threads:[~2009-11-26  0:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 20:29 [PATCH] ath9k: enable 2GHz band only if the device supports it Gabor Juhos
2009-11-25 21:38 ` [ath9k-devel] " Luis R. Rodriguez
2009-11-26  0:30   ` Felix Fietkau
2009-11-26  0:41     ` 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).