ath: use get_unaligned_le{16, 32} in ath_hw_keysetmac()
PATCH 1/4 ath: use get_unaligned_le{16, 32} in ath_hw_keysetmac()
Signed-off-by Pavel Roskin <[email protected]>
--- drivers/net/wireless/ath/key.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/key.c +2 -5
@@ -105,11 +105,8 @@ static bool ath_hw_keysetmac(struct ath_common *common,if (mac[0 ] &0x01 ) unicast_flag =0 ; - macHi = (mac[5 ] <<8 ) | mac[4 ]; - macLo = (mac[3 ] <<24 ) | - (mac[2 ] <<16 ) | - (mac[1 ] <<8 ) | - mac[0 ]; + macLo =get_unaligned_le32 (mac); + macHi =get_unaligned_le16 (mac +4 ); macLo >>=1 ; macLo |= (macHi &1 ) <<31 ; macHi >>=1 ;
PATCH 2/4 ath9k: use get_unaligned_{b16, le16, le32} where possible
Signed-off-by Pavel Roskin <[email protected]>
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 10 +++++----- drivers/net/wireless/ath/ath9k/eeprom_4k.c | 12 +++++------- drivers/net/wireless/ath/ath9k/eeprom_9287.c | 12 +++++------- drivers/net/wireless/ath/ath9k/eeprom_def.c | 12 +++++------- drivers/net/wireless/ath/ath9k/hif_usb.c | 5 +++-- 5 files changed, 23 insertions(+), 28 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +5 -5
@@ -14,6 +14,7 @@* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <asm/unaligned.h> #include "hw.h" #include "ar9003_phy.h" #include "ar9003_eeprom.h"
@@ -3006,11 +3007,11 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,switch (param) {case EEP_MAC_LSW : -return eep->macAddr[0 ] <<8 | eep->macAddr[1 ]; +return get_unaligned_be16 (eep->macAddr);case EEP_MAC_MID : -return eep->macAddr[2 ] <<8 | eep->macAddr[3 ]; +return get_unaligned_be16 (eep->macAddr +2 );case EEP_MAC_MSW : -return eep->macAddr[4 ] <<8 | eep->macAddr[5 ]; +return get_unaligned_be16 (eep->macAddr +4 );case EEP_REG_0 :return le16_to_cpu (pBase->regDmn[0 ]);case EEP_REG_1 :
@@ -3380,8 +3381,7 @@ found: osize = length;read (ah, cptr, word,COMP_HDR_LEN + osize +COMP_CKSUM_LEN ); checksum =ar9300_comp_cksum (&word[COMP_HDR_LEN ], length); - mchecksum = word[COMP_HDR_LEN + osize] | - (word[COMP_HDR_LEN + osize +1 ] <<8 ); + mchecksum =get_unaligned_le16 (&word[COMP_HDR_LEN + osize]);ath_dbg (common,ATH_DBG_EEPROM ,"checksum %x %x\n" , checksum, mchecksum);if (checksum == mchecksum) {
drivers/net/wireless/ath/ath9k/eeprom_4k.c +5 -7
@@ -14,6 +14,7 @@* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <asm/unaligned.h> #include "hw.h" #include "ar9002_phy.h"
@@ -203,11 +204,11 @@ static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah,case EEP_NFTHRESH_2 :return pModal->noiseFloorThreshCh[0 ];case EEP_MAC_LSW : -return pBase->macAddr[0 ] <<8 | pBase->macAddr[1 ]; +return get_unaligned_be16 (pBase->macAddr);case EEP_MAC_MID : -return pBase->macAddr[2 ] <<8 | pBase->macAddr[3 ]; +return get_unaligned_be16 (pBase->macAddr +2 );case EEP_MAC_MSW : -return pBase->macAddr[4 ] <<8 | pBase->macAddr[5 ]; +return get_unaligned_be16 (pBase->macAddr +4 );case EEP_REG_0 :return pBase->regDmn[0 ];case EEP_REG_1 :
@@ -331,10 +332,7 @@ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah, regOffset =AR_PHY_BASE + (672 <<2 ) + regChainOffset;for (j =0 ; j <32 ; j++) { - reg32 = ((pdadcValues[4 * j +0 ] &0xFF ) <<0 ) | - ((pdadcValues[4 * j +1 ] &0xFF ) <<8 ) | - ((pdadcValues[4 * j +2 ] &0xFF ) <<16 )| - ((pdadcValues[4 * j +3 ] &0xFF ) <<24 ); + reg32 =get_unaligned_le32 (&pdadcValues[4 * j]);REG_WRITE (ah, regOffset, reg32); ath_dbg(common, ATH_DBG_EEPROM,
drivers/net/wireless/ath/ath9k/eeprom_9287.c +5 -7
@@ -14,6 +14,7 @@* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <asm/unaligned.h> #include "hw.h" #include "ar9002_phy.h"
@@ -195,11 +196,11 @@ static u32 ath9k_hw_ar9287_get_eeprom(struct ath_hw *ah,case EEP_NFTHRESH_2 :return pModal->noiseFloorThreshCh[0 ];case EEP_MAC_LSW : -return pBase->macAddr[0 ] <<8 | pBase->macAddr[1 ]; +return get_unaligned_be16 (pBase->macAddr);case EEP_MAC_MID : -return pBase->macAddr[2 ] <<8 | pBase->macAddr[3 ]; +return get_unaligned_be16 (pBase->macAddr +2 );case EEP_MAC_MSW : -return pBase->macAddr[4 ] <<8 | pBase->macAddr[5 ]; +return get_unaligned_be16 (pBase->macAddr +4 );case EEP_REG_0 :return pBase->regDmn[0 ];case EEP_REG_1 :
@@ -434,10 +435,7 @@ static void ath9k_hw_set_ar9287_power_cal_table(struct ath_hw *ah, (672 <<2 ) + regChainOffset;for (j =0 ; j <32 ; j++) { - reg32 = ((pdadcValues[4 *j +0 ] &0xFF ) <<0 ) - | ((pdadcValues[4 *j +1 ] &0xFF ) <<8 ) - | ((pdadcValues[4 *j +2 ] &0xFF ) <<16 ) - | ((pdadcValues[4 *j +3 ] &0xFF ) <<24 ); + reg32 =get_unaligned_le32 (&pdadcValues[4 * j]);REG_WRITE (ah, regOffset, reg32); regOffset +=4 ;
drivers/net/wireless/ath/ath9k/eeprom_def.c +5 -7
@@ -14,6 +14,7 @@* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <asm/unaligned.h> #include "hw.h" #include "ar9002_phy.h"
@@ -276,11 +277,11 @@ static u32 ath9k_hw_def_get_eeprom(struct ath_hw *ah,case EEP_NFTHRESH_2 :return pModal[1 ].noiseFloorThreshCh[0 ];case EEP_MAC_LSW : -return pBase->macAddr[0 ] <<8 | pBase->macAddr[1 ]; +return get_unaligned_be16 (pBase->macAddr);case EEP_MAC_MID : -return pBase->macAddr[2 ] <<8 | pBase->macAddr[3 ]; +return get_unaligned_be16 (pBase->macAddr +2 );case EEP_MAC_MSW : -return pBase->macAddr[4 ] <<8 | pBase->macAddr[5 ]; +return get_unaligned_be16 (pBase->macAddr +4 );case EEP_REG_0 :return pBase->regDmn[0 ];case EEP_REG_1 :
@@ -831,10 +832,7 @@ static void ath9k_hw_set_def_power_cal_table(struct ath_hw *ah, regOffset =AR_PHY_BASE + (672 <<2 ) + regChainOffset;for (j =0 ; j <32 ; j++) { - reg32 = ((pdadcValues[4 * j +0 ] &0xFF ) <<0 ) | - ((pdadcValues[4 * j +1 ] &0xFF ) <<8 ) | - ((pdadcValues[4 * j +2 ] &0xFF ) <<16 )| - ((pdadcValues[4 * j +3 ] &0xFF ) <<24 ); + reg32 =get_unaligned_le32 (&pdadcValues[4 * j]);REG_WRITE (ah, regOffset, reg32); ath_dbg(common, ATH_DBG_EEPROM,
drivers/net/wireless/ath/ath9k/hif_usb.c +3 -2
@@ -14,6 +14,7 @@* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <asm/unaligned.h> #include "htc.h" /* identify firmware images */
@@ -557,8 +558,8 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, ptr = (u8 *) skb->data; - pkt_len = ptr[index] + (ptr[index+1 ] <<8 ); - pkt_tag = ptr[index+2 ] + (ptr[index+3 ] <<8 ); + pkt_len =get_unaligned_le16 (ptr + index); + pkt_tag =get_unaligned_le16 (ptr + index +2 );if (pkt_tag !=ATH_USB_RX_STREAM_MODE_TAG ) {RX_STAT_INC (skb_dropped);
PATCH 3/4 ath9k: remove defines in reg.h that exist in ../reg.h
In reply to Pavel RoskinSigned-off-by Pavel Roskin <[email protected]>
--- drivers/net/wireless/ath/ath9k/reg.h | 23 ----------------------- 1 files changed, 0 insertions(+), 23 deletions(-)
drivers/net/wireless/ath/ath9k/reg.h +0 -23
@@ -1873,29 +1873,6 @@ enum {#define AR_RATE_DURATION (_n) (AR_RATE_DURATION_0 + ((_n)<<2)) -#define AR_KEYTABLE_0 0x8800 -#define AR_KEYTABLE (_n) (AR_KEYTABLE_0 + ((_n)*32)) -#define AR_KEY_CACHE_SIZE 128 -#define AR_RSVD_KEYTABLE_ENTRIES 4 -#define AR_KEY_TYPE 0x00000007 -#define AR_KEYTABLE_TYPE_40 0x00000000 -#define AR_KEYTABLE_TYPE_104 0x00000001 -#define AR_KEYTABLE_TYPE_128 0x00000003 -#define AR_KEYTABLE_TYPE_TKIP 0x00000004 -#define AR_KEYTABLE_TYPE_AES 0x00000005 -#define AR_KEYTABLE_TYPE_CCM 0x00000006 -#define AR_KEYTABLE_TYPE_CLR 0x00000007 -#define AR_KEYTABLE_ANT 0x00000008 -#define AR_KEYTABLE_VALID 0x00008000 -#define AR_KEYTABLE_KEY0 (_n) (AR_KEYTABLE(_n) + 0) -#define AR_KEYTABLE_KEY1 (_n) (AR_KEYTABLE(_n) + 4) -#define AR_KEYTABLE_KEY2 (_n) (AR_KEYTABLE(_n) + 8) -#define AR_KEYTABLE_KEY3 (_n) (AR_KEYTABLE(_n) + 12) -#define AR_KEYTABLE_KEY4 (_n) (AR_KEYTABLE(_n) + 16) -#define AR_KEYTABLE_TYPE (_n) (AR_KEYTABLE(_n) + 20) -#define AR_KEYTABLE_MAC0 (_n) (AR_KEYTABLE(_n) + 24) -#define AR_KEYTABLE_MAC1 (_n) (AR_KEYTABLE(_n) + 28) -#define AR9271_CORE_CLOCK 117/* clock to 117Mhz */ #define AR9271_TARGET_BAUD_RATE 19200/* 115200 */
PATCH 4/4 ath9k: use ath_opmode_to_string()
In reply to Pavel RoskinSigned-off-by Pavel Roskin <[email protected]>
--- drivers/net/wireless/ath/ath9k/debug.c | 22 ++-------------------- 1 files changed, 2 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath9k/debug.c +2 -20
@@ -749,7 +749,6 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,char *buf;unsigned int len =0 , size =8000 ;ssize_t retval =0 ; -const char *tmp;unsigned int reg;struct ath9k_vif_iter_data iter_data;
@@ -759,31 +758,14 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,if (buf ==NULL )return -ENOMEM ; -switch (sc->sc_ah->opmode) { -case NL80211_IFTYPE_ADHOC : - tmp ="ADHOC" ; -break ; -case NL80211_IFTYPE_MESH_POINT : - tmp ="MESH" ; -break ; -case NL80211_IFTYPE_AP : - tmp ="AP" ; -break ; -case NL80211_IFTYPE_STATION : - tmp ="STATION" ; -break ; -default : - tmp ="???" ; -break ; - } -ath9k_ps_wakeup (sc); len +=snprintf (buf + len, size - len,"curbssid: %pM\n" "OP-Mode: %s(%i)\n" "Beacon-Timer-Register: 0x%x\n" , common->curbssid, - tmp, (int )(sc->sc_ah->opmode), +ath_opmode_to_string (sc->sc_ah->opmode), + (int )(sc->sc_ah->opmode),REG_READ (ah,AR_BEACON_PERIOD )); reg =REG_READ (ah,AR_TIMER_MODE );