Skip to contentSkip to conversation

ath5k: remove unused and write-only structures and fields

PATCH In review Pavel Roskin 3 participants 10 messages Jul 23, 2011 Atheros ATH5K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ath5k: remove unused and write-only structures and fields

struct ath5k_avg_val is unused.

In struct ath5k_hw, lladdr, ah_radar and ah_mac_revision are write-only, rxbufsize is unused, ah_phy is write-only and referenced by unused macros.

In struct ath5k_vif, lladdr is write-only.

Remove AR5K_TUNE_RADAR_ALERT, which has no effect.

---
 drivers/net/wireless/ath/ath5k/ath5k.h        |   28 -------------------------
 drivers/net/wireless/ath/ath5k/attach.c       |    5 +---
 drivers/net/wireless/ath/ath5k/base.c         |    1 -
 drivers/net/wireless/ath/ath5k/base.h         |    1 -
 drivers/net/wireless/ath/ath5k/mac80211-ops.c |    3 ---
 5 files changed, 1 insertions(+), 37 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +0 -28
index 277d5cb..be7b8c0 100644
@@ -131,13 +131,6 @@
 #define AR5K_REG_DISABLE_BITS(ah, _reg, _flags)			\
 	ath5k_hw_reg_write(ah, ath5k_hw_reg_read(ah, _reg) & ~(_flags), _reg)
 
-/* Access to PHY registers */
-#define AR5K_PHY_READ(ah, _reg)					\
-	ath5k_hw_reg_read(ah, (ah)->ah_phy + ((_reg) << 2))
-
-#define AR5K_PHY_WRITE(ah, _reg, _val)					\
-	ath5k_hw_reg_write(ah, _val, (ah)->ah_phy + ((_reg) << 2))
-
 /* Access QCU registers per queue */
 #define AR5K_REG_READ_Q(ah, _reg, _queue)				\
 	(ath5k_hw_reg_read(ah, _reg) & (1 << _queue))			\
@@ -166,7 +159,6 @@
 #define AR5K_TUNE_DMA_BEACON_RESP		2
 #define AR5K_TUNE_SW_BEACON_RESP		10
 #define AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF	0
-#define AR5K_TUNE_RADAR_ALERT			false
 #define AR5K_TUNE_MIN_TX_FIFO_THRES		1
 #define AR5K_TUNE_MAX_TX_FIFO_THRES	((IEEE80211_MAX_FRAME_LEN / 64) + 1)
 #define AR5K_TUNE_REGISTER_TIMEOUT		20000
@@ -1013,16 +1005,6 @@ struct ath5k_nfcal_hist {
 	s16 nfval[ATH5K_NF_CAL_HIST_MAX];	/* last few noise floors */
 };
 
-/**
- * struct avg_val - Helper structure for average calculation
- * @avg: contains the actual average value
- * @avg_weight: is used internally during calculation to prevent rounding errors
- */
-struct ath5k_avg_val {
-	int avg;
-	int avg_weight;
-};
-
 #define ATH5K_LED_MAX_NAME_LEN 31
 
 /*
@@ -1148,7 +1130,6 @@ struct ath5k_hw {
 	bool			rx_pending;	/* rx tasklet pending */
 	bool			tx_pending;	/* tx tasklet pending */
 
-	u8			lladdr[ETH_ALEN];
 	u8			bssidmask[ETH_ALEN];
 
 	unsigned int		led_pin,	/* GPIO pin for driving LED */
@@ -1156,7 +1137,6 @@ struct ath5k_hw {
 
 	struct work_struct	reset_work;	/* deferred chip reset */
 
-	unsigned int		rxbufsize;	/* rx size based on mtu */
 	struct list_head	rxbuf;		/* receive buffer */
 	spinlock_t		rxbuflock;
 	u32			*rxlink;	/* link ptr in last RX desc */
@@ -1208,10 +1188,8 @@ struct ath5k_hw {
 
 	enum ath5k_version	ah_version;
 	enum ath5k_radio	ah_radio;
-	u32			ah_phy;
 	u32			ah_mac_srev;
 	u16			ah_mac_version;
-	u16			ah_mac_revision;
 	u16			ah_phy_revision;
 	u16			ah_radio_5ghz_revision;
 	u16			ah_radio_2ghz_revision;
@@ -1279,12 +1257,6 @@ struct ath5k_hw {
 		bool		txp_setup;
 	} ah_txpower;
 
-	struct {
-		bool		r_enabled;
-		int		r_last_alert;
-		struct ieee80211_channel r_last_channel;
-	} ah_radar;
-
 	struct ath5k_nfcal_hist ah_nfcal_hist;
 
 	/* average beacon RSSI in our BSS (used by ANI) */
drivers/net/wireless/ath/ath5k/attach.c +1 -4
index f8a6b38..b0df2f6 100644
@@ -114,7 +114,6 @@ int ath5k_hw_init(struct ath5k_hw *ah)
 	/*
 	 * HW information
 	 */
-	ah->ah_radar.r_enabled = AR5K_TUNE_RADAR_ALERT;
 	ah->ah_bwmode = AR5K_BWMODE_DEFAULT;
 	ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
 	ah->ah_imr = 0;
@@ -137,9 +136,8 @@ int ath5k_hw_init(struct ath5k_hw *ah)
 	else
 		ah->ah_version = AR5K_AR5212;
 
-	/* Get the MAC revision */
+	/* Get the MAC version */
 	ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
-	ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV);
 
 	/* Fill the ath5k_hw struct with the needed functions */
 	ret = ath5k_hw_init_desc_functions(ah);
@@ -156,7 +154,6 @@ int ath5k_hw_init(struct ath5k_hw *ah)
 			0xffffffff;
 	ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
 			CHANNEL_5GHZ);
-	ah->ah_phy = AR5K_PHY(0);
 
 	/* Try to identify radio chip based on its srev */
 	switch (ah->ah_radio_5ghz_revision & 0xf0) {
drivers/net/wireless/ath/ath5k/base.c +0 -1
index a74d286..ee06e34 100644
@@ -2861,7 +2861,6 @@ ath5k_init(struct ieee80211_hw *hw)
 	}
 
 	SET_IEEE80211_PERM_ADDR(hw, mac);
-	memcpy(&ah->lladdr, mac, ETH_ALEN);
 	/* All MAC address bits matter for ACKs */
 	ath5k_update_bssid_mask_and_opmode(ah, NULL);
 
drivers/net/wireless/ath/ath5k/base.h +0 -1
index a81f28d..5501bcb 100644
@@ -65,7 +65,6 @@ struct ath5k_vif {
 	enum nl80211_iftype	opmode;
 	int			bslot;
 	struct ath5k_buf	*bbuf; /* beacon buffer */
-	u8			lladdr[ETH_ALEN];
 };
 
 struct ath5k_vif_iter_data {
drivers/net/wireless/ath/ath5k/mac80211-ops.c +0 -3
index 2a715ca..53d3af9 100644
@@ -137,11 +137,8 @@ ath5k_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 	/* Any MAC address is fine, all others are included through the
 	 * filter.
 	 */
-	memcpy(&ah->lladdr, vif->addr, ETH_ALEN);
 	ath5k_hw_set_lladdr(ah, vif->addr);
 
-	memcpy(&avf->lladdr, vif->addr, ETH_ALEN);
-
 	ath5k_update_bssid_mask_and_opmode(ah, vif);
 	ret = 0;
 end:
#1 lore raw

PATCH 2/3 ath5k: remove most references to XR

XR is a proprietary feature of the chipset. It's not supported and should not be supported.

---
 drivers/net/wireless/ath/ath5k/ath5k.h  |   26 --------------------------
 drivers/net/wireless/ath/ath5k/eeprom.c |    1 -
 drivers/net/wireless/ath/ath5k/phy.c    |    2 --
 drivers/net/wireless/ath/ath5k/qcu.c    |    7 -------
 drivers/net/wireless/ath/ath5k/reset.c  |    8 --------
 5 files changed, 0 insertions(+), 44 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +0 -26
index be7b8c0..c3a008d 100644
@@ -356,23 +356,6 @@ struct ath5k_srev_name {
 /* TODO add support to mac80211 for vendor-specific rates and modes */
 
 /*
- * Some of this information is based on Documentation from:
- *
- * http://madwifi-project.org/wiki/ChipsetFeatures/SuperAG
- *
- * Modulation for Atheros' eXtended Range - range enhancing extension that is
- * supposed to double the distance an Atheros client device can keep a
- * connection with an Atheros access point. This is achieved by increasing
- * the receiver sensitivity up to, -105dBm, which is about 20dB above what
- * the 802.11 specifications demand. In addition, new (proprietary) data rates
- * are introduced: 3, 2, 1, 0.5 and 0.25 MBit/s.
- *
- * Please note that can you either use XR or TURBO but you cannot use both,
- * they are exclusive.
- *
- */
-#define MODULATION_XR		0x00000200
-/*
  * Modulation for Atheros' Turbo G and Turbo A, its supposed to provide a
  * throughput transmission speed up to 40Mbit/s-60Mbit/s at a 108Mbit/s
  * signaling rate achieved through the bonding of two 54Mbit/s 802.11g
@@ -416,7 +399,6 @@ enum ath5k_driver_mode {
 	AR5K_MODE_11A		=	0,
 	AR5K_MODE_11B		=	1,
 	AR5K_MODE_11G		=	2,
-	AR5K_MODE_XR		=	0,
 	AR5K_MODE_MAX		=	3
 };
 
@@ -694,12 +676,10 @@ struct ath5k_gain {
 #define	CHANNEL_5GHZ	0x0100	/* 5GHz channel */
 #define	CHANNEL_PASSIVE	0x0200	/* Only passive scan allowed */
 #define	CHANNEL_DYN	0x0400	/* Dynamic CCK-OFDM channel (for g operation) */
-#define	CHANNEL_XR	0x0800	/* XR channel */
 
 #define	CHANNEL_A	(CHANNEL_5GHZ | CHANNEL_OFDM)
 #define	CHANNEL_B	(CHANNEL_2GHZ | CHANNEL_CCK)
 #define	CHANNEL_G	(CHANNEL_2GHZ | CHANNEL_OFDM)
-#define	CHANNEL_X	(CHANNEL_5GHZ | CHANNEL_OFDM | CHANNEL_XR)
 
 #define	CHANNEL_ALL	(CHANNEL_OFDM | CHANNEL_CCK | \
 			 CHANNEL_2GHZ | CHANNEL_5GHZ)
@@ -710,7 +690,6 @@ struct ath5k_gain {
  * Used internally for ath5k_hw_reset_tx_queue().
  * Also see struct struct ieee80211_channel.
  */
-#define IS_CHAN_XR(_c)	((_c->hw_value & CHANNEL_XR) != 0)
 #define IS_CHAN_B(_c)	((_c->hw_value & CHANNEL_B) != 0)
 
 /*
@@ -772,11 +751,6 @@ struct ath5k_athchan_2ghz {
 #define ATH5K_RATE_CODE_36M	0x0D
 #define ATH5K_RATE_CODE_48M	0x08
 #define ATH5K_RATE_CODE_54M	0x0C
-/* XR */
-#define ATH5K_RATE_CODE_XR_500K	0x07
-#define ATH5K_RATE_CODE_XR_1M	0x02
-#define ATH5K_RATE_CODE_XR_2M	0x06
-#define ATH5K_RATE_CODE_XR_3M	0x01
 
 /* adding this flag to rate_code enables short preamble */
 #define AR5K_SET_SHORT_PREAMBLE 0x04
drivers/net/wireless/ath/ath5k/eeprom.c +0 -1
index 9068b91..56cb9d4 100644
@@ -1782,7 +1782,6 @@ ath5k_eeprom_mode_from_channel(struct ieee80211_channel *channel)
 {
 	switch (channel->hw_value & CHANNEL_MODES) {
 	case CHANNEL_A:
-	case CHANNEL_XR:
 		return AR5K_EEPROM_MODE_11A;
 	case CHANNEL_G:
 		return AR5K_EEPROM_MODE_11G;
drivers/net/wireless/ath/ath5k/phy.c +0 -2
index 81e465e..b9ada88 100644
@@ -2408,8 +2408,6 @@ ath5k_get_max_ctl_power(struct ath5k_hw *ah,
 	case CHANNEL_B:
 		ctl_mode |= AR5K_CTL_11B;
 		break;
-	case CHANNEL_XR:
-		/* Fall through */
 	default:
 		return;
 	}
drivers/net/wireless/ath/ath5k/qcu.c +0 -7
index 65f1039..1d37675 100644
@@ -185,13 +185,6 @@ int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type,
 		case AR5K_TX_QUEUE_CAB:
 			queue = AR5K_TX_QUEUE_ID_CAB;
 			break;
-		case AR5K_TX_QUEUE_XR_DATA:
-			if (ah->ah_version != AR5K_AR5212)
-				ATH5K_ERR(ah,
-					"XR data queues only supported in"
-					" 5212!\n");
-			queue = AR5K_TX_QUEUE_ID_XR_DATA;
-			break;
 		default:
 			return -EINVAL;
 		}
drivers/net/wireless/ath/ath5k/reset.c +0 -8
index 0686c5d..5d6d3bd 100644
@@ -1108,14 +1108,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
 
 		mode = AR5K_MODE_11B;
 		break;
-	case CHANNEL_XR:
-		if (ah->ah_version == AR5K_AR5211) {
-			ATH5K_ERR(ah,
-				"XR mode not available on 5211");
-			return -EINVAL;
-		}
-		mode = AR5K_MODE_XR;
-		break;
 	default:
 		ATH5K_ERR(ah,
 			"invalid channel: %d\n", channel->center_freq);
maintainer
#3 lore raw

Re: [PATCH 2/3] ath5k: remove most references to XR

In reply to Pavel Roskin

Could we leave the comments on ath5k.h and the rate code definitions ? I believe we should leave them there as reference...

2011/7/23 Pavel Roskin <[email protected]>:

Quoted 148 lines

XR is a proprietary feature of the chipset.  It's not supported and should not be supported.

---
 drivers/net/wireless/ath/ath5k/ath5k.h  |   26 -------------------------- drivers/net/wireless/ath/ath5k/eeprom.c |    1 - drivers/net/wireless/ath/ath5k/phy.c    |    2 -- drivers/net/wireless/ath/ath5k/qcu.c    |    7 ------- drivers/net/wireless/ath/ath5k/reset.c  |    8 --------

 5 files changed, 0 insertions(+), 44 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +0 -18
index be7b8c0..c3a008d 100644
@@ -356,23 +356,6 @@ struct ath5k_srev_name {
  /* TODO add support to mac80211 for vendor-specific rates and modes */
 
  /*
- * Some of this information is based on Documentation from:
- *
- * http://madwifi-project.org/wiki/ChipsetFeatures/SuperAG
- *
- * Modulation for Atheros' eXtended Range - range enhancing extension that is
- * supposed to double the distance an Atheros client device can keep a
- * connection with an Atheros access point. This is achieved by increasing
- * the receiver sensitivity up to, -105dBm, which is about 20dB above what
- * the 802.11 specifications demand. In addition, new (proprietary) data rates
- * are introduced: 3, 2, 1, 0.5 and 0.25 MBit/s.
- *
- * Please note that can you either use XR or TURBO but you cannot use both,
- * they are exclusive.
- *
- */
-#define MODULATION_XR          0x00000200
-/*
  * Modulation for Atheros' Turbo G and Turbo A, its supposed to provide a
  * throughput transmission speed up to 40Mbit/s-60Mbit/s at a 108Mbit/s
  * signaling rate achieved through the bonding of two 54Mbit/s 802.11g
@@ -416,7 +399,6 @@ enum ath5k_driver_mode {
        AR5K_MODE_11A           =       0,
        AR5K_MODE_11B           =       1,
        AR5K_MODE_11G           =       2,
-       AR5K_MODE_XR            =       0,

       AR5K_MODE_MAX           =       3
 };

drivers/net/wireless/ath/ath5k/ath5k.h +0 -8
@@ -694,12 +676,10 @@ struct ath5k_gain {
  #define        CHANNEL_5GHZ    0x0100  /* 5GHz channel */
  #define        CHANNEL_PASSIVE 0x0200  /* Only passive scan allowed */
  #define        CHANNEL_DYN     0x0400  /* Dynamic CCK-OFDM channel (for g operation) */
-#define        CHANNEL_XR      0x0800  /* XR channel */
 
  #define        CHANNEL_A       (CHANNEL_5GHZ | CHANNEL_OFDM)
  #define        CHANNEL_B       (CHANNEL_2GHZ | CHANNEL_CCK)
  #define        CHANNEL_G       (CHANNEL_2GHZ | CHANNEL_OFDM)
-#define        CHANNEL_X       (CHANNEL_5GHZ | CHANNEL_OFDM | CHANNEL_XR)
 
  #define        CHANNEL_ALL     (CHANNEL_OFDM | CHANNEL_CCK | \
                         CHANNEL_2GHZ | CHANNEL_5GHZ)
@@ -710,7 +690,6 @@ struct ath5k_gain {
  * Used internally for ath5k_hw_reset_tx_queue().
  * Also see struct struct ieee80211_channel.
  */
-#define IS_CHAN_XR(_c) ((_c->hw_value & CHANNEL_XR) != 0)
  #define IS_CHAN_B(_c)  ((_c->hw_value & CHANNEL_B) != 0)
 
  /*
@@ -772,11 +751,6 @@ struct ath5k_athchan_2ghz {
  #define ATH5K_RATE_CODE_36M    0x0D
  #define ATH5K_RATE_CODE_48M    0x08
  #define ATH5K_RATE_CODE_54M    0x0C
-/* XR */
-#define ATH5K_RATE_CODE_XR_500K        0x07
-#define ATH5K_RATE_CODE_XR_1M  0x02
-#define ATH5K_RATE_CODE_XR_2M  0x06
-#define ATH5K_RATE_CODE_XR_3M  0x01
 
  /* adding this flag to rate_code enables short preamble */
  #define AR5K_SET_SHORT_PREAMBLE 0x04
drivers/net/wireless/ath/ath5k/eeprom.c +0 -0
index 9068b91..56cb9d4 100644
@@ -1782,7 +1782,6 @@ ath5k_eeprom_mode_from_channel(struct ieee80211_channel *channel)
  {
        switch (channel->hw_value & CHANNEL_MODES) {

       case CHANNEL_A:
-       case CHANNEL_XR:
               return AR5K_EEPROM_MODE_11A;
       case CHANNEL_G:
               return AR5K_EEPROM_MODE_11G;

drivers/net/wireless/ath/ath5k/phy.c +0 -0
index 81e465e..b9ada88 100644
@@ -2408,8 +2408,6 @@ ath5k_get_max_ctl_power(struct ath5k_hw *ah,

       case CHANNEL_B:
               ctl_mode |= AR5K_CTL_11B;
               break;
-       case CHANNEL_XR:
-               /* Fall through */
       default:
               return;
       }

drivers/net/wireless/ath/ath5k/qcu.c +0 -0
index 65f1039..1d37675 100644
@@ -185,13 +185,6 @@ int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type,

               case AR5K_TX_QUEUE_CAB:
                       queue = AR5K_TX_QUEUE_ID_CAB;
                       break;
-               case AR5K_TX_QUEUE_XR_DATA:
-                       if (ah->ah_version != AR5K_AR5212)
-                               ATH5K_ERR(ah,
-                                       "XR data queues only supported in"
-                                       " 5212!\n");
-                       queue = AR5K_TX_QUEUE_ID_XR_DATA;
-                       break;
               default:
                       return -EINVAL;
               }

drivers/net/wireless/ath/ath5k/reset.c +0 -8
index 0686c5d..5d6d3bd 100644
@@ -1108,14 +1108,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
 
                mode = AR5K_MODE_11B;
                break;
-       case CHANNEL_XR:
-               if (ah->ah_version == AR5K_AR5211) {
-                       ATH5K_ERR(ah,
-                               "XR mode not available on 5211");
-                       return -EINVAL;
-               }
-               mode = AR5K_MODE_XR;
-               break;

       default:
               ATH5K_ERR(ah,
                       "invalid channel: %d\n", channel->center_freq); --
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#4 lore raw

Re: [PATCH 2/3] ath5k: remove most references to XR

Quoting Nick Kossifidis <[email protected]>:

Quoted 2 lines

Could we leave the comments on ath5k.h and the rate code definitions ? I believe we should leave them there as reference...

Sure. Version 2 has been sent.

Signature · 2 lines
Regards,
Pavel Roskin
maintainer
#5 lore raw

Re: [PATCH 2/3] ath5k: remove most references to XR

2011/7/23 Pavel Roskin <[email protected]>:

Quoted 7 lines

Quoting Nick Kossifidis <[email protected]>:

Quoted 2 lines

Could we leave the comments on ath5k.h and the rate code definitions ? I believe we should leave them there as reference...

Sure.  Version 2 has been sent.

Thanks a lot ;-)

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
#6 lore raw

PATCH 3/3 ath5k: eliminate CHANNEL_* macros, use AR5K_MODE_* in channel->hw_value

In reply to Pavel Roskin

When checking for the band, use channel->band.

Change ath5k_hw_nic_wakeup() and ath5k_channel_ok() to take ieee80211_channel. Change ath5k_hw_radio_revision() to take ieee80211_band.

---
 drivers/net/wireless/ath/ath5k/ath5k.h  |   32 +----------
 drivers/net/wireless/ath/ath5k/attach.c |   10 ++--
 drivers/net/wireless/ath/ath5k/base.c   |   23 ++------
 drivers/net/wireless/ath/ath5k/eeprom.c |    8 +--
 drivers/net/wireless/ath/ath5k/pcu.c    |    4 +
 drivers/net/wireless/ath/ath5k/phy.c    |   87 +++++++++++++++++--------------
 drivers/net/wireless/ath/ath5k/qcu.c    |    2 -
 drivers/net/wireless/ath/ath5k/reset.c  |   70 +++++++++++--------------
 8 files changed, 102 insertions(+), 134 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +4 -28
index c3a008d..0b9664b 100644
@@ -668,30 +668,6 @@ struct ath5k_gain {
 #define AR5K_SLOT_TIME_20	880
 #define AR5K_SLOT_TIME_MAX	0xffff
 
-/* channel_flags */
-#define	CHANNEL_CW_INT	0x0008	/* Contention Window interference detected */
-#define	CHANNEL_CCK	0x0020	/* CCK channel */
-#define	CHANNEL_OFDM	0x0040	/* OFDM channel */
-#define	CHANNEL_2GHZ	0x0080	/* 2GHz channel. */
-#define	CHANNEL_5GHZ	0x0100	/* 5GHz channel */
-#define	CHANNEL_PASSIVE	0x0200	/* Only passive scan allowed */
-#define	CHANNEL_DYN	0x0400	/* Dynamic CCK-OFDM channel (for g operation) */
-
-#define	CHANNEL_A	(CHANNEL_5GHZ | CHANNEL_OFDM)
-#define	CHANNEL_B	(CHANNEL_2GHZ | CHANNEL_CCK)
-#define	CHANNEL_G	(CHANNEL_2GHZ | CHANNEL_OFDM)
-
-#define	CHANNEL_ALL	(CHANNEL_OFDM | CHANNEL_CCK | \
-			 CHANNEL_2GHZ | CHANNEL_5GHZ)
-
-#define CHANNEL_MODES		CHANNEL_ALL
-
-/*
- * Used internally for ath5k_hw_reset_tx_queue().
- * Also see struct struct ieee80211_channel.
- */
-#define IS_CHAN_B(_c)	((_c->hw_value & CHANNEL_B) != 0)
-
 /*
  * The following structure is used to map 2GHz channels to
  * 5GHz Atheros channels.
@@ -943,7 +919,7 @@ enum ath5k_power_mode {
 struct ath5k_capabilities {
 	/*
 	 * Supported PHY modes
-	 * (ie. CHANNEL_A, CHANNEL_B, ...)
+	 * (ie. AR5K_MODE_11A, AR5K_MODE_11B, ...)
 	 */
 	DECLARE_BITMAP(cap_mode, AR5K_MODE_MAX);
 
@@ -1313,7 +1289,7 @@ void ath5k_unregister_leds(struct ath5k_hw *ah);
 
 
 /* Reset Functions */
-int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial);
+int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, struct ieee80211_channel *channel);
 int ath5k_hw_on_hold(struct ath5k_hw *ah);
 int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
 	   struct ieee80211_channel *channel, bool fast, bool skip_pcu);
@@ -1433,13 +1409,13 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel);
 
 /* PHY functions */
 /* Misc PHY functions */
-u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan);
+u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, enum ieee80211_band band);
 int ath5k_hw_phy_disable(struct ath5k_hw *ah);
 /* Gain_F optimization */
 enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah);
 int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah);
 /* PHY/RF channel functions */
-bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags);
+bool ath5k_channel_ok(struct ath5k_hw *ah, struct ieee80211_channel *channel);
 /* PHY calibration */
 void ath5k_hw_init_nfcal_hist(struct ath5k_hw *ah);
 int ath5k_hw_phy_calibrate(struct ath5k_hw *ah,
drivers/net/wireless/ath/ath5k/attach.c +5 -5
index b0df2f6..5606259 100644
@@ -145,7 +145,7 @@ int ath5k_hw_init(struct ath5k_hw *ah)
 		goto err;
 
 	/* Bring device out of sleep and reset its units */
-	ret = ath5k_hw_nic_wakeup(ah, 0, true);
+	ret = ath5k_hw_nic_wakeup(ah, NULL);
 	if (ret)
 		goto err;
 
@@ -153,7 +153,7 @@ int ath5k_hw_init(struct ath5k_hw *ah)
 	ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) &
 			0xffffffff;
 	ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
-			CHANNEL_5GHZ);
+			IEEE80211_BAND_5GHZ);
 
 	/* Try to identify radio chip based on its srev */
 	switch (ah->ah_radio_5ghz_revision & 0xf0) {
@@ -161,14 +161,14 @@ int ath5k_hw_init(struct ath5k_hw *ah)
 		ah->ah_radio = AR5K_RF5111;
 		ah->ah_single_chip = false;
 		ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
-							CHANNEL_2GHZ);
+							IEEE80211_BAND_2GHZ);
 		break;
 	case AR5K_SREV_RAD_5112:
 	case AR5K_SREV_RAD_2112:
 		ah->ah_radio = AR5K_RF5112;
 		ah->ah_single_chip = false;
 		ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
-							CHANNEL_2GHZ);
+							IEEE80211_BAND_2GHZ);
 		break;
 	case AR5K_SREV_RAD_2413:
 		ah->ah_radio = AR5K_RF2413;
@@ -205,7 +205,7 @@ int ath5k_hw_init(struct ath5k_hw *ah)
 			ah->ah_radio = AR5K_RF5111;
 			ah->ah_single_chip = false;
 			ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
-								CHANNEL_2GHZ);
+							IEEE80211_BAND_2GHZ);
 		} else if (ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4) ||
 			   ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4) ||
 			   ah->ah_phy_revision == AR5K_SREV_PHY_2425) {
drivers/net/wireless/ath/ath5k/base.c +7 -16
index ee06e34..dfbbd16 100644
@@ -271,20 +271,18 @@ static unsigned int
 ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels,
 		unsigned int mode, unsigned int max)
 {
-	unsigned int count, size, chfreq, freq, ch;
+	unsigned int count, size, freq, ch;
 	enum ieee80211_band band;
 
 	switch (mode) {
 	case AR5K_MODE_11A:
 		/* 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:
@@ -299,26 +297,19 @@ ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels,
 		if (freq == 0) /* mapping failed - not a standard channel */
 			continue;
 
+		/* Write channel info, needed for ath5k_channel_ok() */
+		channels[count].center_freq = freq;
+		channels[count].band = band;
+		channels[count].hw_value = mode;
+
 		/* Check if channel is supported by the chipset */
-		if (!ath5k_channel_ok(ah, freq, chfreq))
+		if (!ath5k_channel_ok(ah, &channels[count]))
 			continue;
 
 		if (!modparam_all_channels &&
 		    !ath5k_is_standard_channel(ch, band))
 			continue;
 
-		/* Write channel info and increment counter */
-		channels[count].center_freq = freq;
-		channels[count].band = band;
-		switch (mode) {
-		case AR5K_MODE_11A:
-		case AR5K_MODE_11G:
-			channels[count].hw_value = chfreq | CHANNEL_OFDM;
-			break;
-		case AR5K_MODE_11B:
-			channels[count].hw_value = CHANNEL_B;
-		}
-
 		count++;
 	}
 
drivers/net/wireless/ath/ath5k/eeprom.c +4 -4
index 56cb9d4..7c9c2ab 100644
@@ -1780,12 +1780,12 @@ ath5k_eeprom_detach(struct ath5k_hw *ah)
 int
 ath5k_eeprom_mode_from_channel(struct ieee80211_channel *channel)
 {
-	switch (channel->hw_value & CHANNEL_MODES) {
-	case CHANNEL_A:
+	switch (channel->hw_value) {
+	case AR5K_MODE_11A:
 		return AR5K_EEPROM_MODE_11A;
-	case CHANNEL_G:
+	case AR5K_MODE_11G:
 		return AR5K_EEPROM_MODE_11G;
-	case CHANNEL_B:
+	case AR5K_MODE_11B:
 		return AR5K_EEPROM_MODE_11B;
 	default:
 		return -1;
drivers/net/wireless/ath/ath5k/pcu.c +2 -2
index 0673138..733d46c 100644
@@ -152,7 +152,7 @@ unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah)
 	case AR5K_BWMODE_DEFAULT:
 	default:
 		slot_time = AR5K_INIT_SLOT_TIME_DEFAULT;
-		if ((channel->hw_value & CHANNEL_CCK) && !ah->ah_short_slot)
+		if ((channel->hw_value == AR5K_MODE_11B) && !ah->ah_short_slot)
 			slot_time = AR5K_INIT_SLOT_TIME_B;
 		break;
 	}
@@ -183,7 +183,7 @@ unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah)
 	case AR5K_BWMODE_DEFAULT:
 		sifs = AR5K_INIT_SIFS_DEFAULT_BG;
 	default:
-		if (channel->hw_value & CHANNEL_5GHZ)
+		if (channel->band == IEEE80211_BAND_5GHZ)
 			sifs = AR5K_INIT_SIFS_DEFAULT_A;
 		break;
 	}
drivers/net/wireless/ath/ath5k/phy.c +49 -38

227 lines not on this page · raw message

drivers/net/wireless/ath/ath5k/qcu.c +1 -1
index 1d37675..a8b8ffa 100644
@@ -537,7 +537,7 @@ int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time)
 	 *
 	 * Also we have different lowest rate for 802.11a
 	 */
-	if (channel->hw_value & CHANNEL_5GHZ)
+	if (channel->band == IEEE80211_BAND_5GHZ)
 		rate = &ah->sbands[IEEE80211_BAND_5GHZ].bitrates[0];
 	else
 		rate = &ah->sbands[IEEE80211_BAND_2GHZ].bitrates[0];
drivers/net/wireless/ath/ath5k/reset.c +30 -40

154 lines not on this page · raw message

Tested-by on v1 3/3
#7 lore raw

Re: [PATCH 3/3] ath5k: eliminate CHANNEL_* macros, use AR5K_MODE_* in channel->hw_value

Quoted 8 lines · Pavel Roskin

When checking for the band, use channel->band.

Change ath5k_hw_nic_wakeup() and ath5k_channel_ok() to take ieee80211_channel.  Change ath5k_hw_radio_revision() to take ieee80211_band.

Tested on Atheros AR5212 chip against linux-next (next-20110722).

Feel free to add:

- Sedat -

#8 lore raw

Re: [PATCH 3/3] ath5k: eliminate CHANNEL_* macros, use AR5K_MODE_* in channel->hw_value

Quoting Sedat Dilek <[email protected]>:

Quoted 7 lines · Pavel Roskin
Quoted 6 lines

When checking for the band, use channel->band.

Change ath5k_hw_nic_wakeup() and ath5k_channel_ok() to take ieee80211_channel.  Change ath5k_hw_radio_revision() to take ieee80211_band.

Quoted 8 lines
Quoted 2 lines

Tested on Atheros AR5212 chip against linux-next (next-20110722).

Feel free to add:

Thank you! You testing is valuable and encouraging.

Signature · 2 lines
Regards,
Pavel Roskin
Tested-by on v1 1/3
#9 lore raw
In reply to Pavel Roskin
Quoted 6 lines · Pavel Roskin

struct ath5k_avg_val is unused.

In struct ath5k_hw, lladdr, ah_radar and ah_mac_revision are write-only, rxbufsize is unused, ah_phy is write-only and referenced by unused macros.

Quoted 6 lines

In struct ath5k_vif, lladdr is write-only.

Remove AR5K_TUNE_RADAR_ALERT, which has no effect.

Tested on Atheros AR5212 chip against linux-next (next-20110722).

Feel free to add:

- Sedat -