Skip to contentSkip to conversation

ath9k: enable 2GHz band only if the device supports it

PATCH Superseded Gabor Juhos 3 participants 4 messages Nov 25, 2009 – Nov 26, 2009 Qualcomm Atheros ATH9K wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k: enable 2GHz band only if the device supports it

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

Changes-licensed-under: ISC

---
 drivers/net/wireless/ath/ath9k/main.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +16 -10
index cbf5d2a..c0daef0 100644
@@ -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 */
Signature · 1 line
1.5.3.2
#1 lore raw

PATCH 1/1 ath9k: enable 2GHz band only if the device supports it

Quoted 2 lines · Gabor Juhos

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

#2 lore raw

PATCH 1/1 ath9k: enable 2GHz band only if the device supports it

Quoted 8 lines · Luis R. Rodriguez
Quoted 2 lines · Gabor Juhos

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

#3 lore raw

PATCH 1/1 ath9k: enable 2GHz band only if the device supports it

Quoted 5 lines · Felix Fietkau
Quoted 4 lines · Luis R. Rodriguez
Quoted 2 lines · Gabor Juhos

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

Quoted 7 lines
Quoted 4 lines

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