staging: rtl8723au: rtw_wlan_util.c: Clean up the code
authorJes Sorensen <Jes.Sorensen@redhat.com>
Fri, 9 May 2014 13:03:27 +0000 (15:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 May 2014 20:11:57 +0000 (13:11 -0700)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_wlan_util.c

index 0241a19d5f56df8ce56e8e3441bbbf8605ab70e5..f8e10b1e192c70dc303ed819196b79506fb81d9f 100644 (file)
@@ -34,27 +34,33 @@ static unsigned char EPIGRAM_OUI[] = {0x00, 0x90, 0x4c};
 
 unsigned char REALTEK_96B_IE23A[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20};
 
-#define R2T_PHY_DELAY  (0)
+#define R2T_PHY_DELAY          0
 
-/* define WAIT_FOR_BCN_TO_MIN  (3000) */
-#define WAIT_FOR_BCN_TO_MIN    (6000)
-#define WAIT_FOR_BCN_TO_MAX    (20000)
+/* define WAIT_FOR_BCN_TO_MIN  3000 */
+#define WAIT_FOR_BCN_TO_MIN    6000
+#define WAIT_FOR_BCN_TO_MAX    20000
 
 static u8 rtw_basic_rate_cck[4] = {
-       IEEE80211_CCK_RATE_1MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_CCK_RATE_2MB|IEEE80211_BASIC_RATE_MASK,
-       IEEE80211_CCK_RATE_5MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_CCK_RATE_11MB|IEEE80211_BASIC_RATE_MASK
+       IEEE80211_CCK_RATE_1MB | IEEE80211_BASIC_RATE_MASK,
+       IEEE80211_CCK_RATE_2MB | IEEE80211_BASIC_RATE_MASK,
+       IEEE80211_CCK_RATE_5MB | IEEE80211_BASIC_RATE_MASK,
+       IEEE80211_CCK_RATE_11MB | IEEE80211_BASIC_RATE_MASK
 };
 
 static u8 rtw_basic_rate_ofdm[3] = {
-       IEEE80211_OFDM_RATE_6MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_OFDM_RATE_12MB|IEEE80211_BASIC_RATE_MASK,
-       IEEE80211_OFDM_RATE_24MB|IEEE80211_BASIC_RATE_MASK
+       IEEE80211_OFDM_RATE_6MB | IEEE80211_BASIC_RATE_MASK,
+       IEEE80211_OFDM_RATE_12MB | IEEE80211_BASIC_RATE_MASK,
+       IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
 };
 
 static u8 rtw_basic_rate_mix[7] = {
-       IEEE80211_CCK_RATE_1MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_CCK_RATE_2MB|IEEE80211_BASIC_RATE_MASK,
-       IEEE80211_CCK_RATE_5MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_CCK_RATE_11MB|IEEE80211_BASIC_RATE_MASK,
-       IEEE80211_OFDM_RATE_6MB|IEEE80211_BASIC_RATE_MASK, IEEE80211_OFDM_RATE_12MB|IEEE80211_BASIC_RATE_MASK,
-       IEEE80211_OFDM_RATE_24MB|IEEE80211_BASIC_RATE_MASK
+       IEEE80211_CCK_RATE_1MB | IEEE80211_BASIC_RATE_MASK,
+       IEEE80211_CCK_RATE_2MB | IEEE80211_BASIC_RATE_MASK,
+       IEEE80211_CCK_RATE_5MB | IEEE80211_BASIC_RATE_MASK,
+       IEEE80211_CCK_RATE_11MB | IEEE80211_BASIC_RATE_MASK,
+       IEEE80211_OFDM_RATE_6MB | IEEE80211_BASIC_RATE_MASK,
+       IEEE80211_OFDM_RATE_12MB | IEEE80211_BASIC_RATE_MASK,
+       IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK
 };
 
 int cckrates_included23a(unsigned char *rate, int ratelen)
@@ -62,8 +68,8 @@ int cckrates_included23a(unsigned char *rate, int ratelen)
        int     i;
 
        for (i = 0; i < ratelen; i++) {
-               if  ((((rate[i]) & 0x7f) == 2)  || (((rate[i]) & 0x7f) == 4) ||
-                    (((rate[i]) & 0x7f) == 11)  || (((rate[i]) & 0x7f) == 22))
+               if  (((rate[i]) & 0x7f) == 2 || ((rate[i]) & 0x7f) == 4 ||
+                    ((rate[i]) & 0x7f) == 11  || ((rate[i]) & 0x7f) == 22)
                        return true;
        }
 
@@ -75,8 +81,8 @@ int cckratesonly_included23a(unsigned char *rate, int ratelen)
        int     i;
 
        for (i = 0; i < ratelen; i++) {
-               if  ((((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) &&
-                          (((rate[i]) & 0x7f) != 11)  && (((rate[i]) & 0x7f) != 22))
+               if  (((rate[i]) & 0x7f) != 2 && ((rate[i]) & 0x7f) != 4 &&
+                    ((rate[i]) & 0x7f) != 11 && ((rate[i]) & 0x7f) != 22)
                return false;
        }
 
@@ -116,10 +122,11 @@ unsigned char networktype_to_raid23a(unsigned char network_type)
        return raid;
 }
 
-u8 judge_network_type23a(struct rtw_adapter *padapter, unsigned char *rate, int ratelen)
+u8 judge_network_type23a(struct rtw_adapter *padapter,
+                        unsigned char *rate, int ratelen)
 {
        u8 network_type = 0;
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
        if (pmlmeext->cur_channel > 14) {
@@ -194,7 +201,7 @@ static int is_basicrate(struct rtw_adapter *padapter, unsigned char rate)
        for (i = 0; i < NumRates; i++) {
                val = pmlmeext->basicrate[i];
 
-               if ((val != 0xff) && (val != 0xfe)) {
+               if (val != 0xff && val != 0xfe) {
                        if (rate == ratetbl_val_2wifirate(val))
                                return true;
                }
@@ -208,7 +215,7 @@ static unsigned int ratetbl2rateset(struct rtw_adapter *padapter,
 {
        int i;
        unsigned char rate;
-       unsigned int    len = 0;
+       unsigned int len = 0;
        struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
 
        for (i = 0; i < NumRates; i++) {
@@ -233,7 +240,8 @@ static unsigned int ratetbl2rateset(struct rtw_adapter *padapter,
        return len;
 }
 
-void get_rate_set23a(struct rtw_adapter *padapter, unsigned char *pbssrate, int *bssrate_len)
+void get_rate_set23a(struct rtw_adapter *padapter,
+                    unsigned char *pbssrate, int *bssrate_len)
 {
        unsigned char supportedrates[NumRates];
 
@@ -244,8 +252,8 @@ void get_rate_set23a(struct rtw_adapter *padapter, unsigned char *pbssrate, int
 
 void UpdateBrateTbl23a(struct rtw_adapter *Adapter, u8 *mBratesOS)
 {
-       u8      i;
-       u8      rate;
+       u8 i;
+       u8 rate;
 
        /*  1M, 2M, 5.5M, 11M, 6M, 12M, 24M are mandatory. */
        for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) {
@@ -268,8 +276,8 @@ void UpdateBrateTbl23a(struct rtw_adapter *Adapter, u8 *mBratesOS)
 
 void Update23aTblForSoftAP(u8 *bssrateset, u32 bssratelen)
 {
-       u8      i;
-       u8      rate;
+       u8 i;
+       u8 rate;
 
        for (i = 0; i < bssratelen; i++) {
                rate = bssrateset[i] & 0x7f;
@@ -351,10 +359,11 @@ void set_channel_bwmode23a(struct rtw_adapter *padapter, unsigned char channel,
        u8 center_ch;
 
        if (padapter->bNotifyChannelChange)
-               DBG_8723A("[%s] ch = %d, offset = %d, bwmode = %d\n", __func__, channel, channel_offset, bwmode);
+               DBG_8723A("[%s] ch = %d, offset = %d, bwmode = %d\n",
+                         __func__, channel, channel_offset, bwmode);
 
-       if ((bwmode == HT_CHANNEL_WIDTH_20) ||
-           (channel_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE)) {
+       if (bwmode == HT_CHANNEL_WIDTH_20 ||
+           channel_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE) {
                /* SelectChannel23a(padapter, channel); */
                center_ch = channel;
        } else {
@@ -400,15 +409,15 @@ inline u8 *get_my_bssid23a(struct wlan_bssid_ex *pnetwork)
 u16 get_beacon_interval23a(struct wlan_bssid_ex *bss)
 {
        unsigned short val;
-       memcpy((unsigned char *)&val, rtw_get_beacon_interval23a_from_ie(bss->IEs), 2);
+       memcpy(&val, rtw_get_beacon_interval23a_from_ie(bss->IEs), 2);
 
        return le16_to_cpu(val);
 }
 
 int is_client_associated_to_ap23a(struct rtw_adapter *padapter)
 {
-       struct mlme_ext_priv    *pmlmeext;
-       struct mlme_ext_info    *pmlmeinfo;
+       struct mlme_ext_priv *pmlmeext;
+       struct mlme_ext_info *pmlmeinfo;
 
        if (!padapter)
                return _FAIL;
@@ -416,7 +425,8 @@ int is_client_associated_to_ap23a(struct rtw_adapter *padapter)
        pmlmeext = &padapter->mlmeextpriv;
        pmlmeinfo = &pmlmeext->mlmext_info;
 
-       if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE))
+       if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS &&
+           (pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE)
                return true;
        else
                return _FAIL;
@@ -424,11 +434,11 @@ int is_client_associated_to_ap23a(struct rtw_adapter *padapter)
 
 int is_client_associated_to_ibss23a(struct rtw_adapter *padapter)
 {
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
-       if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) &&
-           ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE))
+       if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS &&
+           (pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE)
                return true;
        else
                return _FAIL;
@@ -437,7 +447,7 @@ int is_client_associated_to_ibss23a(struct rtw_adapter *padapter)
 int is_IBSS_empty23a(struct rtw_adapter *padapter)
 {
        unsigned int i;
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
        for (i = IBSS_START_MAC_ID; i < NUM_STA; i++) {
@@ -467,7 +477,9 @@ void clear_cam_entry23a(struct rtw_adapter *padapter, u8 entry)
 {
        unsigned char null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
-       unsigned char null_key[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+       unsigned char null_key[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                   0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                   0x00, 0x00, 0x00, 0x00};
 
        rtl8723a_cam_write(padapter, entry, 0, null_sta, null_key);
 }
@@ -475,7 +487,7 @@ void clear_cam_entry23a(struct rtw_adapter *padapter, u8 entry)
 int allocate_fw_sta_entry23a(struct rtw_adapter *padapter)
 {
        unsigned int mac_id;
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
        for (mac_id = IBSS_START_MAC_ID; mac_id < NUM_STA; mac_id++) {
@@ -491,19 +503,20 @@ int allocate_fw_sta_entry23a(struct rtw_adapter *padapter)
 
 void flush_all_cam_entry23a(struct rtw_adapter *padapter)
 {
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
        rtl8723a_cam_invalid_all(padapter);
 
-       memset((u8 *)(pmlmeinfo->FW_sta_info), 0, sizeof(pmlmeinfo->FW_sta_info));
+       memset(pmlmeinfo->FW_sta_info, 0, sizeof(pmlmeinfo->FW_sta_info));
 }
 
-int WMM_param_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies *    pIE)
+int WMM_param_handler23a(struct rtw_adapter *padapter,
+                        struct ndis_802_11_var_ies *pIE)
 {
        /* struct registry_priv *pregpriv = &padapter->registrypriv; */
        struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
        if (pmlmepriv->qos_option == 0) {
@@ -519,15 +532,15 @@ int WMM_param_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ie
 
 void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
 {
-       u8      ACI, ACM, AIFS, ECWMin, ECWMax, aSifsTime;
-       u8      acm_mask;
-       u16     TXOP;
-       u32     acParm, i;
-       u32     edca[4], inx[4];
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       u8 ACI, ACM, AIFS, ECWMin, ECWMax, aSifsTime;
+       u8 acm_mask;
+       u16 TXOP;
+       u32 acParm, i;
+       u32 edca[4], inx[4];
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
-       struct xmit_priv                *pxmitpriv = &padapter->xmitpriv;
-       struct registry_priv    *pregpriv = &padapter->registrypriv;
+       struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+       struct registry_priv *pregpriv = &padapter->registrypriv;
 
        if (pmlmeinfo->WMM_enable == 0) {
                padapter->mlmepriv.acm_mask = 0;
@@ -546,9 +559,10 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
                ACM = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 4) & 0x01;
 
                /* AIFS = AIFSN * slot time + SIFS - r2t phy delay */
-               AIFS = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN & 0x0f) * pmlmeinfo->slotTime + aSifsTime;
+               AIFS = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN & 0x0f) *
+                       pmlmeinfo->slotTime + aSifsTime;
 
-               ECWMin = (pmlmeinfo->WMM_param.ac_param[i].CW & 0x0f);
+               ECWMin = pmlmeinfo->WMM_param.ac_param[i].CW & 0x0f;
                ECWMax = (pmlmeinfo->WMM_param.ac_param[i].CW & 0xf0) >> 4;
                TXOP = le16_to_cpu(pmlmeinfo->WMM_param.ac_param[i].TXOP_limit);
 
@@ -588,7 +602,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
        inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3;
 
        if (pregpriv->wifi_spec == 1) {
-               u32     j, tmp, change_inx = false;
+               u32 j, tmp, change_inx = false;
 
                /* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */
                for (i = 0; i < 4; i++) {
@@ -596,7 +610,8 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
                                /* compare CW and AIFS */
                                if ((edca[j] & 0xFFFF) < (edca[i] & 0xFFFF)) {
                                        change_inx = true;
-                               } else if ((edca[j] & 0xFFFF) == (edca[i] & 0xFFFF)) {
+                               } else if ((edca[j] & 0xFFFF) ==
+                                          (edca[i] & 0xFFFF)) {
                                        /* compare TXOP */
                                        if ((edca[j] >> 16) > (edca[i] >> 16))
                                                change_inx = true;
@@ -619,22 +634,24 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
 
        for (i = 0; i<4; i++) {
                pxmitpriv->wmm_para_seq[i] = inx[i];
-               DBG_8723A("wmm_para_seq(%d): %d\n", i, pxmitpriv->wmm_para_seq[i]);
+               DBG_8723A("wmm_para_seq(%d): %d\n", i,
+                         pxmitpriv->wmm_para_seq[i]);
        }
 
        return;
 }
 
-static void bwmode_update_check(struct rtw_adapter *padapter, struct ndis_802_11_var_ies * pIE)
+static void bwmode_update_check(struct rtw_adapter *padapter,
+                               struct ndis_802_11_var_ies *pIE)
 {
-       struct HT_info_element   *pHT_info;
+       struct HT_info_element *pHT_info;
        struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
        struct registry_priv *pregistrypriv = &padapter->registrypriv;
-       struct ht_priv  *phtpriv = &pmlmepriv->htpriv;
-       unsigned char    new_bwmode;
-       unsigned char  new_ch_offset;
+       struct ht_priv *phtpriv = &pmlmepriv->htpriv;
+       unsigned char new_bwmode;
+       unsigned char new_ch_offset;
 
        if (!pIE)
                return;
@@ -664,8 +681,8 @@ static void bwmode_update_check(struct rtw_adapter *padapter, struct ndis_802_11
                new_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
        }
 
-       if ((new_bwmode!= pmlmeext->cur_bwmode) ||
-           (new_ch_offset!= pmlmeext->cur_ch_offset)) {
+       if (new_bwmode != pmlmeext->cur_bwmode ||
+           new_ch_offset != pmlmeext->cur_ch_offset) {
                pmlmeinfo->bwmode_updated = true;
 
                pmlmeext->cur_bwmode = new_bwmode;
@@ -673,52 +690,56 @@ static void bwmode_update_check(struct rtw_adapter *padapter, struct ndis_802_11
 
                /* update HT info also */
                HT_info_handler23a(padapter, pIE);
-       } else {
+       } else
                pmlmeinfo->bwmode_updated = false;
-       }
 
        if (pmlmeinfo->bwmode_updated) {
                struct sta_info *psta;
                struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
                struct sta_priv *pstapriv = &padapter->stapriv;
 
-               /* set_channel_bwmode23a(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
+               /* set_channel_bwmode23a(padapter, pmlmeext->cur_channel,
+                  pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
 
                /* update ap's stainfo */
                psta = rtw_get_stainfo23a(pstapriv, cur_network->MacAddress);
                if (psta) {
-                       struct ht_priv  *phtpriv_sta = &psta->htpriv;
+                       struct ht_priv *phtpriv_sta = &psta->htpriv;
 
                        if (phtpriv_sta->ht_option) {
                                /*  bwmode */
                                phtpriv_sta->bwmode = pmlmeext->cur_bwmode;
-                               phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset;
+                               phtpriv_sta->ch_offset =
+                                       pmlmeext->cur_ch_offset;
                        } else {
                                phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_20;
-                               phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+                               phtpriv_sta->ch_offset =
+                                       HAL_PRIME_CHNL_OFFSET_DONT_CARE;
                        }
-
                }
        }
 }
 
-void HT_caps_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies * pIE)
+void HT_caps_handler23a(struct rtw_adapter *padapter,
+                       struct ndis_802_11_var_ies * pIE)
 {
-       unsigned int    i;
-       u8      rf_type;
-       u8      max_AMPDU_len, min_MPDU_spacing;
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       unsigned int i;
+       u8 rf_type;
+       u8 max_AMPDU_len, min_MPDU_spacing;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
-       struct mlme_priv                *pmlmepriv = &padapter->mlmepriv;
-       struct ht_priv                  *phtpriv = &pmlmepriv->htpriv;
+       struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+       struct ht_priv *phtpriv = &pmlmepriv->htpriv;
 
-       if (pIE == NULL) return;
+       if (!pIE)
+               return;
 
-       if (phtpriv->ht_option == false)        return;
+       if (phtpriv->ht_option == false)
+               return;
 
        pmlmeinfo->HT_caps_enable = 1;
 
-       for (i = 0; i < (pIE->Length); i++) {
+       for (i = 0; i < pIE->Length; i++) {
                if (i != 2) {
                        /*      Commented by Albert 2010/07/12 */
                        /*      Got the endian issue here. */
@@ -726,12 +747,12 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies
                } else {
                        /* modify from  fw by Thomas 2010/11/17 */
                        if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (pIE->data[i] & 0x3))
-                               max_AMPDU_len = (pIE->data[i] & 0x3);
+                               max_AMPDU_len = pIE->data[i] & 0x3;
                        else
-                               max_AMPDU_len = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3);
+                               max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3;
 
                        if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) > (pIE->data[i] & 0x1c))
-                               min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c);
+                               min_MPDU_spacing = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c;
                        else
                                min_MPDU_spacing = (pIE->data[i] & 0x1c);
 
@@ -742,31 +763,38 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies
        /*      Commented by Albert 2010/07/12 */
        /*      Have to handle the endian issue after copying. */
        /*      HT_ext_caps didn't be used yet. */
-       pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info = le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info);
-       pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps = le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps);
+       pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info =
+               le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info);
+       pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps =
+               le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps);
 
        rf_type = rtl8723a_get_rf_type(padapter);
 
        /* update the MCS rates */
        for (i = 0; i < 16; i++) {
-               if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R))
-                       pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R23A[i];
+               if (rf_type == RF_1T1R || rf_type == RF_1T2R)
+                       pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &=
+                               MCS_rate_1R23A[i];
                else
-                       pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R23A[i];
+                       pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &=
+                               MCS_rate_2R23A[i];
        }
        return;
 }
 
-void HT_info_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies * pIE)
+void HT_info_handler23a(struct rtw_adapter *padapter,
+                       struct ndis_802_11_var_ies *pIE)
 {
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
-       struct mlme_priv                *pmlmepriv = &padapter->mlmepriv;
-       struct ht_priv                  *phtpriv = &pmlmepriv->htpriv;
+       struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
+       struct ht_priv *phtpriv = &pmlmepriv->htpriv;
 
-       if (pIE == NULL) return;
+       if (!pIE)
+               return;
 
-       if (phtpriv->ht_option == false)        return;
+       if (phtpriv->ht_option == false)
+               return;
 
        if (pIE->Length > sizeof(struct HT_info_element))
                return;
@@ -778,19 +806,20 @@ void HT_info_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies
 
 void HTOnAssocRsp23a(struct rtw_adapter *padapter)
 {
-       unsigned char           max_AMPDU_len;
-       unsigned char           min_MPDU_spacing;
+       unsigned char max_AMPDU_len;
+       unsigned char min_MPDU_spacing;
        /* struct registry_priv  *pregpriv = &padapter->registrypriv; */
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
        DBG_8723A("%s\n", __func__);
 
-       if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable)) {
+       if (pmlmeinfo->HT_info_enable && pmlmeinfo->HT_caps_enable)
                pmlmeinfo->HT_enable = 1;
-       else {
+       else {
                pmlmeinfo->HT_enable = 0;
-               /* set_channel_bwmode23a(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
+               /* set_channel_bwmode23a(padapter, pmlmeext->cur_channel,
+                  pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
                return;
        }
 
@@ -801,18 +830,20 @@ void HTOnAssocRsp23a(struct rtw_adapter *padapter)
        */
        max_AMPDU_len = pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x03;
 
-       min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2;
+       min_MPDU_spacing =
+               (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2;
 
        rtl8723a_set_ampdu_min_space(padapter, min_MPDU_spacing);
        rtl8723a_set_ampdu_factor(padapter, max_AMPDU_len);
 }
 
-void ERP_IE_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies * pIE)
+void ERP_IE_handler23a(struct rtw_adapter *padapter,
+                      struct ndis_802_11_var_ies *pIE)
 {
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
-       if (pIE->Length>1)
+       if (pIE->Length > 1)
                return;
 
        pmlmeinfo->ERP_enable = 1;
@@ -821,8 +852,8 @@ void ERP_IE_handler23a(struct rtw_adapter *padapter, struct ndis_802_11_var_ies
 
 void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta)
 {
-       struct registry_priv     *pregpriv = &padapter->registrypriv;
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct registry_priv *pregpriv = &padapter->registrypriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
        switch (pregpriv->vrtl_carrier_sense) { /* 0:off 1:on 2:auto */
@@ -841,7 +872,7 @@ void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta)
                break;
        case 2: /* auto */
        default:
-               if ((pmlmeinfo->ERP_enable) && (pmlmeinfo->ERP_IE & BIT(1))) {
+               if (pmlmeinfo->ERP_enable && pmlmeinfo->ERP_IE & BIT(1)) {
                        if (pregpriv->vcs_type == 1) {
                                psta->rtsen = 1;
                                psta->cts2self = 0;
@@ -1137,22 +1168,27 @@ void update_beacon23a_info(struct rtw_adapter *padapter, u8 *pframe, uint pkt_le
 unsigned int is_ap_in_tkip23a(struct rtw_adapter *padapter)
 {
        u32 i;
-       struct ndis_802_11_var_ies *    pIE;
+       struct ndis_802_11_var_ies *pIE;
        struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
        struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
 
        if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
-               for (i = sizeof(struct ndis_802_11_fixed_ies); i < pmlmeinfo->network.IELength;) {
-                       pIE = (struct ndis_802_11_var_ies *)(pmlmeinfo->network.IEs + i);
+               for (i = sizeof(struct ndis_802_11_fixed_ies);
+                    i < pmlmeinfo->network.IELength;) {
+                       pIE = (struct ndis_802_11_var_ies *)
+                               (pmlmeinfo->network.IEs + i);
 
                        switch (pIE->ElementID) {
                        case WLAN_EID_VENDOR_SPECIFIC:
-                               if ((!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4)) && (!memcmp((pIE->data + 12), WPA_TKIP_CIPHER23A, 4)))
+                               if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4)&&
+                                   !memcmp((pIE->data + 12),
+                                           WPA_TKIP_CIPHER23A, 4))
                                        return true;
                                break;
                        case WLAN_EID_RSN:
-                               if (!memcmp((pIE->data + 8), RSN_TKIP_CIPHER23A, 4))
+                               if (!memcmp(pIE->data + 8, RSN_TKIP_CIPHER23A,
+                                           4))
                                        return true;
                                break;
                        default:
@@ -1161,32 +1197,37 @@ unsigned int is_ap_in_tkip23a(struct rtw_adapter *padapter)
                        i += (pIE->Length + 2);
                }
                return false;
-       } else {
+       } else
                return false;
-       }
 }
 
 unsigned int should_forbid_n_rate23a(struct rtw_adapter * padapter)
 {
        u32 i;
-       struct ndis_802_11_var_ies *    pIE;
-       struct mlme_priv        *pmlmepriv = &padapter->mlmepriv;
+       struct ndis_802_11_var_ies *pIE;
+       struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
        struct wlan_bssid_ex  *cur_network = &pmlmepriv->cur_network.network;
 
        if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
-               for (i = sizeof(struct ndis_802_11_fixed_ies); i < cur_network->IELength;) {
-                       pIE = (struct ndis_802_11_var_ies *)(cur_network->IEs + i);
+               for (i = sizeof(struct ndis_802_11_fixed_ies);
+                    i < cur_network->IELength;) {
+                       pIE = (struct ndis_802_11_var_ies *)
+                               (cur_network->IEs + i);
 
                        switch (pIE->ElementID) {
                        case WLAN_EID_VENDOR_SPECIFIC:
-                               if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4) &&
-                                       ((!memcmp((pIE->data + 12), WPA_CIPHER_SUITE_CCMP23A, 4)) ||
-                                         (!memcmp((pIE->data + 16), WPA_CIPHER_SUITE_CCMP23A, 4))))
+                               if (!memcmp(pIE->data, RTW_WPA_OUI23A_TYPE, 4)&&
+                                   (!memcmp(pIE->data + 12,
+                                            WPA_CIPHER_SUITE_CCMP23A, 4) ||
+                                    !memcmp(pIE->data + 16,
+                                            WPA_CIPHER_SUITE_CCMP23A, 4)))
                                        return false;
                                break;
                        case WLAN_EID_RSN:
-                               if  ((!memcmp((pIE->data + 8), RSN_CIPHER_SUITE_CCMP23A, 4))  ||
-                                      (!memcmp((pIE->data + 12), RSN_CIPHER_SUITE_CCMP23A, 4)))
+                               if (!memcmp(pIE->data + 8,
+                                           RSN_CIPHER_SUITE_CCMP23A, 4) ||
+                                   !memcmp(pIE->data + 12,
+                                           RSN_CIPHER_SUITE_CCMP23A, 4))
                                return false;
                        default:
                                break;
@@ -1203,14 +1244,16 @@ unsigned int should_forbid_n_rate23a(struct rtw_adapter * padapter)
 unsigned int is_ap_in_wep23a(struct rtw_adapter *padapter)
 {
        u32 i;
-       struct ndis_802_11_var_ies *    pIE;
+       struct ndis_802_11_var_ies *pIE;
        struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
        struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
 
        if (rtw_get_capability23a(cur_network) & WLAN_CAPABILITY_PRIVACY) {
-               for (i = sizeof(struct ndis_802_11_fixed_ies); i < pmlmeinfo->network.IELength;) {
-                       pIE = (struct ndis_802_11_var_ies *)(pmlmeinfo->network.IEs + i);
+               for (i = sizeof(struct ndis_802_11_fixed_ies);
+                    i < pmlmeinfo->network.IELength;) {
+                       pIE = (struct ndis_802_11_var_ies *)
+                               (pmlmeinfo->network.IEs + i);
 
                        switch (pIE->ElementID) {
                        case WLAN_EID_VENDOR_SPECIFIC:
@@ -1228,14 +1271,13 @@ unsigned int is_ap_in_wep23a(struct rtw_adapter *padapter)
                }
 
                return true;
-       } else {
+       } else
                return false;
-       }
 }
 
 static int wifirate2_ratetbl_inx23a(unsigned char rate)
 {
-       int     inx = 0;
+       int inx = 0;
        rate = rate & 0x7f;
 
        switch (rate) {
@@ -1298,7 +1340,7 @@ unsigned int update_supported_rate23a(unsigned char *ptn, unsigned int ptn_sz)
        unsigned int i, num_of_rate;
        unsigned int mask = 0;
 
-       num_of_rate = (ptn_sz > NumRates)? NumRates: ptn_sz;
+       num_of_rate = (ptn_sz > NumRates) ? NumRates : ptn_sz;
 
        for (i = 0; i < num_of_rate; i++)
                mask |= 0x1 << wifirate2_ratetbl_inx23a(*(ptn + i));
@@ -1309,21 +1351,22 @@ unsigned int update_MSC_rate23a(struct HT_caps_element *pHT_caps)
 {
        unsigned int mask = 0;
 
-       mask = ((pHT_caps->u.HT_cap_element.MCS_rate[0] << 12) | (pHT_caps->u.HT_cap_element.MCS_rate[1] << 20));
+       mask = pHT_caps->u.HT_cap_element.MCS_rate[0] << 12 |
+               pHT_caps->u.HT_cap_element.MCS_rate[1] << 20;
 
        return mask;
 }
 
 int support_short_GI23a(struct rtw_adapter *padapter,
-                    struct HT_caps_element *pHT_caps)
+                       struct HT_caps_element *pHT_caps)
 {
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
        unsigned char bit_offset;
 
-       if (!(pmlmeinfo->HT_enable))
+       if (!pmlmeinfo->HT_enable)
                return _FAIL;
-       if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK))
+       if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK)
                return _FAIL;
        bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40)? 6: 5;
 
@@ -1389,10 +1432,10 @@ void update_tx_basic_rate23a(struct rtw_adapter *padapter, u8 wirelessmode)
 
 unsigned char check_assoc_AP23a(u8 *pframe, uint len)
 {
-       unsigned int    i;
-       struct ndis_802_11_var_ies *    pIE;
-       u8      epigram_vendor_flag;
-       u8      ralink_vendor_flag;
+       unsigned int i;
+       struct ndis_802_11_var_ies *pIE;
+       u8 epigram_vendor_flag;
+       u8 ralink_vendor_flag;
        epigram_vendor_flag = 0;
        ralink_vendor_flag = 0;
 
@@ -1401,11 +1444,11 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len)
 
                switch (pIE->ElementID) {
                case WLAN_EID_VENDOR_SPECIFIC:
-                       if ((!memcmp(pIE->data, ARTHEROS_OUI1, 3)) ||
-                           (!memcmp(pIE->data, ARTHEROS_OUI2, 3))) {
+                       if (!memcmp(pIE->data, ARTHEROS_OUI1, 3) ||
+                           !memcmp(pIE->data, ARTHEROS_OUI2, 3)) {
                                DBG_8723A("link to Artheros AP\n");
                                return HT_IOT_PEER_ATHEROS;
-                       } else if ((!memcmp(pIE->data, BROADCOM_OUI1, 3)) ||
+                       } else if (!memcmp(pIE->data, BROADCOM_OUI1, 3) ||
                                   !memcmp(pIE->data, BROADCOM_OUI2, 3) ||
                                   !memcmp(pIE->data, BROADCOM_OUI2, 3)) {
                                DBG_8723A("link to Broadcom AP\n");
@@ -1414,9 +1457,9 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len)
                                DBG_8723A("link to Marvell AP\n");
                                return HT_IOT_PEER_MARVELL;
                        } else if (!memcmp(pIE->data, RALINK_OUI, 3)) {
-                               if (!ralink_vendor_flag) {
+                               if (!ralink_vendor_flag)
                                        ralink_vendor_flag = 1;
-                               else {
+                               else {
                                        DBG_8723A("link to Ralink AP\n");
                                        return HT_IOT_PEER_RALINK;
                                }
@@ -1434,12 +1477,10 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len)
                                if (ralink_vendor_flag) {
                                        DBG_8723A("link to Tenda W311R AP\n");
                                        return HT_IOT_PEER_TENDA;
-                               } else {
+                               } else
                                        DBG_8723A("Capture EPIGRAM_OUI\n");
-                               }
-                       } else {
+                       } else
                                break;
-                       }
                default:
                        break;
                }
@@ -1461,7 +1502,7 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len)
 
 void update_IOT_info23a(struct rtw_adapter *padapter)
 {
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
        switch (pmlmeinfo->assoc_AP_vendor) {
@@ -1492,7 +1533,7 @@ void update_IOT_info23a(struct rtw_adapter *padapter)
 
 void update_capinfo23a(struct rtw_adapter *Adapter, u16 updateCap)
 {
-       struct mlme_ext_priv    *pmlmeext = &Adapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
        if (updateCap & cShortPreamble) {
@@ -1514,15 +1555,18 @@ void update_capinfo23a(struct rtw_adapter *Adapter, u16 updateCap)
                pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME;
        } else {
                /* Filen: See 802.11-2007 p.90 */
-               if (pmlmeext->cur_wireless_mode & (WIRELESS_11G | WIRELESS_11_24N)) {
+               if (pmlmeext->cur_wireless_mode &
+                   (WIRELESS_11G | WIRELESS_11_24N)) {
                        if (updateCap & cShortSlotTime) { /*  Short Slot Time */
                                if (pmlmeinfo->slotTime != SHORT_SLOT_TIME)
                                        pmlmeinfo->slotTime = SHORT_SLOT_TIME;
                        } else { /*  Long Slot Time */
                                if (pmlmeinfo->slotTime != NON_SHORT_SLOT_TIME)
-                                       pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME;
+                                       pmlmeinfo->slotTime =
+                                               NON_SHORT_SLOT_TIME;
                        }
-               } else if (pmlmeext->cur_wireless_mode & (WIRELESS_11A | WIRELESS_11_5N)) {
+               } else if (pmlmeext->cur_wireless_mode &
+                          (WIRELESS_11A | WIRELESS_11_5N)) {
                        pmlmeinfo->slotTime = SHORT_SLOT_TIME;
                } else {
                        /* B Mode */
@@ -1535,10 +1579,10 @@ void update_capinfo23a(struct rtw_adapter *Adapter, u16 updateCap)
 void update_wireless_mode23a(struct rtw_adapter *padapter)
 {
        int ratelen, network_type = 0;
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
        struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
-       unsigned char                   *rate = cur_network->SupportedRates;
+       unsigned char *rate = cur_network->SupportedRates;
 
        ratelen = rtw_get_rateset_len23a(cur_network->SupportedRates);
 
@@ -1553,15 +1597,16 @@ void update_wireless_mode23a(struct rtw_adapter *padapter)
                if (pmlmeinfo->HT_enable)
                        network_type = WIRELESS_11_24N;
 
-               if ((cckratesonly_included23a(rate, ratelen)) == true)
+               if (cckratesonly_included23a(rate, ratelen) == true)
                        network_type |= WIRELESS_11B;
-               else if ((cckrates_included23a(rate, ratelen)) == true)
+               else if (cckrates_included23a(rate, ratelen) == true)
                        network_type |= WIRELESS_11BG;
                else
                        network_type |= WIRELESS_11G;
        }
 
-       pmlmeext->cur_wireless_mode = network_type & padapter->registrypriv.wireless_mode;
+       pmlmeext->cur_wireless_mode =
+               network_type & padapter->registrypriv.wireless_mode;
 
        /* 0x0808 -> for CCK, 0x0a0a -> for OFDM */
        /* change this value if having IOT issues. */
@@ -1583,7 +1628,7 @@ void update_bmc_sta_support_rate23a(struct rtw_adapter *padapter, u32 mac_id)
                memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates),
                       rtw_basic_rate_cck, 4);
        } else {
-               memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates),
+               memcpy(pmlmeinfo->FW_sta_info[mac_id].SupportedRates,
                       rtw_basic_rate_ofdm, 3);
        }
 }
@@ -1610,14 +1655,15 @@ int update_sta_support_rate23a(struct rtw_adapter *padapter, u8 *pvar_ie,
        return _SUCCESS;
 }
 
-void process_addba_req23a(struct rtw_adapter *padapter, u8 *paddba_req, u8 *addr)
+void process_addba_req23a(struct rtw_adapter *padapter,
+                         u8 *paddba_req, u8 *addr)
 {
        struct sta_info *psta;
        u16 tid, start_seq, param;
        struct recv_reorder_ctrl *preorder_ctrl;
        struct sta_priv *pstapriv = &padapter->stapriv;
-       struct ADDBA_request    *preq = (struct ADDBA_request*)paddba_req;
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
+       struct ADDBA_request *preq = (struct ADDBA_request*)paddba_req;
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
 
        psta = rtw_get_stainfo23a(pstapriv, addr);
@@ -1626,13 +1672,14 @@ void process_addba_req23a(struct rtw_adapter *padapter, u8 *paddba_req, u8 *addr
                start_seq = le16_to_cpu(preq->BA_starting_seqctrl) >> 4;
 
                param = le16_to_cpu(preq->BA_para_set);
-               tid = (param>>2)&0x0f;
+               tid = (param >> 2) & 0x0f;
 
                preorder_ctrl = &psta->recvreorder_ctrl[tid];
 
                preorder_ctrl->indicate_seq = 0xffff;
 
-               preorder_ctrl->enable = (pmlmeinfo->bAcceptAddbaReq == true)? true :false;
+               preorder_ctrl->enable = (pmlmeinfo->bAcceptAddbaReq == true) ?
+                       true : false;
        }
 }
 
@@ -1650,16 +1697,18 @@ int rtw_handle_dualmac23a(struct rtw_adapter *adapter, bool init)
        if (init) {
                if (pbuddy_padapter == NULL) {
                        pbuddy_padapter = adapter;
-                       DBG_8723A("%s(): pbuddy_padapter == NULL, Set pbuddy_padapter\n", __func__);
+                       DBG_8723A("%s(): pbuddy_padapter == NULL, "
+                                 "Set pbuddy_padapter\n", __func__);
                } else {
                        adapter->pbuddy_adapter = pbuddy_padapter;
                        pbuddy_padapter->pbuddy_adapter = adapter;
                        /*  clear global value */
                        pbuddy_padapter = NULL;
-                       DBG_8723A("%s(): pbuddy_padapter exist, Exchange Information\n", __func__);
+                       DBG_8723A("%s(): pbuddy_padapter exist, "
+                                 "Exchange Information\n", __func__);
                }
-         } else {
+       } else
                pbuddy_padapter = NULL;
-       }
+
        return status;
 }