All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] ath5k 802.11j preparation and cleanup
@ 2011-01-19  9:20 Bruno Randolf
  2011-01-19  9:20 ` [PATCH 1/8] ath5k: Use mac80211 channel mapping function Bruno Randolf
                   ` (8 more replies)
  0 siblings, 9 replies; 27+ messages in thread
From: Bruno Randolf @ 2011-01-19  9:20 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

This series prepares ath5k for 802.11j (4.9GHz) support but most of the patches
are just cleaning up things i found in the process. 802.11j is still not
enabled.

bruno

---

Bruno Randolf (8):
      ath5k: Use mac80211 channel mapping function
      ath5k: Simplify loop when setting up channels
      ath5k: Rename ath5k_copy_channels
      ath5k: ath5k_setup_channels cleanup and whitespace
      ath5k: Add 802.11j 4.9GHz channels to allowed channels
      ath5: Remove unused CTL definitions
      ath5k: Remove unused sc->curmode
      ath5k: Remove redundant sc->curband


 drivers/net/wireless/ath/ath5k/base.c   |   95 +++++++++++--------------------
 drivers/net/wireless/ath/ath5k/base.h   |    3 -
 drivers/net/wireless/ath/ath5k/eeprom.h |   23 --------
 3 files changed, 34 insertions(+), 87 deletions(-)

-- 
Signature

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

* [PATCH 1/8] ath5k: Use mac80211 channel mapping function
  2011-01-19  9:20 [PATCH 0/8] ath5k 802.11j preparation and cleanup Bruno Randolf
@ 2011-01-19  9:20 ` Bruno Randolf
  2011-01-19 15:39   ` Bob Copeland
  2011-01-19  9:20 ` [PATCH 2/8] ath5k: Simplify loop when setting up channels Bruno Randolf
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 27+ messages in thread
From: Bruno Randolf @ 2011-01-19  9:20 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

Use mac80211 channel mapping function instead of own homegrown version.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/base.c |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 09ae4ef..6850112 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -242,18 +242,6 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re
 \********************/
 
 /*
- * Convert IEEE channel number to MHz frequency.
- */
-static inline short
-ath5k_ieee2mhz(short chan)
-{
-	if (chan <= 14 || chan >= 27)
-		return ieee80211chan2mhz(chan);
-	else
-		return 2212 + chan * 20;
-}
-
-/*
  * Returns true for the channel numbers used without all_channels modparam.
  */
 static bool ath5k_is_standard_channel(short chan)
@@ -274,6 +262,7 @@ ath5k_copy_channels(struct ath5k_hw *ah,
 		unsigned int max)
 {
 	unsigned int i, count, size, chfreq, freq, ch;
+	enum ieee80211_band band;
 
 	if (!test_bit(mode, ah->ah_modes))
 		return 0;
@@ -283,11 +272,13 @@ ath5k_copy_channels(struct ath5k_hw *ah,
 		/* 1..220, but 2GHz frequencies are filtered by check_channel */
 		size = 220 ;
 		chfreq = CHANNEL_5GHZ;
+		band = IEEE80211_BAND_5GHZ;
 		break;
 	case AR5K_MODE_11B:
 	case AR5K_MODE_11G:
 		size = 26;
 		chfreq = CHANNEL_2GHZ;
+		band = IEEE80211_BAND_2GHZ;
 		break;
 	default:
 		ATH5K_WARN(ah->ah_sc, "bad mode, not copying channels\n");
@@ -296,7 +287,10 @@ ath5k_copy_channels(struct ath5k_hw *ah,
 
 	for (i = 0, count = 0; i < size && max > 0; i++) {
 		ch = i + 1 ;
-		freq = ath5k_ieee2mhz(ch);
+		freq = ieee80211_channel_to_frequency(ch, band);
+
+		if (freq == 0) /* mapping failed - not a standard channel */
+			continue;
 
 		/* Check if channel is supported by the chipset */
 		if (!ath5k_channel_ok(ah, freq, chfreq))
@@ -307,8 +301,7 @@ ath5k_copy_channels(struct ath5k_hw *ah,
 
 		/* Write channel info and increment counter */
 		channels[count].center_freq = freq;
-		channels[count].band = (chfreq == CHANNEL_2GHZ) ?
-			IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+		channels[count].band = band;
 		switch (mode) {
 		case AR5K_MODE_11A:
 		case AR5K_MODE_11G:


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

* [PATCH 2/8] ath5k: Simplify loop when setting up channels
  2011-01-19  9:20 [PATCH 0/8] ath5k 802.11j preparation and cleanup Bruno Randolf
  2011-01-19  9:20 ` [PATCH 1/8] ath5k: Use mac80211 channel mapping function Bruno Randolf
@ 2011-01-19  9:20 ` Bruno Randolf
  2011-01-19 11:07   ` Bob Copeland
  2011-01-19  9:20 ` [PATCH 3/8] ath5k: Rename ath5k_copy_channels Bruno Randolf
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 27+ messages in thread
From: Bruno Randolf @ 2011-01-19  9:20 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

Simplify confusing code and get rid of an unnecessary variable.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/base.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 6850112..0387acb 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -261,7 +261,7 @@ ath5k_copy_channels(struct ath5k_hw *ah,
 		unsigned int mode,
 		unsigned int max)
 {
-	unsigned int i, count, size, chfreq, freq, ch;
+	unsigned int count, size, chfreq, freq, ch;
 	enum ieee80211_band band;
 
 	if (!test_bit(mode, ah->ah_modes))
@@ -285,8 +285,8 @@ ath5k_copy_channels(struct ath5k_hw *ah,
 		return 0;
 	}
 
-	for (i = 0, count = 0; i < size && max > 0; i++) {
-		ch = i + 1 ;
+	count = 0;
+	for (ch = 1; ch < size && count <= max; ch++) {
 		freq = ieee80211_channel_to_frequency(ch, band);
 
 		if (freq == 0) /* mapping failed - not a standard channel */
@@ -312,7 +312,6 @@ ath5k_copy_channels(struct ath5k_hw *ah,
 		}
 
 		count++;
-		max--;
 	}
 
 	return count;


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

* [PATCH 3/8] ath5k: Rename ath5k_copy_channels
  2011-01-19  9:20 [PATCH 0/8] ath5k 802.11j preparation and cleanup Bruno Randolf
  2011-01-19  9:20 ` [PATCH 1/8] ath5k: Use mac80211 channel mapping function Bruno Randolf
  2011-01-19  9:20 ` [PATCH 2/8] ath5k: Simplify loop when setting up channels Bruno Randolf
@ 2011-01-19  9:20 ` Bruno Randolf
  2011-01-19 11:08   ` Bob Copeland
  2011-01-19 15:54   ` Nick Kossifidis
  2011-01-19  9:20 ` [PATCH 4/8] ath5k: ath5k_setup_channels cleanup and whitespace Bruno Randolf
                   ` (5 subsequent siblings)
  8 siblings, 2 replies; 27+ messages in thread
From: Bruno Randolf @ 2011-01-19  9:20 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

Rename ath5k_copy_channels() to ath5k_setup_channels() - nothing is copied
here.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/base.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 0387acb..9e8b1f4 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -256,7 +256,7 @@ static bool ath5k_is_standard_channel(short chan)
 }
 
 static unsigned int
-ath5k_copy_channels(struct ath5k_hw *ah,
+ath5k_setup_channels(struct ath5k_hw *ah,
 		struct ieee80211_channel *channels,
 		unsigned int mode,
 		unsigned int max)
@@ -356,7 +356,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
 		sband->n_bitrates = 12;
 
 		sband->channels = sc->channels;
-		sband->n_channels = ath5k_copy_channels(ah, sband->channels,
+		sband->n_channels = ath5k_setup_channels(ah, sband->channels,
 					AR5K_MODE_11G, max_c);
 
 		hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
@@ -382,7 +382,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
 		}
 
 		sband->channels = sc->channels;
-		sband->n_channels = ath5k_copy_channels(ah, sband->channels,
+		sband->n_channels = ath5k_setup_channels(ah, sband->channels,
 					AR5K_MODE_11B, max_c);
 
 		hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
@@ -402,7 +402,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
 		sband->n_bitrates = 8;
 
 		sband->channels = &sc->channels[count_c];
-		sband->n_channels = ath5k_copy_channels(ah, sband->channels,
+		sband->n_channels = ath5k_setup_channels(ah, sband->channels,
 					AR5K_MODE_11A, max_c);
 
 		hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband;


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

* [PATCH 4/8] ath5k: ath5k_setup_channels cleanup and whitespace
  2011-01-19  9:20 [PATCH 0/8] ath5k 802.11j preparation and cleanup Bruno Randolf
                   ` (2 preceding siblings ...)
  2011-01-19  9:20 ` [PATCH 3/8] ath5k: Rename ath5k_copy_channels Bruno Randolf
@ 2011-01-19  9:20 ` Bruno Randolf
  2011-01-19 11:09   ` Bob Copeland
  2011-01-19 15:57   ` Nick Kossifidis
  2011-01-19  9:20 ` [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels Bruno Randolf
                   ` (4 subsequent siblings)
  8 siblings, 2 replies; 27+ messages in thread
From: Bruno Randolf @ 2011-01-19  9:20 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

Remove useless test_bit - it's not going to happen because of the way this
function is called only when that bit is set.

And fix some whitespace.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/base.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 9e8b1f4..a28ad58 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -256,21 +256,16 @@ static bool ath5k_is_standard_channel(short chan)
 }
 
 static unsigned int
-ath5k_setup_channels(struct ath5k_hw *ah,
-		struct ieee80211_channel *channels,
-		unsigned int mode,
-		unsigned int max)
+ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels,
+		unsigned int mode, unsigned int max)
 {
 	unsigned int count, size, chfreq, freq, ch;
 	enum ieee80211_band band;
 
-	if (!test_bit(mode, ah->ah_modes))
-		return 0;
-
 	switch (mode) {
 	case AR5K_MODE_11A:
 		/* 1..220, but 2GHz frequencies are filtered by check_channel */
-		size = 220 ;
+		size = 220;
 		chfreq = CHANNEL_5GHZ;
 		band = IEEE80211_BAND_5GHZ;
 		break;


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

* [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels
  2011-01-19  9:20 [PATCH 0/8] ath5k 802.11j preparation and cleanup Bruno Randolf
                   ` (3 preceding siblings ...)
  2011-01-19  9:20 ` [PATCH 4/8] ath5k: ath5k_setup_channels cleanup and whitespace Bruno Randolf
@ 2011-01-19  9:20 ` Bruno Randolf
  2011-01-19 11:14   ` Bob Copeland
  2011-01-19 15:55   ` Nick Kossifidis
  2011-01-19  9:21 ` [PATCH 6/8] ath5: Remove unused CTL definitions Bruno Randolf
                   ` (3 subsequent siblings)
  8 siblings, 2 replies; 27+ messages in thread
From: Bruno Randolf @ 2011-01-19  9:20 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

Add the 802.11j (20MHz channel width) channels to the allowed channels. This
still does not enable 802.11j in ath5k since these frequencies are out of the
configured range. A later patch will deal with that.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/base.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index a28ad58..6900543 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -244,15 +244,21 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re
 /*
  * Returns true for the channel numbers used without all_channels modparam.
  */
-static bool ath5k_is_standard_channel(short chan)
+static bool ath5k_is_standard_channel(short chan, enum ieee80211_band band)
 {
-	return ((chan <= 14) ||
-		/* UNII 1,2 */
-		((chan & 3) == 0 && chan >= 36 && chan <= 64) ||
+	if (band == IEEE80211_BAND_2GHZ && chan <= 14)
+		return true;
+
+	return	/* UNII 1,2 */
+		(((chan & 3) == 0 && chan >= 36 && chan <= 64) ||
 		/* midband */
 		((chan & 3) == 0 && chan >= 100 && chan <= 140) ||
 		/* UNII-3 */
-		((chan & 3) == 1 && chan >= 149 && chan <= 165));
+		((chan & 3) == 1 && chan >= 149 && chan <= 165) ||
+		/* 802.11j 5.030-5.080 GHz (20MHz) */
+		(chan == 8 || chan == 12 || chan == 16) ||
+		/* 802.11j 4.9GHz (20MHz) */
+		(chan == 184 || chan == 188 || chan == 192 || chan == 196));
 }
 
 static unsigned int
@@ -291,7 +297,8 @@ ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels,
 		if (!ath5k_channel_ok(ah, freq, chfreq))
 			continue;
 
-		if (!modparam_all_channels && !ath5k_is_standard_channel(ch))
+		if (!modparam_all_channels &&
+		    !ath5k_is_standard_channel(ch, band))
 			continue;
 
 		/* Write channel info and increment counter */


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

* [PATCH 6/8] ath5: Remove unused CTL definitions
  2011-01-19  9:20 [PATCH 0/8] ath5k 802.11j preparation and cleanup Bruno Randolf
                   ` (4 preceding siblings ...)
  2011-01-19  9:20 ` [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels Bruno Randolf
@ 2011-01-19  9:21 ` Bruno Randolf
  2011-01-19 11:15   ` Bob Copeland
  2011-01-19 15:55   ` Nick Kossifidis
  2011-01-19  9:21 ` [PATCH 7/8] ath5k: Remove unused sc->curmode Bruno Randolf
                   ` (2 subsequent siblings)
  8 siblings, 2 replies; 27+ messages in thread
From: Bruno Randolf @ 2011-01-19  9:21 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

They are unused in ath5k and a more detailled definition is in
ath/regd_common.h.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/eeprom.h |   23 -----------------------
 1 files changed, 0 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/eeprom.h b/drivers/net/wireless/ath/ath5k/eeprom.h
index d46f105..6511c27 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.h
+++ b/drivers/net/wireless/ath/ath5k/eeprom.h
@@ -268,29 +268,6 @@ enum ath5k_ctl_mode {
 	AR5K_CTL_MODE_M = 15,
 };
 
-/* Default CTL ids for the 3 main reg domains.
- * Atheros only uses these by default but vendors
- * can have up to 32 different CTLs for different
- * scenarios. Note that theese values are ORed with
- * the mode id (above) so we can have up to 24 CTL
- * datasets out of these 3 main regdomains. That leaves
- * 8 ids that can be used by vendors and since 0x20 is
- * missing from HAL sources i guess this is the set of
- * custom CTLs vendors can use. */
-#define	AR5K_CTL_FCC	0x10
-#define	AR5K_CTL_CUSTOM	0x20
-#define	AR5K_CTL_ETSI	0x30
-#define	AR5K_CTL_MKK	0x40
-
-/* Indicates a CTL with only mode set and
- * no reg domain mapping, such CTLs are used
- * for world roaming domains or simply when
- * a reg domain is not set */
-#define	AR5K_CTL_NO_REGDOMAIN	0xf0
-
-/* Indicates an empty (invalid) CTL */
-#define AR5K_CTL_NO_CTL		0xff
-
 /* Per channel calibration data, used for power table setup */
 struct ath5k_chan_pcal_info_rf5111 {
 	/* Power levels in half dbm units


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

* [PATCH 7/8] ath5k: Remove unused sc->curmode
  2011-01-19  9:20 [PATCH 0/8] ath5k 802.11j preparation and cleanup Bruno Randolf
                   ` (5 preceding siblings ...)
  2011-01-19  9:21 ` [PATCH 6/8] ath5: Remove unused CTL definitions Bruno Randolf
@ 2011-01-19  9:21 ` Bruno Randolf
  2011-01-19 11:17   ` Bob Copeland
  2011-01-19 15:56   ` Nick Kossifidis
  2011-01-19  9:21 ` [PATCH 8/8] ath5k: Remove redundant sc->curband Bruno Randolf
  2011-01-19 15:58 ` [PATCH 0/8] ath5k 802.11j preparation and cleanup Nick Kossifidis
  8 siblings, 2 replies; 27+ messages in thread
From: Bruno Randolf @ 2011-01-19  9:21 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

sc->curmode is set but never used. Remove it and the helper function. Also the
ath5k_rate_update which is refered to in the comment does not exist (any more?)
so we don't need to setup the band in that place.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/base.c |   18 ------------------
 drivers/net/wireless/ath/ath5k/base.h |    1 -
 2 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 6900543..a00cc11 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -439,18 +439,6 @@ ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)
 	return ath5k_reset(sc, chan, true);
 }
 
-static void
-ath5k_setcurmode(struct ath5k_softc *sc, unsigned int mode)
-{
-	sc->curmode = mode;
-
-	if (mode == AR5K_MODE_11A) {
-		sc->curband = &sc->sbands[IEEE80211_BAND_5GHZ];
-	} else {
-		sc->curband = &sc->sbands[IEEE80211_BAND_2GHZ];
-	}
-}
-
 struct ath_vif_iter_data {
 	const u8	*hw_macaddr;
 	u8		mask[ETH_ALEN];
@@ -2776,12 +2764,6 @@ ath5k_init(struct ieee80211_hw *hw)
 		goto err;
 	}
 
-	/* NB: setup here so ath5k_rate_update is happy */
-	if (test_bit(AR5K_MODE_11A, ah->ah_modes))
-		ath5k_setcurmode(sc, AR5K_MODE_11A);
-	else
-		ath5k_setcurmode(sc, AR5K_MODE_11B);
-
 	/*
 	 * Allocate tx+rx descriptors and populate the lists.
 	 */
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
index 6d51147..58660e4 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -202,7 +202,6 @@ struct ath5k_softc {
 #define ATH_STAT_STARTED	4		/* opened & irqs enabled */
 
 	unsigned int		filter_flags;	/* HW flags, AR5K_RX_FILTER_* */
-	unsigned int		curmode;	/* current phy mode */
 	struct ieee80211_channel *curchan;	/* current h/w channel */
 
 	u16			nvifs;


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

* [PATCH 8/8] ath5k: Remove redundant sc->curband
  2011-01-19  9:20 [PATCH 0/8] ath5k 802.11j preparation and cleanup Bruno Randolf
                   ` (6 preceding siblings ...)
  2011-01-19  9:21 ` [PATCH 7/8] ath5k: Remove unused sc->curmode Bruno Randolf
@ 2011-01-19  9:21 ` Bruno Randolf
  2011-01-19 11:19   ` Bob Copeland
  2011-01-19 15:57   ` Nick Kossifidis
  2011-01-19 15:58 ` [PATCH 0/8] ath5k 802.11j preparation and cleanup Nick Kossifidis
  8 siblings, 2 replies; 27+ messages in thread
From: Bruno Randolf @ 2011-01-19  9:21 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

Remove sc->curband because the band is already stored in the current channel.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 drivers/net/wireless/ath/ath5k/base.c |   11 ++++-------
 drivers/net/wireless/ath/ath5k/base.h |    2 --
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index a00cc11..0e39ee8 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -551,7 +551,7 @@ ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix)
 			"hw_rix out of bounds: %x\n", hw_rix))
 		return 0;
 
-	rix = sc->rate_idx[sc->curband->band][hw_rix];
+	rix = sc->rate_idx[sc->curchan->band][hw_rix];
 	if (WARN(rix < 0, "invalid hw_rix: %x\n", hw_rix))
 		rix = 0;
 
@@ -1361,7 +1361,7 @@ ath5k_receive_frame(struct ath5k_softc *sc, struct sk_buff *skb,
 	rxs->flag |= RX_FLAG_TSFT;
 
 	rxs->freq = sc->curchan->center_freq;
-	rxs->band = sc->curband->band;
+	rxs->band = sc->curchan->band;
 
 	rxs->signal = sc->ah->ah_noise_floor + rs->rs_rssi;
 
@@ -1376,7 +1376,7 @@ ath5k_receive_frame(struct ath5k_softc *sc, struct sk_buff *skb,
 	rxs->flag |= ath5k_rx_decrypted(sc, skb, rs);
 
 	if (rxs->rate_idx >= 0 && rs->rs_rate ==
-	    sc->curband->bitrates[rxs->rate_idx].hw_value_short)
+	    sc->sbands[sc->curchan->band].bitrates[rxs->rate_idx].hw_value_short)
 		rxs->flag |= RX_FLAG_SHORTPRE;
 
 	ath5k_debug_dump_skb(sc, skb, "RX  ", 0);
@@ -2536,7 +2536,6 @@ ath5k_init_hw(struct ath5k_softc *sc)
 	 * and then setup of the interrupt mask.
 	 */
 	sc->curchan = sc->hw->conf.channel;
-	sc->curband = &sc->sbands[sc->curchan->band];
 	sc->imask = AR5K_INT_RXOK | AR5K_INT_RXERR | AR5K_INT_RXEOL |
 		AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL |
 		AR5K_INT_FATAL | AR5K_INT_GLOBAL | AR5K_INT_MIB;
@@ -2663,10 +2662,8 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
 	 * so we should also free any remaining
 	 * tx buffers */
 	ath5k_drain_tx_buffs(sc);
-	if (chan) {
+	if (chan)
 		sc->curchan = chan;
-		sc->curband = &sc->sbands[chan->band];
-	}
 	ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL,
 								skip_pcu);
 	if (ret) {
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
index 58660e4..8f919dc 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -183,8 +183,6 @@ struct ath5k_softc {
 	enum nl80211_iftype	opmode;
 	struct ath5k_hw		*ah;		/* Atheros HW */
 
-	struct ieee80211_supported_band		*curband;
-
 #ifdef CONFIG_ATH5K_DEBUG
 	struct ath5k_dbg_info	debug;		/* debug info */
 #endif /* CONFIG_ATH5K_DEBUG */


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

* Re: [PATCH 2/8] ath5k: Simplify loop when setting up channels
  2011-01-19  9:20 ` [PATCH 2/8] ath5k: Simplify loop when setting up channels Bruno Randolf
@ 2011-01-19 11:07   ` Bob Copeland
  2011-01-19 11:51     ` Bruno Randolf
  0 siblings, 1 reply; 27+ messages in thread
From: Bob Copeland @ 2011-01-19 11:07 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

On Wed, Jan 19, 2011 at 4:20 AM, Bruno Randolf <br1@einfach.org> wrote:
> Simplify confusing code and get rid of an unnecessary variable.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>


> @@ -285,8 +285,8 @@ ath5k_copy_channels(struct ath5k_hw *ah,
>                return 0;
>        }
>
> -       for (i = 0, count = 0; i < size && max > 0; i++) {
> -               ch = i + 1 ;
> +       count = 0;
> +       for (ch = 1; ch < size && count <= max; ch++) {

Should be <= size now, right?  And maybe rename size to max_channel
or something like that.

-- 
Bob Copeland %% www.bobcopeland.com

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

* Re: [PATCH 3/8] ath5k: Rename ath5k_copy_channels
  2011-01-19  9:20 ` [PATCH 3/8] ath5k: Rename ath5k_copy_channels Bruno Randolf
@ 2011-01-19 11:08   ` Bob Copeland
  2011-01-19 15:54   ` Nick Kossifidis
  1 sibling, 0 replies; 27+ messages in thread
From: Bob Copeland @ 2011-01-19 11:08 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

On Wed, Jan 19, 2011 at 4:20 AM, Bruno Randolf <br1@einfach.org> wrote:
> Rename ath5k_copy_channels() to ath5k_setup_channels() - nothing is copied
> here.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>
> ---
>  drivers/net/wireless/ath/ath5k/base.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index 0387acb..9e8b1f4 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -256,7 +256,7 @@ static bool ath5k_is_standard_channel(short chan)
>  }
>
>  static unsigned int
> -ath5k_copy_channels(struct ath5k_hw *ah,
> +ath5k_setup_channels(struct ath5k_hw *ah,
>                struct ieee80211_channel *channels,
>                unsigned int mode,
>                unsigned int max)
> @@ -356,7 +356,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
>                sband->n_bitrates = 12;
>
>                sband->channels = sc->channels;
> -               sband->n_channels = ath5k_copy_channels(ah, sband->channels,
> +               sband->n_channels = ath5k_setup_channels(ah, sband->channels,
>                                        AR5K_MODE_11G, max_c);
>
>                hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
> @@ -382,7 +382,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
>                }
>
>                sband->channels = sc->channels;
> -               sband->n_channels = ath5k_copy_channels(ah, sband->channels,
> +               sband->n_channels = ath5k_setup_channels(ah, sband->channels,
>                                        AR5K_MODE_11B, max_c);
>
>                hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
> @@ -402,7 +402,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
>                sband->n_bitrates = 8;
>
>                sband->channels = &sc->channels[count_c];
> -               sband->n_channels = ath5k_copy_channels(ah, sband->channels,
> +               sband->n_channels = ath5k_setup_channels(ah, sband->channels,
>                                        AR5K_MODE_11A, max_c);
>
>                hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband;
>

Acked-by: Bob Copeland <me@bobcopeland.com>

-- 
Bob Copeland %% www.bobcopeland.com

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

* Re: [PATCH 4/8] ath5k: ath5k_setup_channels cleanup and whitespace
  2011-01-19  9:20 ` [PATCH 4/8] ath5k: ath5k_setup_channels cleanup and whitespace Bruno Randolf
@ 2011-01-19 11:09   ` Bob Copeland
  2011-01-19 15:57   ` Nick Kossifidis
  1 sibling, 0 replies; 27+ messages in thread
From: Bob Copeland @ 2011-01-19 11:09 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

On Wed, Jan 19, 2011 at 4:20 AM, Bruno Randolf <br1@einfach.org> wrote:
> Remove useless test_bit - it's not going to happen because of the way this
> function is called only when that bit is set.
>
> And fix some whitespace.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>

Acked-by: Bob Copeland <me@bobcopeland.com>

-- 
Bob Copeland %% www.bobcopeland.com

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

* Re: [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels
  2011-01-19  9:20 ` [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels Bruno Randolf
@ 2011-01-19 11:14   ` Bob Copeland
  2011-01-19 11:52     ` Bruno Randolf
  2011-01-19 15:55   ` Nick Kossifidis
  1 sibling, 1 reply; 27+ messages in thread
From: Bob Copeland @ 2011-01-19 11:14 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

On Wed, Jan 19, 2011 at 4:20 AM, Bruno Randolf <br1@einfach.org> wrote:
> Add the 802.11j (20MHz channel width) channels to the allowed channels. This
> still does not enable 802.11j in ath5k since these frequencies are out of the
> configured range. A later patch will deal with that.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>
> ---

> -static bool ath5k_is_standard_channel(short chan)
> +static bool ath5k_is_standard_channel(short chan, enum ieee80211_band band)
>  {
> -       return ((chan <= 14) ||
> -               /* UNII 1,2 */
> -               ((chan & 3) == 0 && chan >= 36 && chan <= 64) ||
> +       if (band == IEEE80211_BAND_2GHZ && chan <= 14)
> +               return true;

This routine is only used to post-filter the channels so I don't
think we need to check the band.  It's mostly just to weed out all
of the 10 mhz-spaced 5 ghz channels we used to export.

> -               ((chan & 3) == 1 && chan >= 149 && chan <= 165));
> +               ((chan & 3) == 1 && chan >= 149 && chan <= 165) ||
> +               /* 802.11j 5.030-5.080 GHz (20MHz) */
> +               (chan == 8 || chan == 12 || chan == 16) ||

Ok I was also going to complain that some channel numbers < 14 were
valid in the 5 ghz band but you know that :)

-- 
Bob Copeland %% www.bobcopeland.com

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

* Re: [PATCH 6/8] ath5: Remove unused CTL definitions
  2011-01-19  9:21 ` [PATCH 6/8] ath5: Remove unused CTL definitions Bruno Randolf
@ 2011-01-19 11:15   ` Bob Copeland
  2011-01-19 15:55   ` Nick Kossifidis
  1 sibling, 0 replies; 27+ messages in thread
From: Bob Copeland @ 2011-01-19 11:15 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

On Wed, Jan 19, 2011 at 4:21 AM, Bruno Randolf <br1@einfach.org> wrote:
> They are unused in ath5k and a more detailled definition is in
> ath/regd_common.h.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>

Acked-by: Bob Copeland <me@bobcopeland.com>

-- 
Bob Copeland %% www.bobcopeland.com

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

* Re: [PATCH 7/8] ath5k: Remove unused sc->curmode
  2011-01-19  9:21 ` [PATCH 7/8] ath5k: Remove unused sc->curmode Bruno Randolf
@ 2011-01-19 11:17   ` Bob Copeland
  2011-01-19 15:56   ` Nick Kossifidis
  1 sibling, 0 replies; 27+ messages in thread
From: Bob Copeland @ 2011-01-19 11:17 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

On Wed, Jan 19, 2011 at 4:21 AM, Bruno Randolf <br1@einfach.org> wrote:
> sc->curmode is set but never used. Remove it and the helper function. Also the
> ath5k_rate_update which is refered to in the comment does not exist (any more?)
> so we don't need to setup the band in that place.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>

Acked-by: Bob Copeland <me@bobcopeland.com>

-- 
Bob Copeland %% www.bobcopeland.com

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

* Re: [PATCH 8/8] ath5k: Remove redundant sc->curband
  2011-01-19  9:21 ` [PATCH 8/8] ath5k: Remove redundant sc->curband Bruno Randolf
@ 2011-01-19 11:19   ` Bob Copeland
  2011-01-19 15:57   ` Nick Kossifidis
  1 sibling, 0 replies; 27+ messages in thread
From: Bob Copeland @ 2011-01-19 11:19 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

On Wed, Jan 19, 2011 at 4:21 AM, Bruno Randolf <br1@einfach.org> wrote:
> Remove sc->curband because the band is already stored in the current channel.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>

Nice cleanup series!

Acked-by: Bob Copeland <me@bobcopeland.com>

-- 
Bob Copeland %% www.bobcopeland.com

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

* Re: [PATCH 2/8] ath5k: Simplify loop when setting up channels
  2011-01-19 11:07   ` Bob Copeland
@ 2011-01-19 11:51     ` Bruno Randolf
  0 siblings, 0 replies; 27+ messages in thread
From: Bruno Randolf @ 2011-01-19 11:51 UTC (permalink / raw)
  To: Bob Copeland; +Cc: linville, linux-wireless

On Wed January 19 2011 20:07:28 you wrote:
> On Wed, Jan 19, 2011 at 4:20 AM, Bruno Randolf <br1@einfach.org> wrote:
> > Simplify confusing code and get rid of an unnecessary variable.
> > 
> > Signed-off-by: Bruno Randolf <br1@einfach.org>
> > 
> > 
> > @@ -285,8 +285,8 @@ ath5k_copy_channels(struct ath5k_hw *ah,
> >                return 0;
> >        }
> > 
> > -       for (i = 0, count = 0; i < size && max > 0; i++) {
> > -               ch = i + 1 ;
> > +       count = 0;
> > +       for (ch = 1; ch < size && count <= max; ch++) {
> 
> Should be <= size now, right?  And maybe rename size to max_channel
> or something like that.

Oh, yeah. Will fix.

bruno

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

* Re: [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels
  2011-01-19 11:14   ` Bob Copeland
@ 2011-01-19 11:52     ` Bruno Randolf
  2011-01-19 15:18       ` Bob Copeland
  0 siblings, 1 reply; 27+ messages in thread
From: Bruno Randolf @ 2011-01-19 11:52 UTC (permalink / raw)
  To: Bob Copeland; +Cc: linville, linux-wireless

On Wed January 19 2011 20:14:41 Bob Copeland wrote:
> On Wed, Jan 19, 2011 at 4:20 AM, Bruno Randolf <br1@einfach.org> wrote:
> > Add the 802.11j (20MHz channel width) channels to the allowed channels.
> > This still does not enable 802.11j in ath5k since these frequencies are
> > out of the configured range. A later patch will deal with that.
> > 
> > Signed-off-by: Bruno Randolf <br1@einfach.org>
> > ---
> > 
> > -static bool ath5k_is_standard_channel(short chan)
> > +static bool ath5k_is_standard_channel(short chan, enum ieee80211_band
> > band) {
> > -       return ((chan <= 14) ||
> > -               /* UNII 1,2 */
> > -               ((chan & 3) == 0 && chan >= 36 && chan <= 64) ||
> > +       if (band == IEEE80211_BAND_2GHZ && chan <= 14)
> > +               return true;
> 
> This routine is only used to post-filter the channels so I don't
> think we need to check the band.  It's mostly just to weed out all
> of the 10 mhz-spaced 5 ghz channels we used to export.
> 
> > -               ((chan & 3) == 1 && chan >= 149 && chan <= 165));
> > +               ((chan & 3) == 1 && chan >= 149 && chan <= 165) ||
> > +               /* 802.11j 5.030-5.080 GHz (20MHz) */
> > +               (chan == 8 || chan == 12 || chan == 16) ||
> 
> Ok I was also going to complain that some channel numbers < 14 were
> valid in the 5 ghz band but you know that :)

That's also the reason why we need to know the band:

in 2GHz all channels < 14 are allowed.
in 5GHz only a few.

Thanks for your review!

bruno

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

* Re: [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels
  2011-01-19 11:52     ` Bruno Randolf
@ 2011-01-19 15:18       ` Bob Copeland
  0 siblings, 0 replies; 27+ messages in thread
From: Bob Copeland @ 2011-01-19 15:18 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

On Wed, Jan 19, 2011 at 6:52 AM, Bruno Randolf <br1@einfach.org> >
That's also the reason why we need to know the band:
>
> in 2GHz all channels < 14 are allowed.
> in 5GHz only a few.
>
> Thanks for your review!

Oh, I get it now, yes, that makes sense :)

Acked-by: Bob Copeland <me@bobcopeland.com>

-- 
Bob Copeland %% www.bobcopeland.com

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

* Re: [PATCH 1/8] ath5k: Use mac80211 channel mapping function
  2011-01-19  9:20 ` [PATCH 1/8] ath5k: Use mac80211 channel mapping function Bruno Randolf
@ 2011-01-19 15:39   ` Bob Copeland
  0 siblings, 0 replies; 27+ messages in thread
From: Bob Copeland @ 2011-01-19 15:39 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

On Wed, Jan 19, 2011 at 4:20 AM, Bruno Randolf <br1@einfach.org> wrote:
> Use mac80211 channel mapping function instead of own homegrown version.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>
> ---
>  drivers/net/wireless/ath/ath5k/base.c |   23 ++++++++---------------
>  1 files changed, 8 insertions(+), 15 deletions(-)

Acked-by: Bob Copeland <me@bobcopeland.com>

-- 
Bob Copeland %% www.bobcopeland.com

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

* Re: [PATCH 3/8] ath5k: Rename ath5k_copy_channels
  2011-01-19  9:20 ` [PATCH 3/8] ath5k: Rename ath5k_copy_channels Bruno Randolf
  2011-01-19 11:08   ` Bob Copeland
@ 2011-01-19 15:54   ` Nick Kossifidis
  1 sibling, 0 replies; 27+ messages in thread
From: Nick Kossifidis @ 2011-01-19 15:54 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

2011/1/19 Bruno Randolf <br1@einfach.org>:
> Rename ath5k_copy_channels() to ath5k_setup_channels() - nothing is copied
> here.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>
> ---
>  drivers/net/wireless/ath/ath5k/base.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index 0387acb..9e8b1f4 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -256,7 +256,7 @@ static bool ath5k_is_standard_channel(short chan)
>  }
>
>  static unsigned int
> -ath5k_copy_channels(struct ath5k_hw *ah,
> +ath5k_setup_channels(struct ath5k_hw *ah,
>                struct ieee80211_channel *channels,
>                unsigned int mode,
>                unsigned int max)
> @@ -356,7 +356,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
>                sband->n_bitrates = 12;
>
>                sband->channels = sc->channels;
> -               sband->n_channels = ath5k_copy_channels(ah, sband->channels,
> +               sband->n_channels = ath5k_setup_channels(ah, sband->channels,
>                                        AR5K_MODE_11G, max_c);
>
>                hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
> @@ -382,7 +382,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
>                }
>
>                sband->channels = sc->channels;
> -               sband->n_channels = ath5k_copy_channels(ah, sband->channels,
> +               sband->n_channels = ath5k_setup_channels(ah, sband->channels,
>                                        AR5K_MODE_11B, max_c);
>
>                hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
> @@ -402,7 +402,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
>                sband->n_bitrates = 8;
>
>                sband->channels = &sc->channels[count_c];
> -               sband->n_channels = ath5k_copy_channels(ah, sband->channels,
> +               sband->n_channels = ath5k_setup_channels(ah, sband->channels,
>                                        AR5K_MODE_11A, max_c);
>
>                hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband;
>


Acked-by: Nick Kossifidis <mickflemm@gmail.com>


-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

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

* Re: [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels
  2011-01-19  9:20 ` [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels Bruno Randolf
  2011-01-19 11:14   ` Bob Copeland
@ 2011-01-19 15:55   ` Nick Kossifidis
  1 sibling, 0 replies; 27+ messages in thread
From: Nick Kossifidis @ 2011-01-19 15:55 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

2011/1/19 Bruno Randolf <br1@einfach.org>:
> Add the 802.11j (20MHz channel width) channels to the allowed channels. This
> still does not enable 802.11j in ath5k since these frequencies are out of the
> configured range. A later patch will deal with that.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>
> ---
>  drivers/net/wireless/ath/ath5k/base.c |   19 +++++++++++++------
>  1 files changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index a28ad58..6900543 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -244,15 +244,21 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re
>  /*
>  * Returns true for the channel numbers used without all_channels modparam.
>  */
> -static bool ath5k_is_standard_channel(short chan)
> +static bool ath5k_is_standard_channel(short chan, enum ieee80211_band band)
>  {
> -       return ((chan <= 14) ||
> -               /* UNII 1,2 */
> -               ((chan & 3) == 0 && chan >= 36 && chan <= 64) ||
> +       if (band == IEEE80211_BAND_2GHZ && chan <= 14)
> +               return true;
> +
> +       return  /* UNII 1,2 */
> +               (((chan & 3) == 0 && chan >= 36 && chan <= 64) ||
>                /* midband */
>                ((chan & 3) == 0 && chan >= 100 && chan <= 140) ||
>                /* UNII-3 */
> -               ((chan & 3) == 1 && chan >= 149 && chan <= 165));
> +               ((chan & 3) == 1 && chan >= 149 && chan <= 165) ||
> +               /* 802.11j 5.030-5.080 GHz (20MHz) */
> +               (chan == 8 || chan == 12 || chan == 16) ||
> +               /* 802.11j 4.9GHz (20MHz) */
> +               (chan == 184 || chan == 188 || chan == 192 || chan == 196));
>  }
>
>  static unsigned int
> @@ -291,7 +297,8 @@ ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels,
>                if (!ath5k_channel_ok(ah, freq, chfreq))
>                        continue;
>
> -               if (!modparam_all_channels && !ath5k_is_standard_channel(ch))
> +               if (!modparam_all_channels &&
> +                   !ath5k_is_standard_channel(ch, band))
>                        continue;
>
>                /* Write channel info and increment counter */
>


Acked-by: Nick Kossifidis <mickflemm@gmail.com>

-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

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

* Re: [PATCH 6/8] ath5: Remove unused CTL definitions
  2011-01-19  9:21 ` [PATCH 6/8] ath5: Remove unused CTL definitions Bruno Randolf
  2011-01-19 11:15   ` Bob Copeland
@ 2011-01-19 15:55   ` Nick Kossifidis
  1 sibling, 0 replies; 27+ messages in thread
From: Nick Kossifidis @ 2011-01-19 15:55 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

2011/1/19 Bruno Randolf <br1@einfach.org>:
> They are unused in ath5k and a more detailled definition is in
> ath/regd_common.h.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>
> ---
>  drivers/net/wireless/ath/ath5k/eeprom.h |   23 -----------------------
>  1 files changed, 0 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/eeprom.h b/drivers/net/wireless/ath/ath5k/eeprom.h
> index d46f105..6511c27 100644
> --- a/drivers/net/wireless/ath/ath5k/eeprom.h
> +++ b/drivers/net/wireless/ath/ath5k/eeprom.h
> @@ -268,29 +268,6 @@ enum ath5k_ctl_mode {
>        AR5K_CTL_MODE_M = 15,
>  };
>
> -/* Default CTL ids for the 3 main reg domains.
> - * Atheros only uses these by default but vendors
> - * can have up to 32 different CTLs for different
> - * scenarios. Note that theese values are ORed with
> - * the mode id (above) so we can have up to 24 CTL
> - * datasets out of these 3 main regdomains. That leaves
> - * 8 ids that can be used by vendors and since 0x20 is
> - * missing from HAL sources i guess this is the set of
> - * custom CTLs vendors can use. */
> -#define        AR5K_CTL_FCC    0x10
> -#define        AR5K_CTL_CUSTOM 0x20
> -#define        AR5K_CTL_ETSI   0x30
> -#define        AR5K_CTL_MKK    0x40
> -
> -/* Indicates a CTL with only mode set and
> - * no reg domain mapping, such CTLs are used
> - * for world roaming domains or simply when
> - * a reg domain is not set */
> -#define        AR5K_CTL_NO_REGDOMAIN   0xf0
> -
> -/* Indicates an empty (invalid) CTL */
> -#define AR5K_CTL_NO_CTL                0xff
> -
>  /* Per channel calibration data, used for power table setup */
>  struct ath5k_chan_pcal_info_rf5111 {
>        /* Power levels in half dbm units
>


Acked-by: Nick Kossifidis <mickflemm@gmail.com>



-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

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

* Re: [PATCH 7/8] ath5k: Remove unused sc->curmode
  2011-01-19  9:21 ` [PATCH 7/8] ath5k: Remove unused sc->curmode Bruno Randolf
  2011-01-19 11:17   ` Bob Copeland
@ 2011-01-19 15:56   ` Nick Kossifidis
  1 sibling, 0 replies; 27+ messages in thread
From: Nick Kossifidis @ 2011-01-19 15:56 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

2011/1/19 Bruno Randolf <br1@einfach.org>:
> sc->curmode is set but never used. Remove it and the helper function. Also the
> ath5k_rate_update which is refered to in the comment does not exist (any more?)
> so we don't need to setup the band in that place.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>
> ---
>  drivers/net/wireless/ath/ath5k/base.c |   18 ------------------
>  drivers/net/wireless/ath/ath5k/base.h |    1 -
>  2 files changed, 0 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index 6900543..a00cc11 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -439,18 +439,6 @@ ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)
>        return ath5k_reset(sc, chan, true);
>  }
>
> -static void
> -ath5k_setcurmode(struct ath5k_softc *sc, unsigned int mode)
> -{
> -       sc->curmode = mode;
> -
> -       if (mode == AR5K_MODE_11A) {
> -               sc->curband = &sc->sbands[IEEE80211_BAND_5GHZ];
> -       } else {
> -               sc->curband = &sc->sbands[IEEE80211_BAND_2GHZ];
> -       }
> -}
> -
>  struct ath_vif_iter_data {
>        const u8        *hw_macaddr;
>        u8              mask[ETH_ALEN];
> @@ -2776,12 +2764,6 @@ ath5k_init(struct ieee80211_hw *hw)
>                goto err;
>        }
>
> -       /* NB: setup here so ath5k_rate_update is happy */
> -       if (test_bit(AR5K_MODE_11A, ah->ah_modes))
> -               ath5k_setcurmode(sc, AR5K_MODE_11A);
> -       else
> -               ath5k_setcurmode(sc, AR5K_MODE_11B);
> -
>        /*
>         * Allocate tx+rx descriptors and populate the lists.
>         */
> diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
> index 6d51147..58660e4 100644
> --- a/drivers/net/wireless/ath/ath5k/base.h
> +++ b/drivers/net/wireless/ath/ath5k/base.h
> @@ -202,7 +202,6 @@ struct ath5k_softc {
>  #define ATH_STAT_STARTED       4               /* opened & irqs enabled */
>
>        unsigned int            filter_flags;   /* HW flags, AR5K_RX_FILTER_* */
> -       unsigned int            curmode;        /* current phy mode */
>        struct ieee80211_channel *curchan;      /* current h/w channel */
>
>        u16                     nvifs;
>


Acked-by: Nick Kossifidis <mickflemm@gmail.com>


-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

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

* Re: [PATCH 8/8] ath5k: Remove redundant sc->curband
  2011-01-19  9:21 ` [PATCH 8/8] ath5k: Remove redundant sc->curband Bruno Randolf
  2011-01-19 11:19   ` Bob Copeland
@ 2011-01-19 15:57   ` Nick Kossifidis
  1 sibling, 0 replies; 27+ messages in thread
From: Nick Kossifidis @ 2011-01-19 15:57 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

2011/1/19 Bruno Randolf <br1@einfach.org>:
> Remove sc->curband because the band is already stored in the current channel.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>
> ---
>  drivers/net/wireless/ath/ath5k/base.c |   11 ++++-------
>  drivers/net/wireless/ath/ath5k/base.h |    2 --
>  2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index a00cc11..0e39ee8 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -551,7 +551,7 @@ ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix)
>                        "hw_rix out of bounds: %x\n", hw_rix))
>                return 0;
>
> -       rix = sc->rate_idx[sc->curband->band][hw_rix];
> +       rix = sc->rate_idx[sc->curchan->band][hw_rix];
>        if (WARN(rix < 0, "invalid hw_rix: %x\n", hw_rix))
>                rix = 0;
>
> @@ -1361,7 +1361,7 @@ ath5k_receive_frame(struct ath5k_softc *sc, struct sk_buff *skb,
>        rxs->flag |= RX_FLAG_TSFT;
>
>        rxs->freq = sc->curchan->center_freq;
> -       rxs->band = sc->curband->band;
> +       rxs->band = sc->curchan->band;
>
>        rxs->signal = sc->ah->ah_noise_floor + rs->rs_rssi;
>
> @@ -1376,7 +1376,7 @@ ath5k_receive_frame(struct ath5k_softc *sc, struct sk_buff *skb,
>        rxs->flag |= ath5k_rx_decrypted(sc, skb, rs);
>
>        if (rxs->rate_idx >= 0 && rs->rs_rate ==
> -           sc->curband->bitrates[rxs->rate_idx].hw_value_short)
> +           sc->sbands[sc->curchan->band].bitrates[rxs->rate_idx].hw_value_short)
>                rxs->flag |= RX_FLAG_SHORTPRE;
>
>        ath5k_debug_dump_skb(sc, skb, "RX  ", 0);
> @@ -2536,7 +2536,6 @@ ath5k_init_hw(struct ath5k_softc *sc)
>         * and then setup of the interrupt mask.
>         */
>        sc->curchan = sc->hw->conf.channel;
> -       sc->curband = &sc->sbands[sc->curchan->band];
>        sc->imask = AR5K_INT_RXOK | AR5K_INT_RXERR | AR5K_INT_RXEOL |
>                AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL |
>                AR5K_INT_FATAL | AR5K_INT_GLOBAL | AR5K_INT_MIB;
> @@ -2663,10 +2662,8 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
>         * so we should also free any remaining
>         * tx buffers */
>        ath5k_drain_tx_buffs(sc);
> -       if (chan) {
> +       if (chan)
>                sc->curchan = chan;
> -               sc->curband = &sc->sbands[chan->band];
> -       }
>        ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL,
>                                                                skip_pcu);
>        if (ret) {
> diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
> index 58660e4..8f919dc 100644
> --- a/drivers/net/wireless/ath/ath5k/base.h
> +++ b/drivers/net/wireless/ath/ath5k/base.h
> @@ -183,8 +183,6 @@ struct ath5k_softc {
>        enum nl80211_iftype     opmode;
>        struct ath5k_hw         *ah;            /* Atheros HW */
>
> -       struct ieee80211_supported_band         *curband;
> -
>  #ifdef CONFIG_ATH5K_DEBUG
>        struct ath5k_dbg_info   debug;          /* debug info */
>  #endif /* CONFIG_ATH5K_DEBUG */
>


Acked-by: Nick Kossifidis <mickflemm@gmail.com>


-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

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

* Re: [PATCH 4/8] ath5k: ath5k_setup_channels cleanup and whitespace
  2011-01-19  9:20 ` [PATCH 4/8] ath5k: ath5k_setup_channels cleanup and whitespace Bruno Randolf
  2011-01-19 11:09   ` Bob Copeland
@ 2011-01-19 15:57   ` Nick Kossifidis
  1 sibling, 0 replies; 27+ messages in thread
From: Nick Kossifidis @ 2011-01-19 15:57 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

2011/1/19 Bruno Randolf <br1@einfach.org>:
> Remove useless test_bit - it's not going to happen because of the way this
> function is called only when that bit is set.
>
> And fix some whitespace.
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>
> ---
>  drivers/net/wireless/ath/ath5k/base.c |   11 +++--------
>  1 files changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index 9e8b1f4..a28ad58 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -256,21 +256,16 @@ static bool ath5k_is_standard_channel(short chan)
>  }
>
>  static unsigned int
> -ath5k_setup_channels(struct ath5k_hw *ah,
> -               struct ieee80211_channel *channels,
> -               unsigned int mode,
> -               unsigned int max)
> +ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels,
> +               unsigned int mode, unsigned int max)
>  {
>        unsigned int count, size, chfreq, freq, ch;
>        enum ieee80211_band band;
>
> -       if (!test_bit(mode, ah->ah_modes))
> -               return 0;
> -
>        switch (mode) {
>        case AR5K_MODE_11A:
>                /* 1..220, but 2GHz frequencies are filtered by check_channel */
> -               size = 220 ;
> +               size = 220;
>                chfreq = CHANNEL_5GHZ;
>                band = IEEE80211_BAND_5GHZ;
>                break;
>


Acked-by: Nick Kossifidis <mickflemm@gmail.com>


-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

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

* Re: [PATCH 0/8] ath5k 802.11j preparation and cleanup
  2011-01-19  9:20 [PATCH 0/8] ath5k 802.11j preparation and cleanup Bruno Randolf
                   ` (7 preceding siblings ...)
  2011-01-19  9:21 ` [PATCH 8/8] ath5k: Remove redundant sc->curband Bruno Randolf
@ 2011-01-19 15:58 ` Nick Kossifidis
  8 siblings, 0 replies; 27+ messages in thread
From: Nick Kossifidis @ 2011-01-19 15:58 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, linux-wireless

2011/1/19 Bruno Randolf <br1@einfach.org>:
> This series prepares ath5k for 802.11j (4.9GHz) support but most of the patches
> are just cleaning up things i found in the process. 802.11j is still not
> enabled.
>
> bruno
>
> ---
>
> Bruno Randolf (8):
>      ath5k: Use mac80211 channel mapping function
>      ath5k: Simplify loop when setting up channels
>      ath5k: Rename ath5k_copy_channels
>      ath5k: ath5k_setup_channels cleanup and whitespace
>      ath5k: Add 802.11j 4.9GHz channels to allowed channels
>      ath5: Remove unused CTL definitions
>      ath5k: Remove unused sc->curmode
>      ath5k: Remove redundant sc->curband
>
>
>  drivers/net/wireless/ath/ath5k/base.c   |   95 +++++++++++--------------------
>  drivers/net/wireless/ath/ath5k/base.h   |    3 -
>  drivers/net/wireless/ath/ath5k/eeprom.h |   23 --------
>  3 files changed, 34 insertions(+), 87 deletions(-)
>
> --
> Signature

Nice clean up !


-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

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

end of thread, other threads:[~2011-01-19 15:58 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-19  9:20 [PATCH 0/8] ath5k 802.11j preparation and cleanup Bruno Randolf
2011-01-19  9:20 ` [PATCH 1/8] ath5k: Use mac80211 channel mapping function Bruno Randolf
2011-01-19 15:39   ` Bob Copeland
2011-01-19  9:20 ` [PATCH 2/8] ath5k: Simplify loop when setting up channels Bruno Randolf
2011-01-19 11:07   ` Bob Copeland
2011-01-19 11:51     ` Bruno Randolf
2011-01-19  9:20 ` [PATCH 3/8] ath5k: Rename ath5k_copy_channels Bruno Randolf
2011-01-19 11:08   ` Bob Copeland
2011-01-19 15:54   ` Nick Kossifidis
2011-01-19  9:20 ` [PATCH 4/8] ath5k: ath5k_setup_channels cleanup and whitespace Bruno Randolf
2011-01-19 11:09   ` Bob Copeland
2011-01-19 15:57   ` Nick Kossifidis
2011-01-19  9:20 ` [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels Bruno Randolf
2011-01-19 11:14   ` Bob Copeland
2011-01-19 11:52     ` Bruno Randolf
2011-01-19 15:18       ` Bob Copeland
2011-01-19 15:55   ` Nick Kossifidis
2011-01-19  9:21 ` [PATCH 6/8] ath5: Remove unused CTL definitions Bruno Randolf
2011-01-19 11:15   ` Bob Copeland
2011-01-19 15:55   ` Nick Kossifidis
2011-01-19  9:21 ` [PATCH 7/8] ath5k: Remove unused sc->curmode Bruno Randolf
2011-01-19 11:17   ` Bob Copeland
2011-01-19 15:56   ` Nick Kossifidis
2011-01-19  9:21 ` [PATCH 8/8] ath5k: Remove redundant sc->curband Bruno Randolf
2011-01-19 11:19   ` Bob Copeland
2011-01-19 15:57   ` Nick Kossifidis
2011-01-19 15:58 ` [PATCH 0/8] ath5k 802.11j preparation and cleanup Nick Kossifidis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.