Skip to content

Commit

Permalink
ath5k: cleanup ath5k_hw struct
Browse files Browse the repository at this point in the history
ah_gpios array isn't used, and ah_current_channel can be a pointer
instead of an embedded struct.  Removing these and some other
write-only variables, and moving some things around for better
packing and cache utilization saves 116 bytes.

   text	   data	    bss	    dec	    hex	filename
 121762	    472	     64	 122298	  1ddba	ath5k_before.ko
 121646	    472	     64	 122182	  1dd46	ath5k.ko

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Bob Copeland authored and John W. Linville committed Jul 10, 2009
1 parent 8a46097 commit 46026e8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
21 changes: 7 additions & 14 deletions drivers/net/wireless/ath/ath5k/ath5k.h
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,8 @@ struct ath5k_gain {
* Used internaly for 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)
#define IS_CHAN_XR(_c) ((_c->hw_value & CHANNEL_XR) != 0)
#define IS_CHAN_B(_c) ((_c->hw_value & CHANNEL_B) != 0)

/*
* The following structure is used to map 2GHz channels to
Expand Down Expand Up @@ -1029,43 +1029,37 @@ struct ath5k_hw {
enum ath5k_int ah_imr;

enum nl80211_iftype ah_op_mode;
enum ath5k_power_mode ah_power_mode;
struct ieee80211_channel ah_current_channel;
struct ieee80211_channel *ah_current_channel;
bool ah_turbo;
bool ah_calibration;
bool ah_running;
bool ah_single_chip;
bool ah_combined_mic;

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;

enum ath5k_version ah_version;
enum ath5k_radio ah_radio;
u32 ah_phy;

bool ah_5ghz;
bool ah_2ghz;

#define ah_modes ah_capabilities.cap_mode
#define ah_ee_version ah_capabilities.cap_eeprom.ee_version

u32 ah_atim_window;
u32 ah_aifs;
u32 ah_cw_min;
u32 ah_cw_max;
bool ah_software_retry;
u32 ah_limit_tx_retries;

/* Antenna Control */
u32 ah_ant_ctl[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX];
u8 ah_ant_mode;
u8 ah_tx_ant;
u8 ah_def_ant;
bool ah_software_retry;

u8 ah_sta_id[ETH_ALEN];

Expand All @@ -1075,7 +1069,6 @@ struct ath5k_hw {
u8 ah_bssid[ETH_ALEN];
u8 ah_bssid_mask[ETH_ALEN];

u32 ah_gpio[AR5K_MAX_GPIO];
int ah_gpio_npins;

struct ath_regulatory ah_regulatory;
Expand Down
7 changes: 3 additions & 4 deletions drivers/net/wireless/ath/ath5k/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,7 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
AR5K_PHY_CCKTXCTL_WORLD);
}

ah->ah_current_channel.center_freq = channel->center_freq;
ah->ah_current_channel.hw_value = channel->hw_value;
ah->ah_current_channel = channel;
ah->ah_turbo = channel->hw_value == CHANNEL_T ? true : false;

return 0;
Expand Down Expand Up @@ -1731,7 +1730,7 @@ ath5k_hw_set_fast_div(struct ath5k_hw *ah, u8 ee_mode, bool enable)
void
ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
{
struct ieee80211_channel *channel = &ah->ah_current_channel;
struct ieee80211_channel *channel = ah->ah_current_channel;
bool use_def_for_tx, update_def_on_tx, use_def_for_rts, fast_div;
bool use_def_for_sg;
u8 def_ant, tx_ant, ee_mode;
Expand Down Expand Up @@ -3011,7 +3010,7 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower)
{
/*Just a try M.F.*/
struct ieee80211_channel *channel = &ah->ah_current_channel;
struct ieee80211_channel *channel = ah->ah_current_channel;
u8 ee_mode;

ATH5K_TRACE(ah->ah_sc);
Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/ath/ath5k/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode,
}

commit:
ah->ah_power_mode = mode;
ath5k_hw_reg_write(ah, staid, AR5K_STA_ID1);

return 0;
Expand Down

0 comments on commit 46026e8

Please sign in to comment.