Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20a90490 authored by Bruno Randolf's avatar Bruno Randolf Committed by John W. Linville
Browse files

ath5k: Use local variable for capabilities



Shorten some lines and make code more readable.

Signed-off-by: default avatarBruno Randolf <br1@einfach.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5bec3e5a
Loading
Loading
Loading
Loading
+18 −21
Original line number Original line Diff line number Diff line
@@ -32,23 +32,24 @@
 */
 */
int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
{
{
	struct ath5k_capabilities *caps = &ah->ah_capabilities;
	u16 ee_header;
	u16 ee_header;


	/* Capabilities stored in the EEPROM */
	/* Capabilities stored in the EEPROM */
	ee_header = ah->ah_capabilities.cap_eeprom.ee_header;
	ee_header = caps->cap_eeprom.ee_header;


	if (ah->ah_version == AR5K_AR5210) {
	if (ah->ah_version == AR5K_AR5210) {
		/*
		/*
		 * Set radio capabilities
		 * Set radio capabilities
		 * (The AR5110 only supports the middle 5GHz band)
		 * (The AR5110 only supports the middle 5GHz band)
		 */
		 */
		ah->ah_capabilities.cap_range.range_5ghz_min = 5120;
		caps->cap_range.range_5ghz_min = 5120;
		ah->ah_capabilities.cap_range.range_5ghz_max = 5430;
		caps->cap_range.range_5ghz_max = 5430;
		ah->ah_capabilities.cap_range.range_2ghz_min = 0;
		caps->cap_range.range_2ghz_min = 0;
		ah->ah_capabilities.cap_range.range_2ghz_max = 0;
		caps->cap_range.range_2ghz_max = 0;


		/* Set supported modes */
		/* Set supported modes */
		__set_bit(AR5K_MODE_11A, ah->ah_capabilities.cap_mode);
		__set_bit(AR5K_MODE_11A, caps->cap_mode);
	} else {
	} else {
		/*
		/*
		 * XXX The tranceiver supports frequencies from 4920 to 6100GHz
		 * XXX The tranceiver supports frequencies from 4920 to 6100GHz
@@ -67,12 +68,11 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)


		if (AR5K_EEPROM_HDR_11A(ee_header)) {
		if (AR5K_EEPROM_HDR_11A(ee_header)) {
			/* 4920 */
			/* 4920 */
			ah->ah_capabilities.cap_range.range_5ghz_min = 5005;
			caps->cap_range.range_5ghz_min = 5005;
			ah->ah_capabilities.cap_range.range_5ghz_max = 6100;
			caps->cap_range.range_5ghz_max = 6100;


			/* Set supported modes */
			/* Set supported modes */
			__set_bit(AR5K_MODE_11A,
			__set_bit(AR5K_MODE_11A, caps->cap_mode);
					ah->ah_capabilities.cap_mode);
		}
		}


		/* Enable  802.11b if a 2GHz capable radio (2111/5112) is
		/* Enable  802.11b if a 2GHz capable radio (2111/5112) is
@@ -81,32 +81,29 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
		    (AR5K_EEPROM_HDR_11G(ee_header) &&
		    (AR5K_EEPROM_HDR_11G(ee_header) &&
		     ah->ah_version != AR5K_AR5211)) {
		     ah->ah_version != AR5K_AR5211)) {
			/* 2312 */
			/* 2312 */
			ah->ah_capabilities.cap_range.range_2ghz_min = 2412;
			caps->cap_range.range_2ghz_min = 2412;
			ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
			caps->cap_range.range_2ghz_max = 2732;


			if (AR5K_EEPROM_HDR_11B(ee_header))
			if (AR5K_EEPROM_HDR_11B(ee_header))
				__set_bit(AR5K_MODE_11B,
				__set_bit(AR5K_MODE_11B, caps->cap_mode);
						ah->ah_capabilities.cap_mode);


			if (AR5K_EEPROM_HDR_11G(ee_header) &&
			if (AR5K_EEPROM_HDR_11G(ee_header) &&
			    ah->ah_version != AR5K_AR5211)
			    ah->ah_version != AR5K_AR5211)
				__set_bit(AR5K_MODE_11G,
				__set_bit(AR5K_MODE_11G, caps->cap_mode);
						ah->ah_capabilities.cap_mode);
		}
		}
	}
	}


	/* Set number of supported TX queues */
	/* Set number of supported TX queues */
	if (ah->ah_version == AR5K_AR5210)
	if (ah->ah_version == AR5K_AR5210)
		ah->ah_capabilities.cap_queues.q_tx_num =
		caps->cap_queues.q_tx_num = AR5K_NUM_TX_QUEUES_NOQCU;
			AR5K_NUM_TX_QUEUES_NOQCU;
	else
	else
		ah->ah_capabilities.cap_queues.q_tx_num = AR5K_NUM_TX_QUEUES;
		caps->cap_queues.q_tx_num = AR5K_NUM_TX_QUEUES;


	/* newer hardware has PHY error counters */
	/* newer hardware has PHY error counters */
	if (ah->ah_mac_srev >= AR5K_SREV_AR5213A)
	if (ah->ah_mac_srev >= AR5K_SREV_AR5213A)
		ah->ah_capabilities.cap_has_phyerr_counters = true;
		caps->cap_has_phyerr_counters = true;
	else
	else
		ah->ah_capabilities.cap_has_phyerr_counters = false;
		caps->cap_has_phyerr_counters = false;


	return 0;
	return 0;
}
}