From 6ead3e77dc64c61ef4b8904d404bb0c0f57af4ec Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Sat, 15 Aug 2015 13:02:34 -0500 Subject: [PATCH] rtl8188eu: Change all "if(" to "if (" Signed-off-by: Larry Finger --- core/rtw_ap.c | 216 +++++++------- core/rtw_br_ext.c | 124 ++++---- core/rtw_cmd.c | 226 +++++++------- core/rtw_debug.c | 82 +++--- core/rtw_efuse.c | 36 +-- core/rtw_ieee80211.c | 174 +++++------ core/rtw_io.c | 8 +- core/rtw_ioctl_set.c | 128 ++++---- core/rtw_iol.c | 18 +- core/rtw_led.c | 528 ++++++++++++++++----------------- core/rtw_mlme.c | 310 +++++++++---------- core/rtw_mlme_ext.c | 588 ++++++++++++++++++------------------- core/rtw_p2p.c | 146 ++++----- core/rtw_pwrctrl.c | 98 +++---- core/rtw_recv.c | 290 +++++++++--------- core/rtw_security.c | 92 +++--- core/rtw_sreset.c | 14 +- core/rtw_sta_mgt.c | 26 +- core/rtw_wlan_util.c | 102 +++---- core/rtw_xmit.c | 262 ++++++++--------- hal/Hal8188ERateAdaptive.c | 76 ++--- hal/HalPhyRf.c | 4 +- hal/HalPhyRf_8188e.c | 192 ++++++------ hal/hal_com.c | 38 +-- hal/hal_intf.c | 114 +++---- hal/odm.c | 492 +++++++++++++++---------------- hal/odm_HWConfig.c | 176 +++++------ hal/odm_RTL8188E.c | 68 ++--- hal/odm_RegConfig8188E.c | 2 +- hal/odm_debug.h | 20 +- hal/rtl8188e_cmd.c | 60 ++-- hal/rtl8188e_dm.c | 30 +- hal/rtl8188e_hal_init.c | 386 ++++++++++++------------ hal/rtl8188e_phycfg.c | 170 +++++------ hal/rtl8188e_rf6052.c | 60 ++-- hal/rtl8188e_rxdesc.c | 18 +- hal/rtl8188e_sreset.c | 12 +- hal/rtl8188e_xmit.c | 12 +- hal/rtl8188eu_led.c | 6 +- hal/rtl8188eu_recv.c | 18 +- hal/rtl8188eu_xmit.c | 60 ++-- hal/usb_halinit.c | 216 +++++++------- include/Hal8188EPhyCfg.h | 4 +- include/HalPwrSeqCmd.h | 2 +- include/rtw_ioctl.h | 2 +- include/rtw_led.h | 2 +- include/rtw_mlme.h | 4 +- include/rtw_p2p.h | 6 +- include/rtw_recv.h | 22 +- include/rtw_security.h | 2 +- include/wifi.h | 2 +- os_dep/ioctl_cfg80211.c | 372 +++++++++++------------ os_dep/ioctl_linux.c | 500 +++++++++++++++---------------- os_dep/mlme_linux.c | 28 +- os_dep/os_intfs.c | 98 +++---- os_dep/osdep_service.c | 76 ++--- os_dep/recv_linux.c | 36 +-- os_dep/rtw_android.c | 10 +- os_dep/usb_intf.c | 90 +++--- os_dep/usb_ops_linux.c | 24 +- os_dep/xmit_linux.c | 22 +- 61 files changed, 3500 insertions(+), 3500 deletions(-) diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 7c4f4ff..7c41e56 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -90,8 +90,8 @@ static void update_BCNTIM(struct adapter *padapter) /* DBG_871X("%s\n", __FUNCTION__); */ /* update TIM IE */ - /* if(pstapriv->tim_bitmap) */ - if(true) + /* if (pstapriv->tim_bitmap) */ + if (true) { u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL; __le16 tim_bitmap_le; @@ -145,16 +145,16 @@ static void update_BCNTIM(struct adapter *padapter) } - if(remainder_ielen>0) + if (remainder_ielen>0) { pbackup_remainder_ie = rtw_malloc(remainder_ielen); - if(pbackup_remainder_ie && premainder_ie) + if (pbackup_remainder_ie && premainder_ie) memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); } *dst_ie++=_TIM_IE_; - if((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fc)) + if ((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fc)) tim_ielen = 5; else tim_ielen = 4; @@ -164,23 +164,23 @@ static void update_BCNTIM(struct adapter *padapter) *dst_ie++=0;/* DTIM count */ *dst_ie++=1;/* DTIM peroid */ - if(pstapriv->tim_bitmap&BIT(0))/* for bc/mc frames */ + if (pstapriv->tim_bitmap&BIT(0))/* for bc/mc frames */ *dst_ie++ = BIT(0);/* bitmap ctrl */ else *dst_ie++ = 0; - if(tim_ielen==4) + if (tim_ielen==4) { *dst_ie++ = *(u8*)&tim_bitmap_le; } - else if(tim_ielen==5) + else if (tim_ielen==5) { memcpy(dst_ie, &tim_bitmap_le, 2); dst_ie+=2; } /* copy remainder IE */ - if(pbackup_remainder_ie) + if (pbackup_remainder_ie) { memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); @@ -211,7 +211,7 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, u8 { break; } - else if(pIE->ElementID == index) /* already exist the same IE */ + else if (pIE->ElementID == index) /* already exist the same IE */ { p = (u8 *)pIE; ielen = pIE->Length; @@ -234,16 +234,16 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, u8 remainder_ielen = pnetwork->IELength - ie_offset - ielen; - if(bmatch) + if (bmatch) dst_ie = p; else dst_ie = (p+ielen); } - if(remainder_ielen>0) + if (remainder_ielen>0) { pbackup_remainder_ie = rtw_malloc(remainder_ielen); - if(pbackup_remainder_ie && premainder_ie) + if (pbackup_remainder_ie && premainder_ie) memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); } @@ -254,7 +254,7 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, u8 dst_ie+=len; /* copy remainder IE */ - if(pbackup_remainder_ie) + if (pbackup_remainder_ie) { memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); @@ -288,15 +288,15 @@ void rtw_remove_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, return; } - if(remainder_ielen>0) + if (remainder_ielen>0) { pbackup_remainder_ie = rtw_malloc(remainder_ielen); - if(pbackup_remainder_ie && premainder_ie) + if (pbackup_remainder_ie && premainder_ie) memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); } /* copy remainder IE */ - if(pbackup_remainder_ie) + if (pbackup_remainder_ie) { memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen); @@ -311,7 +311,7 @@ u8 chk_sta_is_alive(struct sta_info *psta) { u8 ret = false; - if((psta->sta_stats.last_rx_data_pkts + psta->sta_stats.last_rx_ctrl_pkts) == (psta->sta_stats.rx_data_pkts + psta->sta_stats.rx_ctrl_pkts)) + if ((psta->sta_stats.last_rx_data_pkts + psta->sta_stats.last_rx_ctrl_pkts) == (psta->sta_stats.rx_data_pkts + psta->sta_stats.rx_ctrl_pkts)) { } else @@ -346,7 +346,7 @@ void expire_timeout_chk(struct adapter *padapter) psta = LIST_CONTAINOR(plist, struct sta_info, auth_list); plist = get_next(plist); - if(psta->expire_to>0) + if (psta->expire_to>0) { psta->expire_to--; if (psta->expire_to == 0) @@ -414,7 +414,7 @@ void expire_timeout_chk(struct adapter *padapter) pstapriv->tim_bitmap |= BIT(psta->aid); update_beacon(padapter, _TIM_IE_, NULL, false); - if(!pmlmeext->active_keep_alive_check) + if (!pmlmeext->active_keep_alive_check) continue; } } @@ -465,7 +465,7 @@ void expire_timeout_chk(struct adapter *padapter) int ret = _FAIL; psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]); - if(!(psta->state &_FW_LINKED)) + if (!(psta->state &_FW_LINKED)) continue; if (psta->state & WIFI_SLEEP_STATE) @@ -519,12 +519,12 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct wlan_bssid_ex *pcur_network = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network; - if(psta) + if (psta) psta_ht = &psta->htpriv; else return; - if(!(psta->state & _FW_LINKED)) + if (!(psta->state & _FW_LINKED)) return; /* b/g mode ra_bitmap */ @@ -534,10 +534,10 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f); } /* n mode ra_bitmap */ - if(psta_ht->ht_option) + if (psta_ht->ht_option) { rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - if(rf_type == RF_2T2R) + if (rf_type == RF_2T2R) limit=16;/* 2R */ else limit=8;/* 1R */ @@ -624,7 +624,7 @@ void update_bmc_sta(struct adapter *padapter) struct wlan_bssid_ex *pcur_network = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network; struct sta_info *psta = rtw_get_bcmc_stainfo(padapter); - if(psta) + if (psta) { psta->aid = 0;/* default set to 0 */ /* psta->mac_id = psta->aid+4; */ @@ -670,7 +670,7 @@ void update_bmc_sta(struct adapter *padapter) /* ap mode */ rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, true); - /* if(pHalData->fw_ractrl == true) */ + /* if (pHalData->fw_ractrl == true) */ { u8 arg = 0; @@ -736,7 +736,7 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) /* ap mode */ rtw_hal_set_odm_var(padapter,HAL_ODM_STA_INFO,psta,true); - if(psecuritypriv->dot11AuthAlgrthm==dot11AuthAlgrthm_8021X) + if (psecuritypriv->dot11AuthAlgrthm==dot11AuthAlgrthm_8021X) psta->ieee8021x_blocked = true; else psta->ieee8021x_blocked = false; @@ -747,19 +747,19 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) /* ERP */ VCS_update(padapter, psta); /* HT related cap */ - if(phtpriv_sta->ht_option) + if (phtpriv_sta->ht_option) { /* check if sta supports rx ampdu */ phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable; /* check if sta support s Short GI */ - if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) + if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) { phtpriv_sta->sgi = true; } /* bwmode */ - if((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) + if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) { /* phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_40; */ phtpriv_sta->bwmode = pmlmeext->cur_bwmode; @@ -824,7 +824,7 @@ static void update_hw_ht_param(struct adapter *padapter) /* Config SM Power Save setting */ /* */ pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & 0x0C) >> 2; - if(pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) + if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) DBG_871X("%s(): WLAN_HT_CAP_SM_PS_STATIC\n",__FUNCTION__); /* */ @@ -864,7 +864,7 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf) /* check if there is wps ie, */ /* if there is wpsie in beacon, the hostapd will update beacon twice when stating hostapd, */ /* and at first time the security ie ( RSN/WPA IE) will not include in beacon. */ - if(NULL == rtw_get_wps_ie(pnetwork->IEs+_FIXED_IE_LENGTH_, pnetwork->IELength-_FIXED_IE_LENGTH_, NULL, NULL)) + if (NULL == rtw_get_wps_ie(pnetwork->IEs+_FIXED_IE_LENGTH_, pnetwork->IELength-_FIXED_IE_LENGTH_, NULL, NULL)) { pmlmeext->bstart_bss = true; } @@ -872,9 +872,9 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf) /* todo: update wmm, ht cap */ /* pmlmeinfo->WMM_enable; */ /* pmlmeinfo->HT_enable; */ - if(pmlmepriv->qospriv.qos_option) + if (pmlmepriv->qospriv.qos_option) pmlmeinfo->WMM_enable = true; - if(pmlmepriv->htpriv.ht_option) + if (pmlmepriv->htpriv.ht_option) { pmlmeinfo->WMM_enable = true; pmlmeinfo->HT_enable = true; @@ -884,7 +884,7 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf) update_hw_ht_param(padapter); } - if(pmlmepriv->cur_network.join_res != true) /* setting only at first time */ + if (pmlmepriv->cur_network.join_res != true) /* setting only at first time */ { /* WEP Key will be set before this function, do not clear CAM. */ if ((psecuritypriv->dot11PrivacyAlgrthm != _WEP40_) && (psecuritypriv->dot11PrivacyAlgrthm != _WEP104_)) @@ -918,14 +918,14 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf) UpdateBrateTbl(padapter, pnetwork->SupportedRates); rtw_hal_set_hwreg(padapter, HW_VAR_BASIC_RATE, pnetwork->SupportedRates); - if(pmlmepriv->cur_network.join_res != true) /* setting only at first time */ + if (pmlmepriv->cur_network.join_res != true) /* setting only at first time */ { /* turn on all dynamic functions */ Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, true); } /* set channel, bwmode */ p = rtw_get_ie((pnetwork->IEs + sizeof(struct ndis_802_11_fixed_ies)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(struct ndis_802_11_fixed_ies))); - if( p && ie_len) + if ( p && ie_len) { pht_info = (struct HT_info_element *)(p+2); @@ -981,12 +981,12 @@ static void start_bss_network(struct adapter *padapter, u8 *pbuf) pwdinfo->p2p_group_ssid_len = pnetwork->Ssid.SsidLength; #endif /* CONFIG_P2P */ - if(true == pmlmeext->bstart_bss) + if (true == pmlmeext->bstart_bss) { update_beacon(padapter, _TIM_IE_, NULL, false); /* issue beacon frame */ - if(send_beacon(padapter)==_FAIL) + if (send_beacon(padapter)==_FAIL) DBG_871X("issue_beacon, fail!\n"); } @@ -1030,11 +1030,11 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) DBG_871X("%s, len=%d\n", __FUNCTION__, len); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) return _FAIL; - if(len>MAX_IE_SZ) + if (len>MAX_IE_SZ) return _FAIL; pbss_network->IELength = len; @@ -1044,7 +1044,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) memcpy(ie, pbuf, pbss_network->IELength); - if(pbss_network->InfrastructureMode!=Ndis802_11APMode) + if (pbss_network->InfrastructureMode!=Ndis802_11APMode) return _FAIL; pbss_network->Rssi = 0; @@ -1063,7 +1063,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) /* SSID */ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SSID_IE_, &ie_len, (pbss_network->IELength -_BEACON_IE_OFFSET_)); - if(p && ie_len>0) + if (p && ie_len>0) { memset(&pbss_network->Ssid, 0, sizeof(struct ndis_802_11_ssid)); memcpy(pbss_network->Ssid.Ssid, (p + 2), ie_len); @@ -1074,7 +1074,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) channel = 0; pbss_network->Configuration.Length = 0; p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _DSSET_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if(p && ie_len>0) + if (p && ie_len>0) channel = *(p + 2); pbss_network->Configuration.DSConfig = channel; @@ -1105,7 +1105,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) /* parsing ERP_IE */ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if(p && ie_len>0) + if (p && ie_len>0) { ERP_IE_handler(padapter, (struct ndis_802_11_variable_ies *)p); } @@ -1123,9 +1123,9 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_; psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_; p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _RSN_IE_2_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if(p && ie_len>0) + if (p && ie_len>0) { - if(rtw_parse_wpa2_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + if (rtw_parse_wpa2_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { psecuritypriv->dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; @@ -1148,7 +1148,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) p = rtw_get_ie(p, _SSN_IE_1_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2))); if ((p) && (_rtw_memcmp(p+2, OUI1, 4))) { - if(rtw_parse_wpa_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + if (rtw_parse_wpa_ie(p, ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { psecuritypriv->dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; @@ -1175,12 +1175,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) /* wmm */ ie_len = 0; pmlmepriv->qospriv.qos_option = 0; - if(pregistrypriv->wmm_enable) + if (pregistrypriv->wmm_enable) { for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2)) { p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2))); - if((p) && _rtw_memcmp(p+2, WMM_PARA_IE, 6)) + if ((p) && _rtw_memcmp(p+2, WMM_PARA_IE, 6)) { pmlmepriv->qospriv.qos_option = 1; @@ -1203,7 +1203,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) } /* parsing HT_CAP_IE */ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if(p && ie_len>0) + if (p && ie_len>0) { u8 rf_type; @@ -1218,7 +1218,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - if((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) || + if ((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) || (psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP)) { pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2)); @@ -1230,7 +1230,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_FACTOR & 0x03); /* set Max Rx AMPDU size to 64K */ - if(rf_type == RF_1T1R) { + if (rf_type == RF_1T1R) { pht_cap->mcs.rx_mask[0] = 0xff; pht_cap->mcs.rx_mask[1] = 0x0; } @@ -1241,7 +1241,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) /* parsing HT_INFO_IE */ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_ADD_INFO_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); - if(p && ie_len>0) + if (p && ie_len>0) { pHT_info_ie=p; } @@ -1268,7 +1268,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) pmlmepriv->htpriv.ht_option = false; - if( (psecuritypriv->wpa2_pairwise_cipher&WPA_CIPHER_TKIP) || + if ( (psecuritypriv->wpa2_pairwise_cipher&WPA_CIPHER_TKIP) || (psecuritypriv->wpa_pairwise_cipher&WPA_CIPHER_TKIP)) { /* todo: */ @@ -1276,12 +1276,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) } /* ht_cap */ - if(pregistrypriv->ht_enable && ht_cap==true) + if (pregistrypriv->ht_enable && ht_cap==true) { pmlmepriv->htpriv.ht_option = true; pmlmepriv->qospriv.qos_option = 1; - if(pregistrypriv->ampdu_enable==1) + if (pregistrypriv->ampdu_enable==1) { pmlmepriv->htpriv.ampdu_enable = true; } @@ -1298,7 +1298,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) /* alloc sta_info for ap itself */ psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->MacAddress); - if(!psta) + if (!psta) { psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->MacAddress); if (psta == NULL) @@ -1341,7 +1341,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) DBG_871X("%s(acl_num=%d)=" MAC_FMT "\n", __func__, pacl_list->num, MAC_ARG(addr)); - if((NUM_ACL-1) < pacl_list->num) + if ((NUM_ACL-1) < pacl_list->num) return (-1); @@ -1355,9 +1355,9 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); plist = get_next(plist); - if(_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) + if (_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) { - if(paclnode->valid == true) + if (paclnode->valid == true) { added = true; DBG_871X("%s, sta has been added\n", __func__); @@ -1369,7 +1369,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) spin_unlock_bh(&(pacl_node_q->lock)); - if(added == true) + if (added == true) return ret; @@ -1379,7 +1379,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) { paclnode = &pacl_list->aclnode[i]; - if(paclnode->valid == false) + if (paclnode->valid == false) { _rtw_init_listhead(&paclnode->list); @@ -1424,9 +1424,9 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); plist = get_next(plist); - if(_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) + if (_rtw_memcmp(paclnode->addr, addr, ETH_ALEN)) { - if(paclnode->valid == true) + if (paclnode->valid == true) { paclnode->valid = false; @@ -1462,12 +1462,12 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter) DBG_871X("%s, ERP_enable=%d\n", __FUNCTION__, pmlmeinfo->ERP_enable); - if(!pmlmeinfo->ERP_enable) + if (!pmlmeinfo->ERP_enable) return; /* parsing ERP_IE */ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _ERPINFO_IE_, &len, (pnetwork->IELength - _BEACON_IE_OFFSET_)); - if(p && len>0) + if (p && len>0) { struct ndis_802_11_variable_ies * pIE = (struct ndis_802_11_variable_ies *)p; @@ -1476,7 +1476,7 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter) else pIE->data[0] &= ~(RTW_ERP_INFO_NON_ERP_PRESENT|RTW_ERP_INFO_USE_PROTECTION); - if(pmlmepriv->num_sta_no_short_preamble > 0) + if (pmlmepriv->num_sta_no_short_preamble > 0) pIE->data[0] |= RTW_ERP_INFO_BARKER_PREAMBLE_MODE; else pIE->data[0] &= ~(RTW_ERP_INFO_BARKER_PREAMBLE_MODE); @@ -1532,7 +1532,7 @@ static void update_bcn_wps_ie(struct adapter *padapter) pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen); - if(pwps_ie==NULL || wps_ielen==0) + if (pwps_ie==NULL || wps_ielen==0) return; wps_offset = (uint)(pwps_ie-ie); @@ -1541,33 +1541,33 @@ static void update_bcn_wps_ie(struct adapter *padapter) remainder_ielen = ielen - wps_offset - wps_ielen; - if(remainder_ielen>0) + if (remainder_ielen>0) { pbackup_remainder_ie = rtw_malloc(remainder_ielen); - if(pbackup_remainder_ie) + if (pbackup_remainder_ie) memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); } pwps_ie_src = pmlmepriv->wps_beacon_ie; - if(pwps_ie_src == NULL) + if (pwps_ie_src == NULL) return; wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */ - if((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ) + if ((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ) { memcpy(pwps_ie, pwps_ie_src, wps_ielen+2); pwps_ie += (wps_ielen+2); - if(pbackup_remainder_ie) + if (pbackup_remainder_ie) memcpy(pwps_ie, pbackup_remainder_ie, remainder_ielen); /* update IELength */ pnetwork->IELength = wps_offset + (wps_ielen+2) + remainder_ielen; } - if(pbackup_remainder_ie) + if (pbackup_remainder_ie) rtw_mfree(pbackup_remainder_ie, remainder_ielen); } @@ -1581,19 +1581,19 @@ static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8*oui) { DBG_871X("%s\n", __FUNCTION__); - if(_rtw_memcmp(RTW_WPA_OUI, oui, 4)) + if (_rtw_memcmp(RTW_WPA_OUI, oui, 4)) { update_bcn_wpa_ie(padapter); } - else if(_rtw_memcmp(WMM_OUI, oui, 4)) + else if (_rtw_memcmp(WMM_OUI, oui, 4)) { update_bcn_wmm_ie(padapter); } - else if(_rtw_memcmp(WPS_OUI, oui, 4)) + else if (_rtw_memcmp(WPS_OUI, oui, 4)) { update_bcn_wps_ie(padapter); } - else if(_rtw_memcmp(P2P_OUI, oui, 4)) + else if (_rtw_memcmp(P2P_OUI, oui, 4)) { update_bcn_p2p_ie(padapter); } @@ -1614,14 +1614,14 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) /* DBG_871X("%s\n", __FUNCTION__); */ - if(!padapter) + if (!padapter) return; pmlmepriv = &(padapter->mlmepriv); pmlmeext = &(padapter->mlmeextpriv); /* pmlmeinfo = &(pmlmeext->mlmext_info); */ - if(false == pmlmeext->bstart_bss) + if (false == pmlmeext->bstart_bss) return; spin_lock_bh(&pmlmepriv->bcn_update_lock); @@ -1678,7 +1678,7 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) spin_unlock_bh(&pmlmepriv->bcn_update_lock); - if(tx) + if (tx) set_tx_beacon_cmd(padapter); } @@ -1701,7 +1701,7 @@ static int rtw_ht_operation_update(struct adapter *padapter) struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct ht_priv *phtpriv_ap = &pmlmepriv->htpriv; - if(pmlmepriv->htpriv.ht_option == true) + if (pmlmepriv->htpriv.ht_option == true) return 0; /* if (!iface->conf->ieee80211n || iface->conf->ht_op_mode_fixed) */ @@ -1768,7 +1768,7 @@ static int rtw_ht_operation_update(struct adapter *padapter) void associated_clients_update(struct adapter *padapter, u8 updated) { /* update associcated stations cap. */ - if(updated == true) + if (updated == true) { unsigned long irqL; struct list_head *phead, *plist; @@ -1803,8 +1803,8 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - if(!(psta->flags & WLAN_STA_SHORT_PREAMBLE)) { - if(!psta->no_short_preamble_set) { + if (!(psta->flags & WLAN_STA_SHORT_PREAMBLE)) { + if (!psta->no_short_preamble_set) { psta->no_short_preamble_set = 1; pmlmepriv->num_sta_no_short_preamble++; @@ -1817,7 +1817,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) } } else { - if(psta->no_short_preamble_set) { + if (psta->no_short_preamble_set) { psta->no_short_preamble_set = 0; pmlmepriv->num_sta_no_short_preamble--; @@ -1830,8 +1830,8 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) } } - if(psta->flags & WLAN_STA_NONERP) { - if(!psta->nonerp_set) { + if (psta->flags & WLAN_STA_NONERP) { + if (!psta->nonerp_set) { psta->nonerp_set = 1; pmlmepriv->num_sta_non_erp++; @@ -1842,7 +1842,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) } } } else { - if(psta->nonerp_set) { + if (psta->nonerp_set) { psta->nonerp_set = 0; pmlmepriv->num_sta_non_erp--; @@ -1855,9 +1855,9 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) } - if(!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT)) + if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT)) { - if(!psta->no_short_slot_time_set) + if (!psta->no_short_slot_time_set) { psta->no_short_slot_time_set = 1; @@ -1874,7 +1874,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) } else { - if(psta->no_short_slot_time_set) + if (psta->no_short_slot_time_set) { psta->no_short_slot_time_set = 0; @@ -1930,7 +1930,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) psta->no_ht_set = 1; pmlmepriv->num_sta_no_ht++; } - if(pmlmepriv->htpriv.ht_option == true) { + if (pmlmepriv->htpriv.ht_option == true) { DBG_871X("%s STA " MAC_FMT " - no HT, num of non-HT stations %d\n", __FUNCTION__, MAC_ARG(psta->hwaddr), @@ -1957,7 +1957,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta) struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); - if(!psta) + if (!psta) return beacon_updated; if (psta->no_short_preamble_set) { @@ -2027,7 +2027,7 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, bool active, u16 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct sta_priv *pstapriv = &padapter->stapriv; - if(!psta) + if (!psta) return beacon_updated; if (active == true) @@ -2079,7 +2079,7 @@ int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; - if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) + if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) return ret; DBG_871X(FUNC_NDEV_FMT" with ch:%u, offset:%u\n", @@ -2121,7 +2121,7 @@ int rtw_sta_flush(struct adapter *padapter) DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev)); - if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) + if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) return ret; spin_lock_bh(&pstapriv->asoc_list_lock); @@ -2169,16 +2169,16 @@ void sta_info_update(struct adapter *padapter, struct sta_info *psta) /* update wmm cap. */ - if(WLAN_STA_WME&flags) + if (WLAN_STA_WME&flags) psta->qos_option = 1; else psta->qos_option = 0; - if(pmlmepriv->qospriv.qos_option == 0) + if (pmlmepriv->qospriv.qos_option == 0) psta->qos_option = 0; /* update 802.11n ht cap. */ - if(WLAN_STA_HT&flags) + if (WLAN_STA_HT&flags) { psta->htpriv.ht_option = true; psta->qos_option = 1; @@ -2188,7 +2188,7 @@ void sta_info_update(struct adapter *padapter, struct sta_info *psta) psta->htpriv.ht_option = false; } - if(pmlmepriv->htpriv.ht_option == false) + if (pmlmepriv->htpriv.ht_option == false) psta->htpriv.ht_option = false; update_sta_info_apmode(padapter, psta); @@ -2197,7 +2197,7 @@ void sta_info_update(struct adapter *padapter, struct sta_info *psta) /* called >= TSR LEVEL for USB or SDIO Interface*/ void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta) { - if(psta->state & _FW_LINKED) + if (psta->state & _FW_LINKED) { /* add ratid */ add_RATid(padapter, psta, 0);/* DM_RATR_STA_INIT */ @@ -2224,7 +2224,7 @@ void rtw_ap_restore_network(struct adapter *padapter) start_bss_network(padapter, (u8*)&mlmepriv->cur_network.network); - if((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || + if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) { /* restore group key, WEP keys is restored in ips_leave() */ @@ -2256,12 +2256,12 @@ void rtw_ap_restore_network(struct adapter *padapter) if (psta == NULL) { DBG_871X(FUNC_ADPT_FMT" sta_info is null\n", FUNC_ADPT_ARG(padapter)); } - else if(psta->state &_FW_LINKED) + else if (psta->state &_FW_LINKED) { Update_RA_Entry(padapter, psta); /* pairwise key */ /* per sta pairwise key and settings */ - if( (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || + if ( (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) { rtw_setstakey_cmd(padapter, (unsigned char *)psta, true,false); @@ -2351,7 +2351,7 @@ void stop_ap_mode(struct adapter *padapter) paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); plist = get_next(plist); - if(paclnode->valid == true) + if (paclnode->valid == true) { paclnode->valid = false; diff --git a/core/rtw_br_ext.c b/core/rtw_br_ext.c index d8e1330..1e5a266 100644 --- a/core/rtw_br_ext.c +++ b/core/rtw_br_ext.c @@ -81,7 +81,7 @@ static __inline__ unsigned char *__nat25_find_pppoe_tag(struct pppoe_hdr *ph, un /* prevent un-alignment access */ tagType = (unsigned short)((cur_ptr[0] << 8) + cur_ptr[1]); tagLen = (unsigned short)((cur_ptr[2] << 8) + cur_ptr[3]); - if(tagType == type) + if (tagType == type) return cur_ptr; cur_ptr = cur_ptr + TAG_HDR_LEN + tagLen; } @@ -142,7 +142,7 @@ static __inline__ unsigned long __nat25_timeout(struct adapter *priv) static __inline__ int __nat25_has_expired(struct adapter *priv, struct nat25_network_db_entry *fdb) { - if(time_before_eq(fdb->ageing_timer, __nat25_timeout(priv))) + if (time_before_eq(fdb->ageing_timer, __nat25_timeout(priv))) return 1; return 0; @@ -317,7 +317,7 @@ static void convert_ipv6_mac_to_mc(struct sk_buff *skb) static __inline__ int __nat25_network_hash(unsigned char *networkAddr) { - if(networkAddr[0] == NAT25_IPV4) + if (networkAddr[0] == NAT25_IPV4) { unsigned long x; @@ -325,7 +325,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr) return x & (NAT25_HASH_SIZE - 1); } - else if(networkAddr[0] == NAT25_IPX) + else if (networkAddr[0] == NAT25_IPX) { unsigned long x; @@ -334,7 +334,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr) return x & (NAT25_HASH_SIZE - 1); } - else if(networkAddr[0] == NAT25_APPLE) + else if (networkAddr[0] == NAT25_APPLE) { unsigned long x; @@ -342,7 +342,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr) return x & (NAT25_HASH_SIZE - 1); } - else if(networkAddr[0] == NAT25_PPPOE) + else if (networkAddr[0] == NAT25_PPPOE) { unsigned long x; @@ -351,7 +351,7 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr) return x & (NAT25_HASH_SIZE - 1); } #ifdef CL_IPV6_PASS - else if(networkAddr[0] == NAT25_IPV6) + else if (networkAddr[0] == NAT25_IPV6) { unsigned long x; @@ -384,7 +384,7 @@ static __inline__ void __network_hash_link(struct adapter *priv, /* spin_lock_bh(&priv->br_ext_lock); */ ent->next_hash = priv->nethash[hash]; - if(ent->next_hash != NULL) + if (ent->next_hash != NULL) ent->next_hash->pprev_hash = &ent->next_hash; priv->nethash[hash] = ent; ent->pprev_hash = &priv->nethash[hash]; @@ -400,7 +400,7 @@ static __inline__ void __network_hash_unlink(struct nat25_network_db_entry *ent) /* spin_lock_bh(&priv->br_ext_lock); */ *(ent->pprev_hash) = ent->next_hash; - if(ent->next_hash != NULL) + if (ent->next_hash != NULL) ent->next_hash->pprev_hash = ent->pprev_hash; ent->next_hash = NULL; ent->pprev_hash = NULL; @@ -419,9 +419,9 @@ static int __nat25_db_network_lookup_and_replace(struct adapter *priv, db = priv->nethash[__nat25_network_hash(networkAddr)]; while (db != NULL) { - if(!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) + if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) { - if(!__nat25_has_expired(priv, db)) + if (!__nat25_has_expired(priv, db)) { /* replace the destination mac address */ memcpy(skb->data, db->macAddr, ETH_ALEN); @@ -498,7 +498,7 @@ static void __nat25_db_network_insert(struct adapter *priv, db = priv->nethash[hash]; while (db != NULL) { - if(!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) + if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) { memcpy(db->macAddr, macAddr, ETH_ALEN); db->ageing_timer = jiffies; @@ -510,7 +510,7 @@ static void __nat25_db_network_insert(struct adapter *priv, } db = (struct nat25_network_db_entry *) rtw_malloc(sizeof(*db)); - if(db == NULL) { + if (db == NULL) { spin_unlock_bh(&priv->br_ext_lock); return; } @@ -548,7 +548,7 @@ void nat25_db_cleanup(struct adapter *priv) struct nat25_network_db_entry *g; g = f->next_hash; - if(priv->scdb_entry == f) + if (priv->scdb_entry == f) { memset(priv->scdb_mac, 0, ETH_ALEN); memset(priv->scdb_ip, 0, 4); @@ -571,7 +571,7 @@ void nat25_db_expire(struct adapter *priv) unsigned long irqL; spin_lock_bh(&priv->br_ext_lock); - /* if(!priv->ethBrExtInfo.nat25_disable) */ + /* if (!priv->ethBrExtInfo.nat25_disable) */ { for (i=0; inext_hash; - if(__nat25_has_expired(priv, f)) + if (__nat25_has_expired(priv, f)) { - if(atomic_dec_and_test(&f->use_count)) + if (atomic_dec_and_test(&f->use_count)) { - if(priv->scdb_entry == f) + if (priv->scdb_entry == f) { memset(priv->scdb_mac, 0, ETH_ALEN); memset(priv->scdb_ip, 0, 4); @@ -641,10 +641,10 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) unsigned char networkAddr[MAX_NETWORK_ADDR_LEN]; u32 tmp; - if(skb == NULL) + if (skb == NULL) return -1; - if((method <= NAT25_MIN) || (method >= NAT25_MAX)) + if ((method <= NAT25_MIN) || (method >= NAT25_MAX)) return -1; protocol = be16_to_cpu(*((__be16 *)(skb->data + 2 * ETH_ALEN))); @@ -652,10 +652,10 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) /*---------------------------------------------------*/ /* Handle IP frame */ /*---------------------------------------------------*/ - if(protocol == ETH_P_IP) { + if (protocol == ETH_P_IP) { struct iphdr* iph = (struct iphdr *)(skb->data + ETH_HLEN); - if(((unsigned char*)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len)) + if (((unsigned char*)(iph) + (iph->ihl<<2)) >= (skb->data + ETH_HLEN + skb->len)) { DEBUG_WARN("NAT25: malformed IP packet !\n"); return -1; @@ -722,13 +722,13 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) /*---------------------------------------------------*/ /* Handle ARP frame */ /*---------------------------------------------------*/ - else if(protocol == ETH_P_ARP) + else if (protocol == ETH_P_ARP) { struct arphdr *arp = (struct arphdr *)(skb->data + ETH_HLEN); unsigned char *arp_ptr = (unsigned char *)(arp + 1); unsigned int *sender, *target; - if(arp->ar_pro != __constant_htons(ETH_P_IP)) + if (arp->ar_pro != __constant_htons(ETH_P_IP)) { DEBUG_WARN("NAT25: arp protocol unknown (%4x)!\n", htons(arp->ar_pro)); return -1; @@ -786,7 +786,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) /*---------------------------------------------------*/ /* Handle IPX and Apple Talk frame */ /*---------------------------------------------------*/ - else if((protocol == ETH_P_IPX) || + else if ((protocol == ETH_P_IPX) || (protocol <= ETH_FRAME_LEN)) { unsigned char ipx_header[2] = {0xFF, 0xFF}; @@ -795,14 +795,14 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) struct ddpehdr *ddp = NULL; unsigned char *framePtr = skb->data + ETH_HLEN; - if(protocol == ETH_P_IPX) + if (protocol == ETH_P_IPX) { DEBUG_INFO("NAT25: Protocol=IPX (Ethernet II)\n"); ipx = (struct ipxhdr *)framePtr; } - else if(protocol <= ETH_FRAME_LEN) + else if (protocol <= ETH_FRAME_LEN) { - if(!memcmp(ipx_header, framePtr, 2)) + if (!memcmp(ipx_header, framePtr, 2)) { DEBUG_INFO("NAT25: Protocol=IPX (Ethernet 802.3)\n"); ipx = (struct ipxhdr *)framePtr; @@ -812,7 +812,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) unsigned char ipx_8022_type = 0xE0; unsigned char snap_8022_type = 0xAA; - if(*framePtr == snap_8022_type) + if (*framePtr == snap_8022_type) { unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37}; /* IPX SNAP ID */ unsigned char aarp_snap_id[5] = {0x00, 0x00, 0x00, 0x80, 0xF3}; /* Apple Talk AARP SNAP ID */ @@ -820,20 +820,20 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) framePtr += 3; /* eliminate the 802.2 header */ - if(!memcmp(ipx_snap_id, framePtr, 5)) + if (!memcmp(ipx_snap_id, framePtr, 5)) { framePtr += 5; /* eliminate the SNAP header */ DEBUG_INFO("NAT25: Protocol=IPX (Ethernet SNAP)\n"); ipx = (struct ipxhdr *)framePtr; } - else if(!memcmp(aarp_snap_id, framePtr, 5)) + else if (!memcmp(aarp_snap_id, framePtr, 5)) { framePtr += 5; /* eliminate the SNAP header */ ea = (struct elapaarp *)framePtr; } - else if(!memcmp(ddp_snap_id, framePtr, 5)) + else if (!memcmp(ddp_snap_id, framePtr, 5)) { framePtr += 5; /* eliminate the SNAP header */ @@ -846,11 +846,11 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) return -1; } } - else if(*framePtr == ipx_8022_type) + else if (*framePtr == ipx_8022_type) { framePtr += 3; /* eliminate the 802.2 header */ - if(!memcmp(ipx_header, framePtr, 2)) + if (!memcmp(ipx_header, framePtr, 2)) { DEBUG_INFO("NAT25: Protocol=IPX (Ethernet 802.2)\n"); ipx = (struct ipxhdr *)framePtr; @@ -866,12 +866,12 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) return -1; /* IPX */ - if(ipx != NULL) + if (ipx != NULL) { switch(method) { case NAT25_CHECK: - if(!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) + if (!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) { DEBUG_INFO("NAT25: Check IPX skb_copy\n"); return 0; @@ -898,7 +898,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) ipx->ipx_source.node[5], ipx->ipx_source.sock); - if(!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) + if (!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) { DEBUG_INFO("NAT25: Use IPX Net, and Socket as network addr\n"); @@ -920,7 +920,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) case NAT25_LOOKUP: { - if(!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN)) + if (!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN)) { DEBUG_INFO("NAT25: Lookup IPX, Modify Destination IPX Node addr\n"); @@ -946,10 +946,10 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) } /* AARP */ - else if(ea != NULL) + else if (ea != NULL) { /* Sanity check fields. */ - if(ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN) + if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN) { DEBUG_WARN("NAT25: Appletalk AARP Sanity check fail!\n"); return -1; @@ -1002,7 +1002,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) } /* DDP */ - else if(ddp != NULL) + else if (ddp != NULL) { switch(method) { @@ -1050,7 +1050,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) /*---------------------------------------------------*/ /* Handle PPPoE frame */ /*---------------------------------------------------*/ - else if((protocol == ETH_P_PPP_DISC) || + else if ((protocol == ETH_P_PPP_DISC) || (protocol == ETH_P_PPP_SES)) { struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN); @@ -1064,9 +1064,9 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) return 1; case NAT25_INSERT: - if(ph->sid == 0) /* Discovery phase according to tag */ + if (ph->sid == 0) /* Discovery phase according to tag */ { - if(ph->code == PADI_CODE || ph->code == PADR_CODE) + if (ph->code == PADI_CODE || ph->code == PADR_CODE) { if (priv->ethBrExtInfo.addPPPoETag) { struct pppoe_tag *tag, *pOldTag; @@ -1101,7 +1101,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) memcpy(tag->tag_data+MAGIC_CODE_LEN, skb->data+ETH_ALEN, ETH_ALEN); /* Add relay tag */ - if(__nat25_add_pppoe_tag(skb, tag) < 0) + if (__nat25_add_pppoe_tag(skb, tag) < 0) return -1; DEBUG_INFO("NAT25: Insert PPPoE, forward %s packet\n", @@ -1141,7 +1141,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) return 0; case NAT25_LOOKUP: - if(ph->code == PADO_CODE || ph->code == PADS_CODE) + if (ph->code == PADO_CODE || ph->code == PADS_CODE) { if (priv->ethBrExtInfo.addPPPoETag) { struct pppoe_tag *tag; @@ -1149,7 +1149,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) unsigned short tagType, tagLen; int offset=0; - if((ptr = __nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID))) == NULL) { + if ((ptr = __nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID))) == NULL) { DEBUG_ERR("Fail to find PTT_RELAY_SID in FADO!\n"); return -1; } @@ -1158,7 +1158,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) tagType = (unsigned short)((ptr[0] << 8) + ptr[1]); tagLen = (unsigned short)((ptr[2] << 8) + ptr[3]); - if((tagType != ntohs(PTT_RELAY_SID)) || (tagLen < (MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN))) { + if ((tagType != ntohs(PTT_RELAY_SID)) || (tagLen < (MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN))) { DEBUG_ERR("Invalid PTT_RELAY_SID tag length [%d]!\n", tagLen); return -1; } @@ -1196,7 +1196,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) } } else { - if(ph->sid != 0) + if (ph->sid != 0) { DEBUG_INFO("NAT25: Lookup PPPoE, lookup session packet from %s\n", skb->dev->name); __nat25_generate_pppoe_network_addr(networkAddr, skb->data+ETH_ALEN, &(ph->sid)); @@ -1219,7 +1219,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) /*---------------------------------------------------*/ /* Handle EAP frame */ /*---------------------------------------------------*/ - else if(protocol == 0x888e) + else if (protocol == 0x888e) { switch(method) { @@ -1240,7 +1240,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) /*---------------------------------------------------*/ /* Handle C-Media proprietary frame */ /*---------------------------------------------------*/ - else if((protocol == 0xe2ae) || + else if ((protocol == 0xe2ae) || (protocol == 0xe2af)) { switch(method) @@ -1263,7 +1263,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) /* Handle IPV6 frame */ /*---------------------------------------------------*/ #ifdef CL_IPV6_PASS - else if(protocol == ETH_P_IPV6) + else if (protocol == ETH_P_IPV6) { struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN); @@ -1340,7 +1340,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method) int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb) { - if(!(skb->data[0] & 1)) + if (!(skb->data[0] & 1)) { int is_vlan_tag=0, i, retval=0; unsigned short vlan_hdr=0; @@ -1393,7 +1393,7 @@ int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb) *((__be16 *)(skb->data+ETH_ALEN*2+2)) = cpu_to_be16(vlan_hdr); } - if(retval == -1) { + if (retval == -1) { return -1; } } @@ -1427,29 +1427,29 @@ struct dhcpMessage { void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb) { - if(skb == NULL) + if (skb == NULL) return; - if(!priv->ethBrExtInfo.dhcp_bcst_disable) { + if (!priv->ethBrExtInfo.dhcp_bcst_disable) { __be16 protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN)); - if(protocol == __constant_htons(ETH_P_IP)) /* IP */ + if (protocol == __constant_htons(ETH_P_IP)) /* IP */ { struct iphdr* iph = (struct iphdr *)(skb->data + ETH_HLEN); - if(iph->protocol == IPPROTO_UDP) /* UDP */ + if (iph->protocol == IPPROTO_UDP) /* UDP */ { struct udphdr *udph = (struct udphdr *)((SIZE_PTR)iph + (iph->ihl << 2)); - if((udph->source == __constant_htons(CLIENT_PORT)) + if ((udph->source == __constant_htons(CLIENT_PORT)) && (udph->dest == __constant_htons(SERVER_PORT))) /* DHCP request */ { struct dhcpMessage *dhcph = (struct dhcpMessage *)((SIZE_PTR)udph + sizeof(struct udphdr)); - if(dhcph->cookie == DHCP_MAGIC) /* match magic word */ + if (dhcph->cookie == DHCP_MAGIC) /* match magic word */ { - if(!(dhcph->flags & BROADCAST_FLAG)) /* if not broadcast */ + if (!(dhcph->flags & BROADCAST_FLAG)) /* if not broadcast */ { register int sum = 0; @@ -1483,7 +1483,7 @@ void *scdb_findEntry(struct adapter *priv, unsigned char *macAddr, db = priv->nethash[hash]; while (db != NULL) { - if(!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) { + if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) { /* spin_unlock_bh(&priv->br_ext_lock); */ return (void *)db; } diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 03d0110..4274af1 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -139,7 +139,7 @@ void _rtw_free_cmd_priv (struct cmd_priv *pcmdpriv) { ; - if(pcmdpriv){ + if (pcmdpriv){ _rtw_free_sema(&(pcmdpriv->cmd_queue_sema)); _rtw_free_sema(&(pcmdpriv->terminate_cmdthread_sema)); @@ -238,14 +238,14 @@ static int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) u8 bAllow = false; /* set to true to allow enqueuing cmd when hw_init_completed is false */ /* To decide allow or not */ - if( (adapter_to_pwrctl(pcmdpriv->padapter)->bHWPwrPindetect) + if ( (adapter_to_pwrctl(pcmdpriv->padapter)->bHWPwrPindetect) &&(!pcmdpriv->padapter->registrypriv.usbss_enable) ) { - if(cmd_obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ) + if (cmd_obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra) ) { struct drvextra_cmd_parm *pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)cmd_obj->parmbuf; - if(pdrvextra_cmd_parm->ec_id == POWER_SAVING_CTRL_WK_CID) + if (pdrvextra_cmd_parm->ec_id == POWER_SAVING_CTRL_WK_CID) { /* DBG_871X("==>enqueue POWER_SAVING_CTRL_WK_CID\n"); */ bAllow = true; @@ -253,10 +253,10 @@ static int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) } } - if(cmd_obj->cmdcode == GEN_CMD_CODE(_SetChannelPlan)) + if (cmd_obj->cmdcode == GEN_CMD_CODE(_SetChannelPlan)) bAllow = true; - if( (pcmdpriv->padapter->hw_init_completed ==false && bAllow == false) + if ( (pcmdpriv->padapter->hw_init_completed ==false && bAllow == false) || pcmdpriv->cmdthd_running== false /* com_thread not running */ ) { @@ -286,14 +286,14 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) cmd_obj->padapter = padapter; - if( _FAIL == (res=rtw_cmd_filter(pcmdpriv, cmd_obj)) ) { + if ( _FAIL == (res=rtw_cmd_filter(pcmdpriv, cmd_obj)) ) { rtw_free_cmd_obj(cmd_obj); goto exit; } res = _rtw_enqueue_cmd(&pcmdpriv->cmd_queue, cmd_obj); - if(res == _SUCCESS) + if (res == _SUCCESS) _rtw_up_sema(&pcmdpriv->cmd_queue_sema); exit: @@ -324,15 +324,15 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd) { ; - if((pcmd->cmdcode!=_JoinBss_CMD_) &&(pcmd->cmdcode!= _CreateBss_CMD_)) + if ((pcmd->cmdcode!=_JoinBss_CMD_) &&(pcmd->cmdcode!= _CreateBss_CMD_)) { /* free parmbuf in cmd_obj */ rtw_mfree((unsigned char*)pcmd->parmbuf, pcmd->cmdsz); } - if(pcmd->rsp!=NULL) + if (pcmd->rsp!=NULL) { - if(pcmd->rspsz!= 0) + if (pcmd->rspsz!= 0) { /* free rsp in cmd_obj */ rtw_mfree((unsigned char*)pcmd->rsp, pcmd->rspsz); @@ -348,7 +348,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd) void rtw_stop_cmd_thread(struct adapter *adapter) { - if(adapter->cmdThread && adapter->cmdpriv.cmdthd_running == true + if (adapter->cmdThread && adapter->cmdpriv.cmdthd_running == true && adapter->cmdpriv.stop_req == 0) { adapter->cmdpriv.stop_req = 1; @@ -399,7 +399,7 @@ int rtw_cmd_thread(void * context) break; } - if(rtw_is_list_empty(&(pcmdpriv->cmd_queue.queue))) + if (rtw_is_list_empty(&(pcmdpriv->cmd_queue.queue))) { /* DBG_871X("%s: cmd queue is empty!\n", __func__); */ continue; @@ -413,11 +413,11 @@ _next: break; } - if(!(pcmd = rtw_dequeue_cmd(pcmdpriv))) { + if (!(pcmd = rtw_dequeue_cmd(pcmdpriv))) { continue; } - if( _FAIL == rtw_cmd_filter(pcmdpriv, pcmd) ) + if ( _FAIL == rtw_cmd_filter(pcmdpriv, pcmd) ) { pcmd->res = H2C_DROPPED; goto post_process; @@ -429,7 +429,7 @@ _next: memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz); - if(pcmd->cmdcode < (sizeof(wlancmds) /sizeof(struct cmd_hdl))) + if (pcmd->cmdcode < (sizeof(wlancmds) /sizeof(struct cmd_hdl))) { cmd_hdl = wlancmds[pcmd->cmdcode].h2cfuns; @@ -451,10 +451,10 @@ _next: post_process: /* call callback function for post-processed */ - if(pcmd->cmdcode < (sizeof(rtw_cmd_callback) /sizeof(struct _cmd_callback))) + if (pcmd->cmdcode < (sizeof(rtw_cmd_callback) /sizeof(struct _cmd_callback))) { pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback; - if(pcmd_callback == NULL) + if (pcmd_callback == NULL) { RT_TRACE(_module_rtl871x_cmd_c_,_drv_info_,("mlme_cmd_hdl(): pcmd_callback=0x%p, cmdcode=0x%x\n", pcmd_callback, pcmd->cmdcode)); rtw_free_cmd_obj(pcmd); @@ -482,7 +482,7 @@ post_process: /* free all cmd_obj resources */ do{ pcmd = rtw_dequeue_cmd(pcmdpriv); - if(pcmd==NULL) { + if (pcmd==NULL) { break; } @@ -552,7 +552,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, struct wifidirect_info *pwdinfo= &(padapter->wdinfo); #endif /* CONFIG_P2P */ - if(check_fwstate(pmlmepriv, _FW_LINKED) == true){ + if (check_fwstate(pmlmepriv, _FW_LINKED) == true){ rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); } @@ -607,7 +607,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, res = rtw_enqueue_cmd(pcmdpriv, ph2c); - if(res == _SUCCESS) { + if (res == _SUCCESS) { pmlmepriv->scan_start_time = rtw_get_current_time(); @@ -714,13 +714,13 @@ u8 rtw_setphy_cmd(struct adapter *padapter, u8 modem, u8 ch) ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } psetphypara = (struct setphy_parm*)rtw_zmalloc(sizeof(struct setphy_parm)); - if(psetphypara==NULL){ + if (psetphypara==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -747,13 +747,13 @@ u8 rtw_setbbreg_cmd(struct adapter*padapter, u8 offset, u8 val) u8 res=_SUCCESS; ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pwritebbparm = (struct writeBB_parm*)rtw_zmalloc(sizeof(struct writeBB_parm)); - if(pwritebbparm==NULL){ + if (pwritebbparm==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -779,13 +779,13 @@ u8 rtw_getbbreg_cmd(struct adapter *padapter, u8 offset, u8 *pval) ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res=_FAIL; goto exit; } prdbbparm = (struct readBB_parm*)rtw_zmalloc(sizeof(struct readBB_parm)); - if(prdbbparm ==NULL){ + if (prdbbparm ==NULL){ rtw_mfree((unsigned char *) ph2c, sizeof(struct cmd_obj)); return _FAIL; } @@ -813,13 +813,13 @@ u8 rtw_setrfreg_cmd(struct adapter *padapter, u8 offset, u32 val) u8 res=_SUCCESS; ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pwriterfparm = (struct writeRF_parm*)rtw_zmalloc(sizeof(struct writeRF_parm)); - if(pwriterfparm==NULL){ + if (pwriterfparm==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -846,13 +846,13 @@ u8 rtw_getrfreg_cmd(struct adapter *padapter, u8 offset, u8 *pval) ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } prdrfparm = (struct readRF_parm*)rtw_zmalloc(sizeof(struct readRF_parm)); - if(prdrfparm ==NULL){ + if (prdrfparm ==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -916,7 +916,7 @@ u8 rtw_createbss_cmd(struct adapter *padapter) } pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmd==NULL){ + if (pcmd==NULL){ res= _FAIL; goto exit; } @@ -948,7 +948,7 @@ u8 rtw_createbss_cmd_ex(struct adapter *padapter, unsigned char *pbss, unsigned ; pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmd==NULL){ + if (pcmd==NULL){ res= _FAIL; goto exit; } @@ -996,7 +996,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork) } pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmd==NULL){ + if (pcmd==NULL){ res=_FAIL; RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); goto exit; @@ -1027,9 +1027,9 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork) } psecnetwork=(struct wlan_bssid_ex *)&psecuritypriv->sec_bss; - if(psecnetwork==NULL) + if (psecnetwork==NULL) { - if(pcmd !=NULL) + if (pcmd !=NULL) rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj)); res=_FAIL; @@ -1046,7 +1046,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork) auth=&psecuritypriv->authenticator_ie[0]; psecuritypriv->authenticator_ie[0]=(unsigned char)psecnetwork->IELength; - if((psecnetwork->IELength-12) < (256-1)) { + if ((psecnetwork->IELength-12) < (256-1)) { memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12); } else { memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1)); @@ -1068,7 +1068,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork) pqospriv->qos_option = 0; - if(pregistrypriv->wmm_enable) + if (pregistrypriv->wmm_enable) { u32 tmp_len; @@ -1086,7 +1086,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork) } phtpriv->ht_option = false; - if(pregistrypriv->ht_enable) + if (pregistrypriv->ht_enable) { /* Added by Albert 2010/06/23 */ /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ @@ -1180,15 +1180,15 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum NDIS_802_11_NETWORK_INFRAST ; psetop = (struct setopmode_parm*)rtw_zmalloc(sizeof(struct setopmode_parm)); - if(psetop==NULL){ + if (psetop==NULL){ res=_FAIL; goto exit; } psetop->mode = (u8)networktype; - if(enqueue){ + if (enqueue){ ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ rtw_mfree((u8 *)psetop, sizeof(*psetop)); res= _FAIL; goto exit; @@ -1223,14 +1223,14 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key, bool en ; psetstakey_para = (struct set_stakey_parm*)rtw_zmalloc(sizeof(struct set_stakey_parm)); - if(psetstakey_para==NULL){ + if (psetstakey_para==NULL){ res=_FAIL; goto exit; } memcpy(psetstakey_para->addr, sta->hwaddr,ETH_ALEN); - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE)){ + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)){ psetstakey_para->algorithm =(unsigned char) psecuritypriv->dot11PrivacyAlgrthm; }else{ GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false); @@ -1246,7 +1246,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key, bool en /* jeff: set this becasue at least sw key is ready */ padapter->securitypriv.busetkipkey=true; - if(enqueue) + if (enqueue) { ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); if ( ph2c == NULL){ @@ -1256,7 +1256,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key, bool en } psetstakey_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_stakey_rsp)); - if(psetstakey_rsp == NULL){ + if (psetstakey_rsp == NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); rtw_mfree((u8 *) psetstakey_para, sizeof(struct set_stakey_parm)); res=_FAIL; @@ -1292,7 +1292,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue) ; - if(!enqueue) + if (!enqueue) { clear_cam_entry(padapter, entry); } @@ -1305,14 +1305,14 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue) } psetstakey_para = (struct set_stakey_parm*)rtw_zmalloc(sizeof(struct set_stakey_parm)); - if(psetstakey_para==NULL){ + if (psetstakey_para==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); res=_FAIL; goto exit; } psetstakey_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_stakey_rsp)); - if(psetstakey_rsp == NULL){ + if (psetstakey_rsp == NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); rtw_mfree((u8 *) psetstakey_para, sizeof(struct set_stakey_parm)); res=_FAIL; @@ -1349,13 +1349,13 @@ u8 rtw_setrttbl_cmd(struct adapter *padapter, struct setratable_parm *prate_tab ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } psetrttblparm = (struct setratable_parm*)rtw_zmalloc(sizeof(struct setratable_parm)); - if(psetrttblparm==NULL){ + if (psetrttblparm==NULL){ rtw_mfree((unsigned char *) ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -1381,13 +1381,13 @@ u8 rtw_getrttbl_cmd(struct adapter *padapter, struct getratable_rsp *pval) ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pgetrttblparm = (struct getratable_parm*)rtw_zmalloc(sizeof(struct getratable_parm)); - if(pgetrttblparm==NULL){ + if (pgetrttblparm==NULL){ rtw_mfree((unsigned char *) ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -1423,20 +1423,20 @@ u8 rtw_setassocsta_cmd(struct adapter *padapter, u8 *mac_addr) ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } psetassocsta_para = (struct set_assocsta_parm*)rtw_zmalloc(sizeof(struct set_assocsta_parm)); - if(psetassocsta_para==NULL){ + if (psetassocsta_para==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); res=_FAIL; goto exit; } psetassocsta_rsp = (struct set_stakey_rsp*)rtw_zmalloc(sizeof(struct set_assocsta_rsp)); - if(psetassocsta_rsp==NULL){ + if (psetassocsta_rsp==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); rtw_mfree((u8 *) psetassocsta_para, sizeof(struct set_assocsta_parm)); return _FAIL; @@ -1468,13 +1468,13 @@ u8 rtw_addbareq_cmd(struct adapter*padapter, u8 tid, u8 *addr) ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } paddbareq_parm = (struct addBaReq_parm*)rtw_zmalloc(sizeof(struct addBaReq_parm)); - if(paddbareq_parm==NULL){ + if (paddbareq_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -1507,13 +1507,13 @@ u8 rtw_reset_securitypriv_cmd(struct adapter*padapter) ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if(pdrvextra_cmd_parm==NULL){ + if (pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -1547,13 +1547,13 @@ u8 rtw_free_assoc_resources_cmd(struct adapter*padapter) ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if(pdrvextra_cmd_parm==NULL){ + if (pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -1585,13 +1585,13 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter*padapter) u8 res=_SUCCESS; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if(pdrvextra_cmd_parm==NULL){ + if (pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -1643,7 +1643,7 @@ u8 rtw_set_ch_cmd(struct adapter*padapter, u8 ch, u8 bw, u8 ch_offset, u8 enqueu if (enqueue) { /* need enqueue, prepare cmd_obj and enqueue */ pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmdobj == NULL){ + if (pcmdobj == NULL){ rtw_mfree((u8 *)set_ch_parm, sizeof(*set_ch_parm)); res=_FAIL; goto exit; @@ -1653,7 +1653,7 @@ u8 rtw_set_ch_cmd(struct adapter*padapter, u8 ch, u8 bw, u8 ch_offset, u8 enqueu res = rtw_enqueue_cmd(pcmdpriv, pcmdobj); } else { /* no need to enqueue, do the cmd hdl directly and free cmd parameter */ - if( H2C_SUCCESS !=set_ch_hdl(padapter, (u8 *)set_ch_parm) ) + if ( H2C_SUCCESS !=set_ch_hdl(padapter, (u8 *)set_ch_parm) ) res = _FAIL; rtw_mfree((u8 *)set_ch_parm, sizeof(*set_ch_parm)); @@ -1683,24 +1683,24 @@ u8 rtw_set_chplan_cmd(struct adapter*padapter, u8 chplan, u8 enqueue) RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_chplan_cmd\n")); /* check input parameter */ - if(!rtw_is_channel_plan_valid(chplan)) { + if (!rtw_is_channel_plan_valid(chplan)) { res = _FAIL; goto exit; } /* prepare cmd parameter */ setChannelPlan_param = (struct SetChannelPlan_param *)rtw_zmalloc(sizeof(struct SetChannelPlan_param)); - if(setChannelPlan_param == NULL) { + if (setChannelPlan_param == NULL) { res= _FAIL; goto exit; } setChannelPlan_param->channel_plan=chplan; - if(enqueue) + if (enqueue) { /* need enqueue, prepare cmd_obj and enqueue */ pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmdobj == NULL){ + if (pcmdobj == NULL){ rtw_mfree((u8 *)setChannelPlan_param, sizeof(struct SetChannelPlan_param)); res=_FAIL; goto exit; @@ -1712,14 +1712,14 @@ u8 rtw_set_chplan_cmd(struct adapter*padapter, u8 chplan, u8 enqueue) else { /* no need to enqueue, do the cmd hdl directly and free cmd parameter */ - if( H2C_SUCCESS !=set_chplan_hdl(padapter, (unsigned char *)setChannelPlan_param) ) + if ( H2C_SUCCESS !=set_chplan_hdl(padapter, (unsigned char *)setChannelPlan_param) ) res = _FAIL; rtw_mfree((u8 *)setChannelPlan_param, sizeof(struct SetChannelPlan_param)); } /* do something based on res... */ - if(res == _SUCCESS) + if (res == _SUCCESS) padapter->mlmepriv.ChannelPlan = chplan; exit: @@ -1742,13 +1742,13 @@ u8 rtw_led_blink_cmd(struct adapter*padapter, PLED_871x pLed) RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_led_blink_cmd\n")); pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmdobj == NULL){ + if (pcmdobj == NULL){ res=_FAIL; goto exit; } ledBlink_param = (struct LedBlink_param *)rtw_zmalloc(sizeof(struct LedBlink_param)); - if(ledBlink_param == NULL) { + if (ledBlink_param == NULL) { rtw_mfree((u8 *)pcmdobj, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -1780,13 +1780,13 @@ u8 rtw_set_csa_cmd(struct adapter*padapter, u8 new_ch_no) RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_csa_cmd\n")); pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmdobj == NULL){ + if (pcmdobj == NULL){ res=_FAIL; goto exit; } setChannelSwitch_param = (struct SetChannelSwitch_param *)rtw_zmalloc(sizeof(struct SetChannelSwitch_param)); - if(setChannelSwitch_param == NULL) { + if (setChannelSwitch_param == NULL) { rtw_mfree((u8 *)pcmdobj, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -1828,11 +1828,11 @@ static void traffic_status_watchdog(struct adapter *padapter) RT_LINK_DETECT_T * link_detect = &pmlmepriv->LinkDetectInfo; /* Determine if our traffic is busy now */ - if(check_fwstate(pmlmepriv, _FW_LINKED)) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { /* if we raise bBusyTraffic in last watchdog, using lower threshold. */ if (pmlmepriv->LinkDetectInfo.bBusyTraffic) BusyThreshold =180; /* 75; */ - if( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold || + if ( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold || pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold ) { bBusyTraffic = true; @@ -1844,7 +1844,7 @@ static void traffic_status_watchdog(struct adapter *padapter) } /* Higher Tx/Rx data. */ - if( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 4000 || + if ( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 4000 || pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000 ) { bHigherBusyTraffic = true; @@ -1878,7 +1878,7 @@ static void traffic_status_watchdog(struct adapter *padapter) #endif { /* check traffic for powersaving. */ - if( ((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8 ) || + if ( ((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8 ) || (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2) ) { /* DBG_871X("Tx = %d, Rx = %d\n",pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod); */ @@ -1890,7 +1890,7 @@ static void traffic_status_watchdog(struct adapter *padapter) } /* LeisurePS only work in infra mode. */ - if(bEnterPS) + if (bEnterPS) { LPS_Enter(padapter); } @@ -1925,7 +1925,7 @@ void dynamic_chk_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz) pmlmepriv = &(padapter->mlmepriv); #ifdef CONFIG_AP_MODE - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { expire_timeout_chk(padapter); } @@ -1954,7 +1954,7 @@ static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type) ; - if((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) + if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) { return; @@ -2037,15 +2037,15 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter*padapter, u8 lps_ctrl_type, u8 enqueue) struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - if(enqueue) { + if (enqueue) { ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if(pdrvextra_cmd_parm==NULL){ + if (pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -2088,13 +2088,13 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter*padapter, u16 minRptTime) ; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if(pdrvextra_cmd_parm==NULL){ + if (pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -2130,18 +2130,18 @@ u8 rtw_antenna_select_cmd(struct adapter*padapter, u8 antenna,u8 enqueue) ; rtw_hal_get_def_var(padapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &(bSupportAntDiv)); - if(false == bSupportAntDiv ) return res; + if (false == bSupportAntDiv ) return res; - if(true == enqueue) + if (true == enqueue) { ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if(pdrvextra_cmd_parm==NULL){ + if (pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -2192,19 +2192,19 @@ u8 p2p_protocol_wk_cmd(struct adapter*padapter, int intCmdType ) ; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { return res; } ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if(pdrvextra_cmd_parm==NULL){ + if (pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -2236,13 +2236,13 @@ u8 rtw_ps_cmd(struct adapter*padapter) u8 res = _SUCCESS; ppscmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ppscmd==NULL){ + if (ppscmd==NULL){ res= _FAIL; goto exit; } pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if(pdrvextra_cmd_parm==NULL){ + if (pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ppscmd, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -2271,10 +2271,10 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter) struct sta_priv *pstapriv = &padapter->stapriv; psta_bmc = rtw_get_bcmc_stainfo(padapter); - if(!psta_bmc) + if (!psta_bmc) return; - if(psta_bmc->sleepq_len==0) + if (psta_bmc->sleepq_len==0) { u8 val = 0; @@ -2289,13 +2289,13 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter) cnt++; - if(cnt>10) + if (cnt>10) break; rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &val); } - if(cnt<=10) + if (cnt<=10) { pstapriv->tim_bitmap &= ~BIT(0); pstapriv->sta_dz_bitmap &= ~BIT(0); @@ -2319,13 +2319,13 @@ u8 rtw_chk_hi_queue_cmd(struct adapter*padapter) u8 res = _SUCCESS; ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if(pdrvextra_cmd_parm==NULL){ + if (pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -2452,7 +2452,7 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf) { struct drvextra_cmd_parm *pdrvextra_cmd; - if(!pbuf) + if (!pbuf) return H2C_PARAMETERS_ERROR; pdrvextra_cmd = (struct drvextra_cmd_parm*)pbuf; @@ -2519,7 +2519,7 @@ void rtw_survey_cmd_callback(struct adapter* padapter , struct cmd_obj *pcmd) ; - if(pcmd->res == H2C_DROPPED) + if (pcmd->res == H2C_DROPPED) { /* TODO: cancel timer and do timeout handler directly... */ /* need to make timeout handlerOS independent */ @@ -2570,13 +2570,13 @@ void rtw_joinbss_cmd_callback(struct adapter* padapter, struct cmd_obj *pcmd) ; - if(pcmd->res == H2C_DROPPED) + if (pcmd->res == H2C_DROPPED) { /* TODO: cancel timer and do timeout handler directly... */ /* need to make timeout handlerOS independent */ _set_timer(&pmlmepriv->assoc_timer, 1); } - else if(pcmd->res != H2C_SUCCESS) + else if (pcmd->res != H2C_SUCCESS) { RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("********Error:rtw_select_and_join_from_scanned_queue Wait Sema Fail ************\n")); _set_timer(&pmlmepriv->assoc_timer, 1); @@ -2596,7 +2596,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) ; - if((pcmd->res != H2C_SUCCESS)) + if ((pcmd->res != H2C_SUCCESS)) { RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n.")); _set_timer(&pmlmepriv->assoc_timer, 1 ); @@ -2626,10 +2626,10 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) spin_lock_bh(&pmlmepriv->lock); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) ) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) ) { psta = rtw_get_stainfo(&padapter->stapriv, pnetwork->MacAddress); - if(!psta) + if (!psta) { psta = rtw_alloc_stainfo(&padapter->stapriv, pnetwork->MacAddress); if (psta == NULL) @@ -2650,7 +2650,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) if ( pwlan == NULL) { pwlan = rtw_get_oldest_wlan_network(&pmlmepriv->scanned_queue); - if( pwlan == NULL) + if ( pwlan == NULL) { RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n Error: can't get pwlan in rtw_joinbss_event_callback\n")); spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); @@ -2698,7 +2698,7 @@ void rtw_setstaKey_cmdrsp_callback(struct adapter* padapter , struct cmd_obj *p ; - if(psta==NULL) + if (psta==NULL) { RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nERROR: rtw_setstaKey_cmdrsp_callback => can't get sta_info\n\n")); goto exit; @@ -2719,7 +2719,7 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter* padapter, struct cmd_obj * ; - if(psta==NULL) + if (psta==NULL) { RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nERROR: setassocsta_cmdrsp_callbac => can't get sta_info\n\n")); goto exit; diff --git a/core/rtw_debug.c b/core/rtw_debug.c index a86404d..fe98c22 100644 --- a/core/rtw_debug.c +++ b/core/rtw_debug.c @@ -119,7 +119,7 @@ int proc_get_read_reg(char *page, char **start, int len = 0; - if(proc_get_read_addr==0xeeeeeeee) + if (proc_get_read_addr==0xeeeeeeee) { *eof = 1; return len; @@ -290,7 +290,7 @@ int proc_get_ap_info(char *page, char **start, int len = 0; psta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress); - if(psta) + if (psta) { int i; struct recv_reorder_ctrl *preorder_ctrl; @@ -308,7 +308,7 @@ int proc_get_ap_info(char *page, char **start, for(i=0;i<16;i++) { preorder_ctrl = &psta->recvreorder_ctrl[i]; - if(preorder_ctrl->enable) + if (preorder_ctrl->enable) { len += snprintf(page + len, count - len, "tid=%d, indicate_seq=%d\n", i, preorder_ctrl->indicate_seq); } @@ -385,9 +385,9 @@ int proc_get_mac_reg_dump1(char *page, char **start, for(i=0x0;i<0x300;i+=4) { - if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); + if (j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + if ((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } *eof = 1; @@ -408,9 +408,9 @@ int proc_get_mac_reg_dump2(char *page, char **start, memset(page, 0, count); for(i=0x300;i<0x600;i+=4) { - if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); + if (j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + if ((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } *eof = 1; @@ -431,9 +431,9 @@ int proc_get_mac_reg_dump3(char *page, char **start, for(i=0x600;i<0x800;i+=4) { - if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); + if (j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + if ((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } *eof = 1; @@ -453,9 +453,9 @@ int proc_get_bb_reg_dump1(char *page, char **start, len += snprintf(page + len, count - len, "\n======= BB REG =======\n"); for(i=0x800;i<0xB00;i+=4) { - if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); + if (j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + if ((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } *eof = 1; return len; @@ -473,9 +473,9 @@ int proc_get_bb_reg_dump2(char *page, char **start, len += snprintf(page + len, count - len, "\n======= BB REG =======\n"); for(i=0xB00;i<0xE00;i+=4) { - if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); + if (j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + if ((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } *eof = 1; return len; @@ -493,9 +493,9 @@ int proc_get_bb_reg_dump3(char *page, char **start, len += snprintf(page + len, count - len, "\n======= BB REG =======\n"); for(i=0xE00;i<0x1000;i+=4) { - if(j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); + if (j%4==1) len += snprintf(page + len, count - len,"0x%02x",i); len += snprintf(page + len, count - len," 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); + if ((j++)%4 == 0) len += snprintf(page + len, count - len,"\n"); } *eof = 1; return len; @@ -518,9 +518,9 @@ int proc_get_rf_reg_dump1(char *page, char **start, { /* value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord); */ value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); - if(j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); + if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); len += snprintf(page + len, count - len, " 0x%08x ",value); - if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); + if ((j++)%4==0) len += snprintf(page + len, count - len, "\n"); } *eof = 1; @@ -545,9 +545,9 @@ int proc_get_rf_reg_dump2(char *page, char **start, { /* value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord); */ value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); - if(j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); + if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); len += snprintf(page + len, count - len, " 0x%08x ",value); - if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); + if ((j++)%4==0) len += snprintf(page + len, count - len, "\n"); } *eof = 1; return len; @@ -571,9 +571,9 @@ int proc_get_rf_reg_dump3(char *page, char **start, { /* value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord); */ value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); - if(j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); + if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); len += snprintf(page + len, count - len, " 0x%08x ",value); - if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); + if ((j++)%4==0) len += snprintf(page + len, count - len, "\n"); } *eof = 1; @@ -598,9 +598,9 @@ int proc_get_rf_reg_dump4(char *page, char **start, { /* value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord); */ value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); - if(j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); + if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); len += snprintf(page + len, count - len, " 0x%08x ",value); - if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); + if ((j++)%4==0) len += snprintf(page + len, count - len, "\n"); } *eof = 1; return len; @@ -652,7 +652,7 @@ int proc_set_rx_signal(struct file *file, const char __user *buffer, is_signal_dbg = is_signal_dbg==0?0:1; - if(is_signal_dbg && num!=2) + if (is_signal_dbg && num!=2) return count; signal_strength = signal_strength>100?100:signal_strength; @@ -660,7 +660,7 @@ int proc_set_rx_signal(struct file *file, const char __user *buffer, padapter->recvpriv.is_signal_dbg = is_signal_dbg; padapter->recvpriv.signal_strength_dbg=signal_strength; - if(is_signal_dbg) + if (is_signal_dbg) DBG_871X("set %s %u\n", "DBG_SIGNAL_STRENGTH", signal_strength); else DBG_871X("set %s\n", "HW_SIGNAL_STRENGTH"); @@ -681,7 +681,7 @@ int proc_get_ht_enable(char *page, char **start, int len = 0; - if(pregpriv) + if (pregpriv) len += snprintf(page + len, count - len, "%d\n", pregpriv->ht_enable @@ -707,7 +707,7 @@ int proc_set_ht_enable(struct file *file, const char __user *buffer, int num = sscanf(tmp, "%d ", &mode); - if( pregpriv && mode >= 0 && mode < 2 ) + if ( pregpriv && mode >= 0 && mode < 2 ) { pregpriv->ht_enable= mode; printk("ht_enable=%d\n", pregpriv->ht_enable); @@ -728,7 +728,7 @@ int proc_get_cbw40_enable(char *page, char **start, int len = 0; - if(pregpriv) + if (pregpriv) len += snprintf(page + len, count - len, "%d\n", pregpriv->cbw40_enable @@ -754,7 +754,7 @@ int proc_set_cbw40_enable(struct file *file, const char __user *buffer, int num = sscanf(tmp, "%d ", &mode); - if( pregpriv && mode >= 0 && mode < 2 ) + if ( pregpriv && mode >= 0 && mode < 2 ) { pregpriv->cbw40_enable= mode; @@ -777,7 +777,7 @@ int proc_get_ampdu_enable(char *page, char **start, int len = 0; - if(pregpriv) + if (pregpriv) len += snprintf(page + len, count - len, "%d\n", pregpriv->ampdu_enable @@ -803,7 +803,7 @@ int proc_set_ampdu_enable(struct file *file, const char __user *buffer, int num = sscanf(tmp, "%d ", &mode); - if( pregpriv && mode >= 0 && mode < 3 ) + if ( pregpriv && mode >= 0 && mode < 3 ) { pregpriv->ampdu_enable= mode; printk("ampdu_enable=%d\n", mode); @@ -824,7 +824,7 @@ int proc_get_two_path_rssi(char *page, char **start, int len = 0; - if(padapter) + if (padapter) len += snprintf(page + len, count - len, "%d %d\n", padapter->recvpriv.RxRssi[0], @@ -845,7 +845,7 @@ int proc_get_rx_stbc(char *page, char **start, int len = 0; - if(pregpriv) + if (pregpriv) len += snprintf(page + len, count - len, "%d\n", pregpriv->rx_stbc @@ -871,7 +871,7 @@ int proc_set_rx_stbc(struct file *file, const char __user *buffer, int num = sscanf(tmp, "%d ", &mode); - if( pregpriv && (mode == 0 || mode == 1|| mode == 2|| mode == 3)) + if ( pregpriv && (mode == 0 || mode == 1|| mode == 2|| mode == 3)) { pregpriv->rx_stbc= mode; printk("rx_stbc=%d\n", mode); @@ -913,7 +913,7 @@ int proc_set_rssi_disp(struct file *file, const char __user *buffer, return count; } - if(enable) + if (enable) { DBG_8192C("Turn On Rx RSSI Display Function\n"); padapter->bRxRSSIDisplay = enable ; @@ -962,7 +962,7 @@ int proc_get_all_sta_info(char *page, char **start, plist = get_next(plist); - /* if(extra_arg == psta->aid) */ + /* if (extra_arg == psta->aid) */ { len += snprintf(page + len, count - len, "sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->hwaddr)); len += snprintf(page + len, count - len, "rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self); @@ -983,7 +983,7 @@ int proc_get_all_sta_info(char *page, char **start, for(j=0;j<16;j++) { preorder_ctrl = &psta->recvreorder_ctrl[j]; - if(preorder_ctrl->enable) + if (preorder_ctrl->enable) { len += snprintf(page + len, count - len, "tid=%d, indicate_seq=%d\n", j, preorder_ctrl->indicate_seq); } @@ -1071,10 +1071,10 @@ int proc_set_best_channel(struct file *file, const char __user *buffer, struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; char tmp[32]; - if(count < 1) + if (count < 1) return -EFAULT; - if(buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) { int i; for(i = 0; pmlmeext->channel_set[i].ChannelNum != 0; i++) @@ -1103,7 +1103,7 @@ int proc_get_btcoex_dbg(char *page, char **start, int len = 0; - if(pregpriv) + if (pregpriv) len += snprintf(page + len, count - len, "%d\n", BTCoexDbgLevel @@ -1129,7 +1129,7 @@ int proc_set_btcoex_dbg(struct file *file, const char __user *buffer, int num = sscanf(tmp, "%d ", &mode); - if( pregpriv && (mode == 0 || mode == 1|| mode == 2|| mode == 3)) + if ( pregpriv && (mode == 0 || mode == 1|| mode == 2|| mode == 3)) { BTCoexDbgLevel= mode; printk("btcoex_dbg=%d\n", BTCoexDbgLevel); diff --git a/core/rtw_efuse.c b/core/rtw_efuse.c index 9b2341d..f933789 100644 --- a/core/rtw_efuse.c +++ b/core/rtw_efuse.c @@ -61,12 +61,12 @@ Efuse_Read1ByteFromFakeContent( u16 Offset, u8 *Value ) { - if(Offset >= EFUSE_MAX_HW_SIZE) + if (Offset >= EFUSE_MAX_HW_SIZE) { return false; } /* DbgPrint("Read fake content, offset = %d\n", Offset); */ - if(fakeEfuseBank == 0) + if (fakeEfuseBank == 0) *Value = fakeEfuseContent[Offset]; else *Value = fakeBTEfuseContent[fakeEfuseBank-1][Offset]; @@ -84,11 +84,11 @@ Efuse_Write1ByteToFakeContent( u16 Offset, u8 Value ) { - if(Offset >= EFUSE_MAX_HW_SIZE) + if (Offset >= EFUSE_MAX_HW_SIZE) { return false; } - if(fakeEfuseBank == 0) + if (fakeEfuseBank == 0) fakeEfuseContent[Offset] = Value; else { @@ -158,10 +158,10 @@ u8 Efuse_CalculateWordCnts(u8 word_en) { u8 word_cnts = 0; - if(!(word_en & BIT(0))) word_cnts++; /* 0 : write enable */ - if(!(word_en & BIT(1))) word_cnts++; - if(!(word_en & BIT(2))) word_cnts++; - if(!(word_en & BIT(3))) word_cnts++; + if (!(word_en & BIT(0))) word_cnts++; /* 0 : write enable */ + if (!(word_en & BIT(1))) word_cnts++; + if (!(word_en & BIT(2))) word_cnts++; + if (!(word_en & BIT(3))) word_cnts++; return word_cnts; } @@ -188,7 +188,7 @@ ReadEFuseByte( u16 retry; /* u32 start=rtw_get_current_time(); */ - if(bPseudoTest) + if (bPseudoTest) { Efuse_Read1ByteFromFakeContent(Adapter, _offset, pbuf); return; @@ -328,7 +328,7 @@ EFUSE_Read1Byte( { Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); k++; - if(k==1000) + if (k==1000) { k=0; break; @@ -378,7 +378,7 @@ EFUSE_Write1Byte( /* RT_TRACE(COMP_EFUSE, DBG_LOUD, ("Addr=%x Data =%x\n", Address, Value)); */ EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI , TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false); - if( Address < contentLen) /* E-fuse 512Byte */ + if ( Address < contentLen) /* E-fuse 512Byte */ { rtw_write8(Adapter, EFUSE_CTRL, Value); @@ -402,7 +402,7 @@ EFUSE_Write1Byte( { Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); k++; - if(k==100) + if (k==100) { k=0; break; @@ -422,7 +422,7 @@ efuse_OneByteRead( u8 tmpidx = 0; u8 bResult; - if(bPseudoTest) + if (bPseudoTest) { bResult = Efuse_Read1ByteFromFakeContent(pAdapter, addr, data); return bResult; @@ -439,7 +439,7 @@ efuse_OneByteRead( { tmpidx++; } - if(tmpidx<100) + if (tmpidx<100) { *data=rtw_read8(pAdapter, EFUSE_CTRL); bResult = true; @@ -463,7 +463,7 @@ efuse_OneByteWrite( u8 tmpidx = 0; u8 bResult; - if(bPseudoTest) + if (bPseudoTest) { bResult = Efuse_Write1ByteToFakeContent(pAdapter, addr, data); return bResult; @@ -485,7 +485,7 @@ efuse_OneByteWrite( tmpidx++; } - if(tmpidx<100) + if (tmpidx<100) { bResult = true; } @@ -716,7 +716,7 @@ u8 rtw_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data) return _FAIL; map = rtw_zmalloc(mapLen); - if(map == NULL){ + if (map == NULL){ return _FAIL; } @@ -814,7 +814,7 @@ u8 rtw_BT_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data return _FAIL; map = rtw_zmalloc(mapLen); - if(map == NULL){ + if (map == NULL){ return _FAIL; } diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index 26554d6..078967b 100644 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -119,7 +119,7 @@ int rtw_check_network_type(unsigned char *rate, int ratelen, int channel) { if ((rtw_is_cckratesonly_included(rate)) == true) return WIRELESS_11B; - else if((rtw_is_cckrates_included(rate)) == true) + else if ((rtw_is_cckrates_included(rate)) == true) return WIRELESS_11BG; else return WIRELESS_11G; @@ -174,9 +174,9 @@ inline u8 secondary_ch_offset_to_hal_ch_offset(u8 ch_offset) { if (ch_offset == SCN) return HAL_PRIME_CHNL_OFFSET_DONT_CARE; - else if(ch_offset == SCA) + else if (ch_offset == SCA) return HAL_PRIME_CHNL_OFFSET_UPPER; - else if(ch_offset == SCB) + else if (ch_offset == SCB) return HAL_PRIME_CHNL_OFFSET_LOWER; return HAL_PRIME_CHNL_OFFSET_DONT_CARE; @@ -186,9 +186,9 @@ inline u8 hal_ch_offset_to_secondary_ch_offset(u8 ch_offset) { if (ch_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE) return SCN; - else if(ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER) + else if (ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER) return SCB; - else if(ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER) + else if (ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER) return SCA; return SCN; @@ -266,25 +266,25 @@ u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, u u8 *target_ie = NULL; - if(ielen) + if (ielen) *ielen = 0; - if(!in_ie || in_len<=0) + if (!in_ie || in_len<=0) return target_ie; cnt = 0; while(cntpreamble == PREAMBLE_SHORT) + if (pregistrypriv->preamble == PREAMBLE_SHORT) *(__le16*)ie |= cpu_to_le16(cap_ShortPremble); if (pdev_network->Privacy) @@ -431,9 +431,9 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv) ie = rtw_set_ie(ie, _SSID_IE_, pdev_network->Ssid.SsidLength, pdev_network->Ssid.Ssid, &sz); /* supported rates */ - if(pregistrypriv->wireless_mode == WIRELESS_11ABGN) + if (pregistrypriv->wireless_mode == WIRELESS_11ABGN) { - if(pdev_network->Configuration.DSConfig > 14) + if (pdev_network->Configuration.DSConfig > 14) wireless_mode = WIRELESS_11A_5N; else wireless_mode = WIRELESS_11BG_24N; @@ -471,7 +471,7 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv) } /* HT Cap. */ - if(((pregistrypriv->wireless_mode&WIRELESS_11_5N)||(pregistrypriv->wireless_mode&WIRELESS_11_24N)) + if (((pregistrypriv->wireless_mode&WIRELESS_11_5N)||(pregistrypriv->wireless_mode&WIRELESS_11_24N)) && (pregistrypriv->ht_enable==true)) { /* todo: */ @@ -756,7 +756,7 @@ int rtw_get_sec_ie(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16 { authmode=in_ie[cnt]; - if((authmode==_WPA_IE_ID_)&&(_rtw_memcmp(&in_ie[cnt+2], &wpa_oui[0],4)==true)) + if ((authmode==_WPA_IE_ID_)&&(_rtw_memcmp(&in_ie[cnt+2], &wpa_oui[0],4)==true)) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("\n rtw_get_wpa_ie: sec_idx=%d in_ie[cnt+1]+2=%d\n",sec_idx,in_ie[cnt+1]+2)); @@ -775,7 +775,7 @@ int rtw_get_sec_ie(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16 } else { - if(authmode==_WPA2_IE_ID_) + if (authmode==_WPA2_IE_ID_) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("\n get_rsn_ie: sec_idx=%d in_ie[cnt+1]+2=%d\n",sec_idx,in_ie[cnt+1]+2)); @@ -811,11 +811,11 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen) u8 match = false; u8 eid, wps_oui[4]={0x0,0x50,0xf2,0x04}; - if(ie_ptr == NULL) return match; + if (ie_ptr == NULL) return match; eid = ie_ptr[0]; - if((eid==_WPA_IE_ID_)&&(_rtw_memcmp(&ie_ptr[2], wps_oui, 4)==true)) + if ((eid==_WPA_IE_ID_)&&(_rtw_memcmp(&ie_ptr[2], wps_oui, 4)==true)) { /* DBG_8192C("==> found WPS_IE.....\n"); */ *wps_ielen = ie_ptr[1]+2; @@ -861,10 +861,10 @@ u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen) u8 *wpsie_ptr=NULL; u8 eid, wps_oui[4]={0x0,0x50,0xf2,0x04}; - if(wps_ielen) + if (wps_ielen) *wps_ielen = 0; - if(!in_ie || in_len<=0) + if (!in_ie || in_len<=0) return wpsie_ptr; cnt = 0; @@ -873,14 +873,14 @@ u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen) { eid = in_ie[cnt]; - if((eid==_WPA_IE_ID_)&&(_rtw_memcmp(&in_ie[cnt+2], wps_oui, 4)==true)) + if ((eid==_WPA_IE_ID_)&&(_rtw_memcmp(&in_ie[cnt+2], wps_oui, 4)==true)) { wpsie_ptr = &in_ie[cnt]; - if(wps_ie) + if (wps_ie) memcpy(wps_ie, &in_ie[cnt], in_ie[cnt+1]+2); - if(wps_ielen) + if (wps_ielen) *wps_ielen = in_ie[cnt+1]+2; cnt+=in_ie[cnt+1]+2; @@ -913,7 +913,7 @@ u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_att u8 * target_attr_ptr = NULL; u8 wps_oui[4]={0x00,0x50,0xF2,0x04}; - if(len_attr) + if (len_attr) *len_attr = 0; if ( ( wps_ie[0] != _VENDOR_SPECIFIC_IE_ ) || @@ -933,14 +933,14 @@ u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_att u16 attr_len = attr_data_len + 4; /* DBG_871X("%s attr_ptr:%p, id:%u, length:%u\n", __FUNCTION__, attr_ptr, attr_id, attr_data_len); */ - if( attr_id == target_attr_id ) + if ( attr_id == target_attr_id ) { target_attr_ptr = attr_ptr; - if(buf_attr) + if (buf_attr) memcpy(buf_attr, attr_ptr, attr_len); - if(len_attr) + if (len_attr) *len_attr = attr_len; break; @@ -970,17 +970,17 @@ u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 u8 *attr_ptr; u32 attr_len; - if(len_content) + if (len_content) *len_content = 0; attr_ptr = rtw_get_wps_attr(wps_ie, wps_ielen, target_attr_id, NULL, &attr_len); - if(attr_ptr && attr_len) + if (attr_ptr && attr_len) { - if(buf_content) + if (buf_content) memcpy(buf_content, attr_ptr+4, attr_len-4); - if(len_content) + if (len_content) *len_content = attr_len-4; return attr_ptr+4; @@ -1224,7 +1224,7 @@ enum ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, static u8 key_char2num(u8 ch); static u8 key_char2num(u8 ch) { - if((ch>='0')&&(ch<='9')) + if ((ch>='0')&&(ch<='9')) return ch - '0'; else if ((ch>='a')&&(ch<='f')) return ch - 'a' + 10; @@ -1254,7 +1254,7 @@ u8 convert_ip_addr(u8 hch, u8 mch, u8 lch) void rtw_macaddr_cfg(u8 *mac_addr) { u8 mac[ETH_ALEN]; - if(mac_addr == NULL) return; + if (mac_addr == NULL) return; if ( rtw_initmac ) { /* Users specify the mac address */ @@ -1322,7 +1322,7 @@ void dump_wps_ie(u8 *ie, u32 ie_len) uint wps_ielen; wps_ie = rtw_get_wps_ie(ie, ie_len, NULL, &wps_ielen); - if(wps_ie != ie || wps_ielen == 0) + if (wps_ie != ie || wps_ielen == 0) return; pos+=6; @@ -1354,7 +1354,7 @@ u32 rtw_get_p2p_merged_ies_len(u8 *in_ie, u32 in_len) { pIE = (struct ndis_802_11_variable_ies *)(in_ie+ i); - if( pIE->ElementID == _VENDOR_SPECIFIC_IE_ && _rtw_memcmp(pIE->data, OUI, 4) ) + if ( pIE->ElementID == _VENDOR_SPECIFIC_IE_ && _rtw_memcmp(pIE->data, OUI, 4) ) { len += pIE->Length-4; /* 4 is P2P OUI length, don't count it in this loop */ } @@ -1380,7 +1380,7 @@ int rtw_p2p_merge_ies(u8 *in_ie, u32 in_len, u8 *merge_ie) u8 ELOUI[6] = { 0xDD, 0x00, 0x50, 0x6f, 0x9a, 0x09 }; /* EID;Len;OUI, Len would copy at the end of function */ int i=0; - if( merge_ie != NULL) + if ( merge_ie != NULL) { /* Set first P2P OUI */ memcpy(merge_ie, ELOUI, 6); @@ -1391,7 +1391,7 @@ int rtw_p2p_merge_ies(u8 *in_ie, u32 in_len, u8 *merge_ie) pIE = (struct ndis_802_11_variable_ies *)(in_ie+ i); /* Take out the rest of P2P OUIs */ - if( pIE->ElementID == _VENDOR_SPECIFIC_IE_ && _rtw_memcmp(pIE->data, OUI, 4) ) + if ( pIE->ElementID == _VENDOR_SPECIFIC_IE_ && _rtw_memcmp(pIE->data, OUI, 4) ) { memcpy( merge_ie, pIE->data +4, pIE->Length -4); len += pIE->Length-4; @@ -1417,7 +1417,7 @@ void dump_p2p_ie(u8 *ie, u32 ie_len) { uint p2p_ielen; p2p_ie = rtw_get_p2p_ie(ie, ie_len, NULL, &p2p_ielen); - if(p2p_ie != ie || p2p_ielen == 0) + if (p2p_ie != ie || p2p_ielen == 0) return; pos+=6; @@ -1478,7 +1478,7 @@ u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen) dump_stack(); return NULL; } - if( ( eid == _VENDOR_SPECIFIC_IE_ ) && ( _rtw_memcmp( &in_ie[cnt+2], p2p_oui, 4) == true ) ) + if ( ( eid == _VENDOR_SPECIFIC_IE_ ) && ( _rtw_memcmp( &in_ie[cnt+2], p2p_oui, 4) == true ) ) { p2p_ie_ptr = in_ie + cnt; @@ -1523,7 +1523,7 @@ u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 *buf_attr u8 *target_attr_ptr = NULL; u8 p2p_oui[4]={0x50,0x6F,0x9A,0x09}; - if(len_attr) + if (len_attr) *len_attr = 0; if ( !p2p_ie || ( p2p_ie[0] != _VENDOR_SPECIFIC_IE_ ) || @@ -1543,14 +1543,14 @@ u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 *buf_attr u16 attr_len = attr_data_len + 3; /* DBG_871X("%s attr_ptr:%p, id:%u, length:%u\n", __FUNCTION__, attr_ptr, attr_id, attr_data_len); */ - if( attr_id == target_attr_id ) + if ( attr_id == target_attr_id ) { target_attr_ptr = attr_ptr; - if(buf_attr) + if (buf_attr) memcpy(buf_attr, attr_ptr, attr_len); - if(len_attr) + if (len_attr) *len_attr = attr_len; break; @@ -1580,17 +1580,17 @@ u8 *rtw_get_p2p_attr_content(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 * u8 *attr_ptr; u32 attr_len; - if(len_content) + if (len_content) *len_content = 0; attr_ptr = rtw_get_p2p_attr(p2p_ie, p2p_ielen, target_attr_id, NULL, &attr_len); - if(attr_ptr && attr_len) + if (attr_ptr && attr_len) { - if(buf_content) + if (buf_content) memcpy(buf_content, attr_ptr+3, attr_len-3); - if(len_content) + if (len_content) *len_content = attr_len-3; return attr_ptr+3; @@ -1608,7 +1608,7 @@ u32 rtw_set_p2p_attr_content(u8 *pbuf, u8 attr_id, u16 attr_len, u8 *pdata_attr) /* u16*)(pbuf + 1) = cpu_to_le16(attr_len); */ RTW_PUT_LE16(pbuf + 1, attr_len); - if(pdata_attr) + if (pdata_attr) memcpy(pbuf + 3, pdata_attr, attr_len); a_len = attr_len + 3; @@ -1625,7 +1625,7 @@ static uint rtw_p2p_attr_remove(u8 *ie, uint ielen_ori, u8 attr_id) while(1) { target_attr=rtw_get_p2p_attr(ie, ielen, attr_id, NULL, &target_attr_len); - if(target_attr && target_attr_len) + if (target_attr && target_attr_len) { u8 *next_attr = target_attr+target_attr_len; uint remain_len = ielen-(next_attr-ie); @@ -1651,10 +1651,10 @@ void rtw_wlan_bssid_ex_remove_p2p_attr(struct wlan_bssid_ex *bss_ex, u8 attr_id) uint p2p_ielen, p2p_ielen_ori; int cnt; - if( (p2p_ie=rtw_get_p2p_ie(bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_, NULL, &p2p_ielen_ori)) ) + if ( (p2p_ie=rtw_get_p2p_ie(bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_, NULL, &p2p_ielen_ori)) ) { p2p_ielen=rtw_p2p_attr_remove(p2p_ie, p2p_ielen_ori, attr_id); - if(p2p_ielen != p2p_ielen_ori) { + if (p2p_ielen != p2p_ielen_ori) { u8 *next_ie_ori = p2p_ie+p2p_ielen_ori; u8 *next_ie = p2p_ie+p2p_ielen; @@ -1679,7 +1679,7 @@ void dump_wfd_ie(u8 *ie, u32 ie_len) u8 *wfd_ie; uint wfd_ielen; - if(rtw_get_wfd_ie(ie, ie_len, NULL, &wfd_ielen) == false) + if (rtw_get_wfd_ie(ie, ie_len, NULL, &wfd_ielen) == false) return; pos+=6; @@ -1711,7 +1711,7 @@ int rtw_get_wfd_ie(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen) { eid = in_ie[cnt]; - if( ( eid == _VENDOR_SPECIFIC_IE_ ) && ( _rtw_memcmp( &in_ie[cnt+2], wfd_oui, 4) == true ) ) + if ( ( eid == _VENDOR_SPECIFIC_IE_ ) && ( _rtw_memcmp( &in_ie[cnt+2], wfd_oui, 4) == true ) ) { if ( wfd_ie != NULL ) { @@ -1800,13 +1800,13 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 * u16 attrlen = RTW_GET_BE16(wfd_ie + cnt + 1); attr_id = wfd_ie[cnt]; - if( attr_id == target_attr_id ) + if ( attr_id == target_attr_id ) { /* 3 -> 1 byte for attribute ID field, 2 bytes for length field */ - if(attr_content) + if (attr_content) memcpy( attr_content, &wfd_ie[ cnt + 3 ], attrlen ); - if(attr_contentlen) + if (attr_contentlen) *attr_contentlen = attrlen; cnt += attrlen + 3; @@ -1878,7 +1878,7 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork) int ret = _FAIL; pbuf = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength-12); - if(pbuf && (wpa_ielen>0)) { + if (pbuf && (wpa_ielen>0)) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_get_cipher_info: wpa_ielen: %d", wpa_ielen)); if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) { @@ -1893,7 +1893,7 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork) pbuf = rtw_get_wpa2_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength-12); - if(pbuf && (wpa_ielen>0)) { + if (pbuf && (wpa_ielen>0)) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("get RSN IE\n")); if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("get RSN IE OK!!!\n")); @@ -1954,7 +1954,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork) /* get bwmode and ch_offset */ /* parsing HT_CAP_IE */ p = rtw_get_ie(pnetwork->network.IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pnetwork->network.IELength - _FIXED_IE_LENGTH_); - if(p && len>0) { + if (p && len>0) { pht_cap = (struct ieee80211_ht_cap *)(p + 2); pnetwork->BcnInfo.ht_cap_info = le16_to_cpu(pht_cap->cap_info); } else { @@ -1962,7 +1962,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork) } /* parsing HT_INFO_IE */ p = rtw_get_ie(pnetwork->network.IEs + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, &len, pnetwork->network.IELength - _FIXED_IE_LENGTH_); - if(p && len>0) { + if (p && len>0) { pht_info = (struct HT_info_element *)(p + 2); pnetwork->BcnInfo.ht_info_infos_0 = pht_info->infos[0]; } else { @@ -1975,63 +1975,63 @@ u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40, unsign { u16 max_rate = 0; - if(rf_type == RF_1T1R) + if (rf_type == RF_1T1R) { - if(MCS_rate[0] & BIT(7)) + if (MCS_rate[0] & BIT(7)) max_rate = (bw_40MHz) ? ((short_GI_40)?1500:1350):((short_GI_20)?722:650); - else if(MCS_rate[0] & BIT(6)) + else if (MCS_rate[0] & BIT(6)) max_rate = (bw_40MHz) ? ((short_GI_40)?1350:1215):((short_GI_20)?650:585); - else if(MCS_rate[0] & BIT(5)) + else if (MCS_rate[0] & BIT(5)) max_rate = (bw_40MHz) ? ((short_GI_40)?1200:1080):((short_GI_20)?578:520); - else if(MCS_rate[0] & BIT(4)) + else if (MCS_rate[0] & BIT(4)) max_rate = (bw_40MHz) ? ((short_GI_40)?900:810):((short_GI_20)?433:390); - else if(MCS_rate[0] & BIT(3)) + else if (MCS_rate[0] & BIT(3)) max_rate = (bw_40MHz) ? ((short_GI_40)?600:540):((short_GI_20)?289:260); - else if(MCS_rate[0] & BIT(2)) + else if (MCS_rate[0] & BIT(2)) max_rate = (bw_40MHz) ? ((short_GI_40)?450:405):((short_GI_20)?217:195); - else if(MCS_rate[0] & BIT(1)) + else if (MCS_rate[0] & BIT(1)) max_rate = (bw_40MHz) ? ((short_GI_40)?300:270):((short_GI_20)?144:130); - else if(MCS_rate[0] & BIT(0)) + else if (MCS_rate[0] & BIT(0)) max_rate = (bw_40MHz) ? ((short_GI_40)?150:135):((short_GI_20)?72:65); } else { - if(MCS_rate[1]) + if (MCS_rate[1]) { - if(MCS_rate[1] & BIT(7)) + if (MCS_rate[1] & BIT(7)) max_rate = (bw_40MHz) ? ((short_GI_40)?3000:2700):((short_GI_20)?1444:1300); - else if(MCS_rate[1] & BIT(6)) + else if (MCS_rate[1] & BIT(6)) max_rate = (bw_40MHz) ? ((short_GI_40)?2700:2430):((short_GI_20)?1300:1170); - else if(MCS_rate[1] & BIT(5)) + else if (MCS_rate[1] & BIT(5)) max_rate = (bw_40MHz) ? ((short_GI_40)?2400:2160):((short_GI_20)?1156:1040); - else if(MCS_rate[1] & BIT(4)) + else if (MCS_rate[1] & BIT(4)) max_rate = (bw_40MHz) ? ((short_GI_40)?1800:1620):((short_GI_20)?867:780); - else if(MCS_rate[1] & BIT(3)) + else if (MCS_rate[1] & BIT(3)) max_rate = (bw_40MHz) ? ((short_GI_40)?1200:1080):((short_GI_20)?578:520); - else if(MCS_rate[1] & BIT(2)) + else if (MCS_rate[1] & BIT(2)) max_rate = (bw_40MHz) ? ((short_GI_40)?900:810):((short_GI_20)?433:390); - else if(MCS_rate[1] & BIT(1)) + else if (MCS_rate[1] & BIT(1)) max_rate = (bw_40MHz) ? ((short_GI_40)?600:540):((short_GI_20)?289:260); - else if(MCS_rate[1] & BIT(0)) + else if (MCS_rate[1] & BIT(0)) max_rate = (bw_40MHz) ? ((short_GI_40)?300:270):((short_GI_20)?144:130); } else { - if(MCS_rate[0] & BIT(7)) + if (MCS_rate[0] & BIT(7)) max_rate = (bw_40MHz) ? ((short_GI_40)?1500:1350):((short_GI_20)?722:650); - else if(MCS_rate[0] & BIT(6)) + else if (MCS_rate[0] & BIT(6)) max_rate = (bw_40MHz) ? ((short_GI_40)?1350:1215):((short_GI_20)?650:585); - else if(MCS_rate[0] & BIT(5)) + else if (MCS_rate[0] & BIT(5)) max_rate = (bw_40MHz) ? ((short_GI_40)?1200:1080):((short_GI_20)?578:520); - else if(MCS_rate[0] & BIT(4)) + else if (MCS_rate[0] & BIT(4)) max_rate = (bw_40MHz) ? ((short_GI_40)?900:810):((short_GI_20)?433:390); - else if(MCS_rate[0] & BIT(3)) + else if (MCS_rate[0] & BIT(3)) max_rate = (bw_40MHz) ? ((short_GI_40)?600:540):((short_GI_20)?289:260); - else if(MCS_rate[0] & BIT(2)) + else if (MCS_rate[0] & BIT(2)) max_rate = (bw_40MHz) ? ((short_GI_40)?450:405):((short_GI_20)?217:195); - else if(MCS_rate[0] & BIT(1)) + else if (MCS_rate[0] & BIT(1)) max_rate = (bw_40MHz) ? ((short_GI_40)?300:270):((short_GI_20)?144:130); - else if(MCS_rate[0] & BIT(0)) + else if (MCS_rate[0] & BIT(0)) max_rate = (bw_40MHz) ? ((short_GI_40)?150:135):((short_GI_20)?72:65); } } diff --git a/core/rtw_io.c b/core/rtw_io.c index afaf8c7..8622f04 100644 --- a/core/rtw_io.c +++ b/core/rtw_io.c @@ -213,7 +213,7 @@ void _rtw_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem) struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); - if( (adapter->bDriverStopped) || (adapter->bSurpriseRemoved)) { + if ( (adapter->bDriverStopped) || (adapter->bSurpriseRemoved)) { RT_TRACE(_module_rtl871x_io_c_, _drv_info_, ("rtw_read_port:bDriverStopped(%d) OR bSurpriseRemoved(%d)", adapter->bDriverStopped, adapter->bSurpriseRemoved)); @@ -233,7 +233,7 @@ void _rtw_read_port_cancel(struct adapter *adapter) _read_port_cancel = pintfhdl->io_ops._read_port_cancel; - if(_read_port_cancel) + if (_read_port_cancel) _read_port_cancel(pintfhdl); } @@ -273,7 +273,7 @@ void _rtw_write_port_cancel(struct adapter *adapter) _write_port_cancel = pintfhdl->io_ops._write_port_cancel; - if(_write_port_cancel) + if (_write_port_cancel) _write_port_cancel(pintfhdl); } @@ -304,7 +304,7 @@ int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj) { int ret = false; int value; - if( (value=ATOMIC_INC_RETURN(&dvobj->continual_io_error)) > MAX_CONTINUAL_IO_ERR) { + if ( (value=ATOMIC_INC_RETURN(&dvobj->continual_io_error)) > MAX_CONTINUAL_IO_ERR) { DBG_871X("[dvobj:%p][ERROR] continual_io_error:%d > %d\n", dvobj, value, MAX_CONTINUAL_IO_ERR); ret = true; } else { diff --git a/core/rtw_ioctl_set.c b/core/rtw_ioctl_set.c index 8ade222..9167378 100644 --- a/core/rtw_ioctl_set.c +++ b/core/rtw_ioctl_set.c @@ -68,7 +68,7 @@ u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid) for(i = 0; i < ssid->SsidLength; i++) { /* wifi, printable ascii code must be supported */ - if(!( (ssid->Ssid[i] >= 0x20) && (ssid->Ssid[i] <= 0x7e) )){ + if (!( (ssid->Ssid[i] >= 0x20) && (ssid->Ssid[i] <= 0x7e) )){ RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("ssid has nonprintabl ascii\n")); ret= false; break; @@ -109,7 +109,7 @@ u8 rtw_do_join(struct adapter * padapter) pmlmepriv->to_join = true; - if(_rtw_queue_empty(queue)== true) + if (_rtw_queue_empty(queue)== true) { spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); @@ -123,7 +123,7 @@ u8 rtw_do_join(struct adapter * padapter) { RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_do_join(): site survey if scanned_queue is empty\n.")); /* submit site_survey_cmd */ - if(_SUCCESS!=(ret=rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) ) { + if (_SUCCESS!=(ret=rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) ) { pmlmepriv->to_join = false; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("rtw_do_join(): site survey return error\n.")); } @@ -140,14 +140,14 @@ u8 rtw_do_join(struct adapter * padapter) { int select_ret; spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); - if((select_ret=rtw_select_and_join_from_scanned_queue(pmlmepriv))==_SUCCESS) + if ((select_ret=rtw_select_and_join_from_scanned_queue(pmlmepriv))==_SUCCESS) { pmlmepriv->to_join = false; _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); } else { - if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==true) + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==true) { /* submit createbss_cmd to change to a ADHOC_MASTER */ @@ -165,7 +165,7 @@ u8 rtw_do_join(struct adapter * padapter) rtw_generate_random_ibss(pibss); - if(rtw_createbss_cmd(padapter)!=_SUCCESS) + if (rtw_createbss_cmd(padapter)!=_SUCCESS) { RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("***Error=>do_goin: rtw_createbss_cmd status FAIL***\n ")); ret = false; @@ -182,12 +182,12 @@ u8 rtw_do_join(struct adapter * padapter) /* when set_ssid/set_bssid for rtw_do_join(), but there are no desired bss in scanning queue */ /* we try to issue sitesurvey firstly */ - if(pmlmepriv->LinkDetectInfo.bBusyTraffic==false + if (pmlmepriv->LinkDetectInfo.bBusyTraffic==false || rtw_to_roaming(padapter) > 0 ) { /* DBG_871X("rtw_do_join() when no desired bss in scanning queue\n"); */ - if( _SUCCESS!=(ret=rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) ){ + if ( _SUCCESS!=(ret=rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) ){ pmlmepriv->to_join = false; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("do_join(): site survey return error\n.")); } @@ -308,7 +308,7 @@ u8 rtw_set_802_11_ssid(struct adapter* padapter, struct ndis_802_11_ssid *ssid) DBG_871X_LEVEL(_drv_always_, "set ssid [%s] fw_state=0x%08x\n", ssid->Ssid, get_fwstate(pmlmepriv)); - if(padapter->hw_init_completed==false){ + if (padapter->hw_init_completed==false){ RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("set_ssid: hw_init_completed==false=>exit!!!\n")); status = _FAIL; @@ -332,13 +332,13 @@ u8 rtw_set_802_11_ssid(struct adapter* padapter, struct ndis_802_11_ssid *ssid) if ((pmlmepriv->assoc_ssid.SsidLength == ssid->SsidLength) && (_rtw_memcmp(&pmlmepriv->assoc_ssid.Ssid, ssid->Ssid, ssid->SsidLength) == true)) { - if((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == false)) + if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == false)) { RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("Set SSID is the same ssid, fw_state=0x%08x\n", get_fwstate(pmlmepriv))); - if(rtw_is_same_ibss(padapter, pnetwork) == false) { + if (rtw_is_same_ibss(padapter, pnetwork) == false) { /* if in WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE, create bss or rejoin again */ rtw_disassoc_cmd(padapter, 0, true); @@ -434,7 +434,7 @@ u8 rtw_set_802_11_connect(struct adapter* padapter, u8 *bssid, struct ndis_802_1 goto exit; } - if(padapter->hw_init_completed==false){ + if (padapter->hw_init_completed==false){ RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("set_ssid: hw_init_completed==false=>exit!!!\n")); status = _FAIL; @@ -497,30 +497,30 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter* padapter, ("+rtw_set_802_11_infrastructure_mode: old=%d new=%d fw_state=0x%08x\n", *pold_state, networktype, get_fwstate(pmlmepriv))); - if(*pold_state != networktype) + if (*pold_state != networktype) { spin_lock_bh(&pmlmepriv->lock); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,(" change mode!")); /* DBG_871X("change mode, old_mode=%d, new_mode=%d, fw_state=0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); */ - if(*pold_state==Ndis802_11APMode) { + if (*pold_state==Ndis802_11APMode) { /* change to other mode from Ndis802_11APMode */ cur_network->join_res = -1; stop_ap_mode(padapter); } - if((check_fwstate(pmlmepriv, _FW_LINKED)== true) ||(*pold_state==Ndis802_11IBSS)) + if ((check_fwstate(pmlmepriv, _FW_LINKED)== true) ||(*pold_state==Ndis802_11IBSS)) rtw_disassoc_cmd(padapter, 0, true); - if((check_fwstate(pmlmepriv, _FW_LINKED)== true) || + if ((check_fwstate(pmlmepriv, _FW_LINKED)== true) || (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)== true) ) rtw_free_assoc_resources(padapter, 1); - if((*pold_state == Ndis802_11Infrastructure) ||(*pold_state == Ndis802_11IBSS)) + if ((*pold_state == Ndis802_11Infrastructure) ||(*pold_state == Ndis802_11IBSS)) { - if(check_fwstate(pmlmepriv, _FW_LINKED) == true) + if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { rtw_indicate_disconnect(padapter); /* will clr Linked_state; before this function, we must have chked whether issue dis-assoc_cmd or not */ } @@ -615,7 +615,7 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter* padapter, struct ndis_802_11_s RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("rtw_set_802_11_bssid_list_scan fail since fw_state = %x\n", get_fwstate(pmlmepriv))); res = true; - if(check_fwstate(pmlmepriv, (_FW_UNDER_SURVEY|_FW_UNDER_LINKING))== true){ + if (check_fwstate(pmlmepriv, (_FW_UNDER_SURVEY|_FW_UNDER_LINKING))== true){ RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n###_FW_UNDER_SURVEY|_FW_UNDER_LINKING\n\n")); } else { RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n###pmlmepriv->sitesurveyctrl.traffic_busy==true\n\n")); @@ -650,12 +650,12 @@ u8 rtw_set_802_11_authentication_mode(struct adapter* padapter, enum NDIS_802_11 RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_authentication_mode:psecuritypriv->ndisauthtype=%d", psecuritypriv->ndisauthtype)); - if(psecuritypriv->ndisauthtype>3) + if (psecuritypriv->ndisauthtype>3) psecuritypriv->dot11AuthAlgrthm=dot11AuthAlgrthm_8021X; res=rtw_set_auth(padapter,psecuritypriv); - if(res==_SUCCESS) + if (res==_SUCCESS) ret=true; else ret=false; @@ -677,7 +677,7 @@ u8 rtw_set_802_11_add_wep(struct adapter* padapter, struct ndis_802_11_wep *wep) btransmitkey= (wep->KeyIndex & 0x80000000) > 0 ? true : false; /* for ??? */ keyid=wep->KeyIndex & 0x3fffffff; - if(keyid>4) + if (keyid>4) { RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("MgntActrtw_set_802_11_add_wep:keyid>4=>fail\n")); ret=false; @@ -718,7 +718,7 @@ u8 rtw_set_802_11_add_wep(struct adapter* padapter, struct ndis_802_11_wep *wep) res=rtw_set_key(padapter,psecuritypriv, keyid, 1,true); - if(res==_FAIL) + if (res==_FAIL) ret= false; exit: @@ -744,7 +744,7 @@ u8 rtw_set_802_11_remove_wep(struct adapter* padapter, u32 keyindex){ { int res; struct security_priv* psecuritypriv=&(padapter->securitypriv); - if( keyindex < 4 ){ + if ( keyindex < 4 ){ memset(&psecuritypriv->dot11DefKey[keyindex], 0, 16); @@ -752,7 +752,7 @@ u8 rtw_set_802_11_remove_wep(struct adapter* padapter, u32 keyindex){ psecuritypriv->dot11DefKeylen[keyindex]=0; - if(res==_FAIL) + if (res==_FAIL) ret=_FAIL; } @@ -793,7 +793,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) goto exit; } - if(key->KeyIndex & 0x40000000) + if (key->KeyIndex & 0x40000000) { /* Pairwise key */ @@ -802,7 +802,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) pbssid=get_bssid(&padapter->mlmepriv); stainfo=rtw_get_stainfo(&padapter->stapriv, pbssid); - if((stainfo!=NULL)&&(padapter->securitypriv.dot11AuthAlgrthm==dot11AuthAlgrthm_8021X)){ + if ((stainfo!=NULL)&&(padapter->securitypriv.dot11AuthAlgrthm==dot11AuthAlgrthm_8021X)){ RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY:( stainfo!=NULL)&&(Adapter->securitypriv.dot11AuthAlgrthm==dot11AuthAlgrthm_8021X)\n")); encryptionalgo=stainfo->dot118021XPrivacy; } @@ -815,11 +815,11 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("rtw_set_802_11_add_key: (Adapter->securitypriv.dot11PrivacyAlgrthm ==%d)!\n",padapter->securitypriv.dot11PrivacyAlgrthm)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("rtw_set_802_11_add_key: (Adapter->securitypriv.dot11AuthAlgrthm ==%d)!\n",padapter->securitypriv.dot11AuthAlgrthm)); - if((stainfo!=NULL)){ + if ((stainfo!=NULL)){ RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("rtw_set_802_11_add_key: (stainfo->dot118021XPrivacy ==%d)!\n", stainfo->dot118021XPrivacy)); } - if(key->KeyIndex & 0x000000FF){ + if (key->KeyIndex & 0x000000FF){ /* The key index is specified in the lower 8 bits by values of zero to 255. */ /* The key index should be set to zero for a Pairwise key, and the driver should fail with */ /* NDIS_STATUS_INVALID_DATA if the lower 8 bits is not zero */ @@ -837,8 +837,8 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) } /* Check key length for TKIP. */ - /* if(encryptionAlgorithm == RT_ENC_TKIP_ENCRYPTION && key->KeyLength != 32) */ - if((encryptionalgo== _TKIP_)&& (key->KeyLength != 32)){ + /* if (encryptionAlgorithm == RT_ENC_TKIP_ENCRYPTION && key->KeyLength != 32) */ + if ((encryptionalgo== _TKIP_)&& (key->KeyLength != 32)){ RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("TKIP KeyLength:0x%x != 32\n", key->KeyLength)); ret=_FAIL; goto exit; @@ -846,9 +846,9 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) } /* Check key length for AES. */ - if((encryptionalgo== _AES_)&& (key->KeyLength != 16)) { + if ((encryptionalgo== _AES_)&& (key->KeyLength != 16)) { /* For our supplicant, EAPPkt9x.vxd, cannot differentiate TKIP and AES case. */ - if(key->KeyLength == 32) { + if (key->KeyLength == 32) { key->KeyLength = 16; } else { ret= _FAIL; @@ -878,7 +878,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ Group key +++++\n")); /* when add wep key through add key and didn't assigned encryption type before */ - if((padapter->securitypriv.ndisauthtype<=3)&&(padapter->securitypriv.dot118021XGrpPrivacy==0)) + if ((padapter->securitypriv.ndisauthtype<=3)&&(padapter->securitypriv.dot118021XGrpPrivacy==0)) { RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("keylen=%d( Adapter->securitypriv.dot11PrivacyAlgrthm=%x )padapter->securitypriv.dot118021XGrpPrivacy(%x)\n", key->KeyLength,padapter->securitypriv.dot11PrivacyAlgrthm,padapter->securitypriv.dot118021XGrpPrivacy)); @@ -910,20 +910,20 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) } - if((check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE)==true) && (IS_MAC_ADDRESS_BROADCAST(key->BSSID) == false)) { + if ((check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE)==true) && (IS_MAC_ADDRESS_BROADCAST(key->BSSID) == false)) { RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,(" IBSS but BSSID is not Broadcast Address.\n")); ret= _FAIL; goto exit; } /* Check key length for TKIP */ - if((encryptionalgo== _TKIP_) && (key->KeyLength != 32)) { + if ((encryptionalgo== _TKIP_) && (key->KeyLength != 32)) { RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,(" TKIP GTK KeyLength:%u != 32\n", key->KeyLength)); ret= _FAIL; goto exit; - } else if(encryptionalgo== _AES_ && (key->KeyLength != 16 && key->KeyLength != 32) ) { + } else if (encryptionalgo== _AES_ && (key->KeyLength != 16 && key->KeyLength != 32) ) { /* Check key length for AES */ /* For NDTEST, we allow keylen=32 in this case. 2005.01.27, by rcnjko. */ @@ -933,16 +933,16 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) } /* Change the key length for EAPPkt9x.vxd. Added by Annie, 2005-11-03. */ - if((encryptionalgo== _AES_) && (key->KeyLength == 32) ) { + if ((encryptionalgo== _AES_) && (key->KeyLength == 32) ) { key->KeyLength = 16; RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("AES key length changed: %u\n", key->KeyLength) ); } - if(key->KeyIndex & 0x8000000) {/* error ??? 0x8000_0000 */ + if (key->KeyIndex & 0x8000000) {/* error ??? 0x8000_0000 */ bgrouptkey = true; } - if((check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE)==true)&&(check_fwstate(&padapter->mlmepriv, _FW_LINKED)==true)) + if ((check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE)==true)&&(check_fwstate(&padapter->mlmepriv, _FW_LINKED)==true)) { bgrouptkey = true; } @@ -959,7 +959,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) } /* If WEP encryption algorithm, just call rtw_set_802_11_add_wep(). */ - if((padapter->securitypriv.dot11AuthAlgrthm !=dot11AuthAlgrthm_8021X)&&(encryptionalgo== _WEP40_ || encryptionalgo== _WEP104_)) + if ((padapter->securitypriv.dot11AuthAlgrthm !=dot11AuthAlgrthm_8021X)&&(encryptionalgo== _WEP40_ || encryptionalgo== _WEP104_)) { u8 ret; u32 keyindex; @@ -987,10 +987,10 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) } - if(key->KeyIndex & 0x20000000){ + if (key->KeyIndex & 0x20000000){ /* SetRSC */ RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ SetRSC+++++\n")); - if(bgroup == true) + if (bgroup == true) { unsigned long long keysrc=key->KeyRSC & 0x00FFFFFFFFFFFFULL; memcpy(&padapter->securitypriv.dot11Grprxpn, &keysrc, 8); @@ -1005,16 +1005,16 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) /* Indicate this key idx is used for TX */ /* Save the key in KeyMaterial */ - if(bgroup == true) /* Group transmit key */ + if (bgroup == true) /* Group transmit key */ { int res; - if(bgrouptkey == true) + if (bgrouptkey == true) { padapter->securitypriv.dot118021XGrpKeyid=(u8)key->KeyIndex; } - if((key->KeyIndex&0x3) == 0){ + if ((key->KeyIndex&0x3) == 0){ ret = _FAIL; goto exit; } @@ -1023,7 +1023,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) memset(&padapter->securitypriv.dot118021XGrptxmickey[(u8)((key->KeyIndex) & 0x03)], 0, 16); memset(&padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)], 0, 16); - if((key->KeyIndex & 0x10000000)) + if ((key->KeyIndex & 0x10000000)) { memcpy(&padapter->securitypriv.dot118021XGrptxmickey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial + 16, 8); memcpy(&padapter->securitypriv.dot118021XGrprxmickey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial + 24, 8); @@ -1063,7 +1063,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) res=rtw_set_key(padapter,&padapter->securitypriv, key->KeyIndex, 1,true); - if(res==_FAIL) + if (res==_FAIL) ret= _FAIL; goto exit; @@ -1076,13 +1076,13 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) pbssid=get_bssid(&padapter->mlmepriv); stainfo=rtw_get_stainfo(&padapter->stapriv , pbssid ); - if(stainfo!=NULL) + if (stainfo!=NULL) { memset( &stainfo->dot118021x_UncstKey, 0, 16);/* clear keybuffer */ memcpy(&stainfo->dot118021x_UncstKey, key->KeyMaterial, 16); - if(encryptionalgo== _TKIP_) + if (encryptionalgo== _TKIP_) { padapter->securitypriv.busetkipkey=false; @@ -1091,7 +1091,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n ==========_set_timer\n")); /* if TKIP, save the Receive/Transmit MIC key in KeyMaterial[128-255] */ - if((key->KeyIndex & 0x10000000)){ + if ((key->KeyIndex & 0x10000000)){ memcpy(&stainfo->dot11tkiptxmickey, key->KeyMaterial + 16, 8); memcpy(&stainfo->dot11tkiprxmickey, key->KeyMaterial + 24, 8); @@ -1102,14 +1102,14 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) } } - else if(encryptionalgo == _AES_) + else if (encryptionalgo == _AES_) { } /* Set key to CAM through H2C command */ - if(bgrouptkey)/* never go to here */ + if (bgrouptkey)/* never go to here */ { res=rtw_setstakey_cmd(padapter, (unsigned char *)stainfo, false, true); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(group)\n")); @@ -1119,7 +1119,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, struct ndis_802_11_key *key) RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(unicast)\n")); } - if(res ==false) + if (res ==false) ret= _FAIL; } @@ -1161,7 +1161,7 @@ u8 rtw_set_802_11_remove_key(struct adapter* padapter, struct ndis_802_11_remove } else { pbssid=get_bssid(&padapter->mlmepriv); stainfo=rtw_get_stainfo(&padapter->stapriv , pbssid ); - if(stainfo !=NULL){ + if (stainfo !=NULL){ encryptionalgo=stainfo->dot118021XPrivacy; /* clear key by BSSID */ @@ -1200,13 +1200,13 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) u16 mcs_rate=0; u32 ht_ielen = 0; - if((check_fwstate(pmlmepriv, _FW_LINKED) != true) + if ((check_fwstate(pmlmepriv, _FW_LINKED) != true) && (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) != true)) return 0; if (pmlmeext->cur_wireless_mode & (WIRELESS_11_24N|WIRELESS_11_5N)) { p = rtw_get_ie(&pcur_bss->IEs[12], _HT_CAPABILITY_IE_, &ht_ielen, pcur_bss->IELength-12); - if(p && ht_ielen>0) + if (p && ht_ielen>0) { pht_capie = (struct ieee80211_ht_cap *)(p+2); @@ -1235,7 +1235,7 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) while( (pcur_bss->SupportedRates[i]!=0) && (pcur_bss->SupportedRates[i]!=0xFF)) { rate = pcur_bss->SupportedRates[i]&0x7F; - if(rate>max_rate) + if (rate>max_rate) max_rate = rate; i++; } @@ -1255,7 +1255,7 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) */ int rtw_set_scan_mode(struct adapter *adapter, RT_SCAN_TYPE scan_mode) { - if(scan_mode != SCAN_ACTIVE && scan_mode != SCAN_PASSIVE) + if (scan_mode != SCAN_ACTIVE && scan_mode != SCAN_PASSIVE) return _FAIL; adapter->mlmepriv.scan_mode = scan_mode; @@ -1294,15 +1294,15 @@ int rtw_set_country(struct adapter *adapter, const char *country_code) /* TODO: should have a table to match country code and RT_CHANNEL_DOMAIN */ /* TODO: should consider 2-character and 3-character country code */ - if(0 == strcmp(country_code, "US")) + if (0 == strcmp(country_code, "US")) channel_plan = RT_CHANNEL_DOMAIN_FCC; - else if(0 == strcmp(country_code, "EU")) + else if (0 == strcmp(country_code, "EU")) channel_plan = RT_CHANNEL_DOMAIN_ETSI; - else if(0 == strcmp(country_code, "JP")) + else if (0 == strcmp(country_code, "JP")) channel_plan = RT_CHANNEL_DOMAIN_MKK; - else if(0 == strcmp(country_code, "CN")) + else if (0 == strcmp(country_code, "CN")) channel_plan = RT_CHANNEL_DOMAIN_CHINA; - else if(0 == strcmp(country_code, "IN")) + else if (0 == strcmp(country_code, "IN")) channel_plan = RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN; else DBG_871X("%s unknown country_code:%s\n", __FUNCTION__, country_code); diff --git a/core/rtw_iol.c b/core/rtw_iol.c index 9852cac..ba508fa 100644 --- a/core/rtw_iol.c +++ b/core/rtw_iol.c @@ -67,7 +67,7 @@ int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len ori_len = buf_offset+pattrib->pktlen; /* check if the io_buf can accommodate new cmds */ - if(ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) { + if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) { DBG_871X("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", __FUNCTION__ , ori_len + cmd_len + 8, MAX_XMITBUF_SZ); return _FAIL; @@ -83,10 +83,10 @@ int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len } bool rtw_IOL_applied(struct adapter *adapter) { - if(1 == adapter->registrypriv.fw_iol) + if (1 == adapter->registrypriv.fw_iol) return true; - if((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed)) + if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed)) return true; return false; } @@ -109,7 +109,7 @@ int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 cmd.address = cpu_to_le16(addr); cmd.data = cpu_to_le32(value); - if(mask!=0xFF) + if (mask!=0xFF) { cmd.length = 12; /* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */ @@ -130,7 +130,7 @@ int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u cmd.address = cpu_to_le16(addr); cmd.data = cpu_to_le32(value); - if(mask!=0xFFFF) + if (mask!=0xFFFF) { cmd.length = 12; /* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */ @@ -151,7 +151,7 @@ int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u cmd.address = cpu_to_le16(addr); cmd.data = cpu_to_le32(value); - if(mask!=0xFFFFFFFF) + if (mask!=0xFFFFFFFF) { cmd.length = 12; /* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */ @@ -173,7 +173,7 @@ int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, cmd.address = cpu_to_le16((rf_path<<8) |((addr) &0xFF)); cmd.data = cpu_to_le32(value); - if(mask!=0x000FFFFF) + if (mask!=0x000FFFFF) { cmd.length = 12; /* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */ @@ -219,7 +219,7 @@ int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame) u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame) { u8 is_cmd_bndy = false; - if(((pxmit_frame->attrib.pktlen+32)%256) + 8 >= 256){ + if (((pxmit_frame->attrib.pktlen+32)%256) + 8 >= 256){ rtw_IOL_append_END_cmd(pxmit_frame); pxmit_frame->attrib.pktlen = ((((pxmit_frame->attrib.pktlen+32)/256)+1)*256 ); @@ -239,7 +239,7 @@ void rtw_IOL_cmd_buf_dump(struct adapter *Adapter,int buf_len,u8 *pbuf) for(i=0;i< buf_len;i++){ printk("%02x-",*(pbuf+i)); - if(j%32 ==0) printk("\n");j++; + if (j%32 ==0) printk("\n");j++; } printk("\n"); printk("============= ioreg_cmd len = %d ===============\n",buf_len); diff --git a/core/rtw_led.c b/core/rtw_led.c index 414781c..e7c46b3 100644 --- a/core/rtw_led.c +++ b/core/rtw_led.c @@ -32,7 +32,7 @@ void BlinkTimerCallback(void *data) /* DBG_871X("%s\n", __FUNCTION__); */ - if( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) + if ( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) { /* DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped); */ return; @@ -123,7 +123,7 @@ static void SwLedBlink(PLED_871x pLed) u8 bStopBlinking = false; /* Change LED according to BlinkingLedState specified. */ - if( pLed->BlinkingLedState == RTW_LED_ON ) + if ( pLed->BlinkingLedState == RTW_LED_ON ) { SwLedOn(padapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); @@ -140,30 +140,30 @@ static void SwLedBlink(PLED_871x pLed) { case LED_BLINK_NORMAL: - if(pLed->BlinkTimes == 0) + if (pLed->BlinkTimes == 0) { bStopBlinking = true; } break; case LED_BLINK_StartToBlink: - if( check_fwstate(pmlmepriv, _FW_LINKED) && check_fwstate(pmlmepriv, WIFI_STATION_STATE) ) + if ( check_fwstate(pmlmepriv, _FW_LINKED) && check_fwstate(pmlmepriv, WIFI_STATION_STATE) ) { bStopBlinking = true; } - if( check_fwstate(pmlmepriv, _FW_LINKED) && + if ( check_fwstate(pmlmepriv, _FW_LINKED) && (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) ) { bStopBlinking = true; } - else if(pLed->BlinkTimes == 0) + else if (pLed->BlinkTimes == 0) { bStopBlinking = true; } break; case LED_BLINK_WPS: - if( pLed->BlinkTimes == 0 ) + if ( pLed->BlinkTimes == 0 ) { bStopBlinking = true; } @@ -176,18 +176,18 @@ static void SwLedBlink(PLED_871x pLed) } - if(bStopBlinking) + if (bStopBlinking) { - /* if(adapter_to_pwrctl(padapter)->cpwm >= PS_STATE_S2) */ - if(0) + /* if (adapter_to_pwrctl(padapter)->cpwm >= PS_STATE_S2) */ + if (0) { SwLedOff(padapter, pLed); } - else if( (check_fwstate(pmlmepriv, _FW_LINKED)== true) && (pLed->bLedOn == false)) + else if ( (check_fwstate(pmlmepriv, _FW_LINKED)== true) && (pLed->bLedOn == false)) { SwLedOn(padapter, pLed); } - else if( (check_fwstate(pmlmepriv, _FW_LINKED)== true) && pLed->bLedOn == true) + else if ( (check_fwstate(pmlmepriv, _FW_LINKED)== true) && pLed->bLedOn == true) { SwLedOff(padapter, pLed); } @@ -198,7 +198,7 @@ static void SwLedBlink(PLED_871x pLed) else { /* Assign LED state to toggle. */ - if( pLed->BlinkingLedState == RTW_LED_ON ) + if ( pLed->BlinkingLedState == RTW_LED_ON ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -217,7 +217,7 @@ static void SwLedBlink(PLED_871x pLed) case LED_BLINK_WPS: { - if( pLed->BlinkingLedState == RTW_LED_ON ) + if ( pLed->BlinkingLedState == RTW_LED_ON ) _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL); else _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL); @@ -240,7 +240,7 @@ static void SwLedBlink1(PLED_871x pLed) u8 bStopBlinking = false; /* Change LED according to BlinkingLedState specified. */ - if( pLed->BlinkingLedState == RTW_LED_ON ) + if ( pLed->BlinkingLedState == RTW_LED_ON ) { SwLedOn(padapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn on\n", pLed->BlinkTimes)); @@ -251,7 +251,7 @@ static void SwLedBlink1(PLED_871x pLed) RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); } - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) { SwLedOff(padapter, pLed); ResetLedStatus(pLed); @@ -261,7 +261,7 @@ static void SwLedBlink1(PLED_871x pLed) switch(pLed->CurrLedState) { case LED_BLINK_SLOWLY: - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -269,7 +269,7 @@ static void SwLedBlink1(PLED_871x pLed) break; case LED_BLINK_NORMAL: - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -278,18 +278,18 @@ static void SwLedBlink1(PLED_871x pLed) case LED_BLINK_SCAN: pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) + if ( pLed->BlinkTimes == 0 ) { bStopBlinking = true; } - if(bStopBlinking) + if (bStopBlinking) { - if(check_fwstate(pmlmepriv, _FW_LINKED)== true) + if (check_fwstate(pmlmepriv, _FW_LINKED)== true) { pLed->bLedLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_NORMAL; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -297,11 +297,11 @@ static void SwLedBlink1(PLED_871x pLed) RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== false) + else if (check_fwstate(pmlmepriv, _FW_LINKED)== false) { pLed->bLedNoLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -312,7 +312,7 @@ static void SwLedBlink1(PLED_871x pLed) } else { - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -322,28 +322,28 @@ static void SwLedBlink1(PLED_871x pLed) case LED_BLINK_TXRX: pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) + if ( pLed->BlinkTimes == 0 ) { bStopBlinking = true; } - if(bStopBlinking) + if (bStopBlinking) { - if(check_fwstate(pmlmepriv, _FW_LINKED)== true) + if (check_fwstate(pmlmepriv, _FW_LINKED)== true) { pLed->bLedLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_NORMAL; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== false) + else if (check_fwstate(pmlmepriv, _FW_LINKED)== false) { pLed->bLedNoLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -355,7 +355,7 @@ static void SwLedBlink1(PLED_871x pLed) } else { - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -364,7 +364,7 @@ static void SwLedBlink1(PLED_871x pLed) break; case LED_BLINK_WPS: - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -372,16 +372,16 @@ static void SwLedBlink1(PLED_871x pLed) break; case LED_BLINK_WPS_STOP: /* WPS success */ - if(pLed->BlinkingLedState == RTW_LED_ON) + if (pLed->BlinkingLedState == RTW_LED_ON) bStopBlinking = false; else bStopBlinking = true; - if(bStopBlinking) + if (bStopBlinking) { pLed->bLedLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_NORMAL; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -409,7 +409,7 @@ static void SwLedBlink2(PLED_871x pLed) u8 bStopBlinking = false; /* Change LED according to BlinkingLedState specified. */ - if( pLed->BlinkingLedState == RTW_LED_ON) + if ( pLed->BlinkingLedState == RTW_LED_ON) { SwLedOn(padapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); @@ -424,18 +424,18 @@ static void SwLedBlink2(PLED_871x pLed) { case LED_BLINK_SCAN: pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) + if ( pLed->BlinkTimes == 0 ) { bStopBlinking = true; } - if(bStopBlinking) + if (bStopBlinking) { - if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + if ( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) { SwLedOff(padapter, pLed); } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== true) + else if (check_fwstate(pmlmepriv, _FW_LINKED)== true) { pLed->CurrLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON; @@ -443,7 +443,7 @@ static void SwLedBlink2(PLED_871x pLed) RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop scan blink CurrLedState %d\n", pLed->CurrLedState)); } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== false) + else if (check_fwstate(pmlmepriv, _FW_LINKED)== false) { pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; @@ -454,13 +454,13 @@ static void SwLedBlink2(PLED_871x pLed) } else { - if( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + if ( adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) { SwLedOff(padapter, pLed); } else { - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -471,17 +471,17 @@ static void SwLedBlink2(PLED_871x pLed) case LED_BLINK_TXRX: pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) + if ( pLed->BlinkTimes == 0 ) { bStopBlinking = true; } - if(bStopBlinking) + if (bStopBlinking) { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) { SwLedOff(padapter, pLed); } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== true) + else if (check_fwstate(pmlmepriv, _FW_LINKED)== true) { pLed->CurrLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON; @@ -489,7 +489,7 @@ static void SwLedBlink2(PLED_871x pLed) RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop CurrLedState %d\n", pLed->CurrLedState)); } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== false) + else if (check_fwstate(pmlmepriv, _FW_LINKED)== false) { pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; @@ -500,13 +500,13 @@ static void SwLedBlink2(PLED_871x pLed) } else { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) { SwLedOff(padapter, pLed); } else { - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -528,14 +528,14 @@ static void SwLedBlink3(PLED_871x pLed) u8 bStopBlinking = false; /* Change LED according to BlinkingLedState specified. */ - if( pLed->BlinkingLedState == RTW_LED_ON ) + if ( pLed->BlinkingLedState == RTW_LED_ON ) { SwLedOn(padapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); } else { - if(pLed->CurrLedState != LED_BLINK_WPS_STOP) + if (pLed->CurrLedState != LED_BLINK_WPS_STOP) SwLedOff(padapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); } @@ -544,31 +544,31 @@ static void SwLedBlink3(PLED_871x pLed) { case LED_BLINK_SCAN: pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) + if ( pLed->BlinkTimes == 0 ) { bStopBlinking = true; } - if(bStopBlinking) + if (bStopBlinking) { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) { SwLedOff(padapter, pLed); } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== true) + else if (check_fwstate(pmlmepriv, _FW_LINKED)== true) { pLed->CurrLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON; - if( !pLed->bLedOn ) + if ( !pLed->bLedOn ) SwLedOn(padapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== false) + else if (check_fwstate(pmlmepriv, _FW_LINKED)== false) { pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) SwLedOff(padapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); @@ -577,13 +577,13 @@ static void SwLedBlink3(PLED_871x pLed) } else { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) { SwLedOff(padapter, pLed); } else { - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -594,32 +594,32 @@ static void SwLedBlink3(PLED_871x pLed) case LED_BLINK_TXRX: pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) + if ( pLed->BlinkTimes == 0 ) { bStopBlinking = true; } - if(bStopBlinking) + if (bStopBlinking) { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) { SwLedOff(padapter, pLed); } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== true) + else if (check_fwstate(pmlmepriv, _FW_LINKED)== true) { pLed->CurrLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON; - if( !pLed->bLedOn ) + if ( !pLed->bLedOn ) SwLedOn(padapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); } - else if(check_fwstate(pmlmepriv, _FW_LINKED)== false) + else if (check_fwstate(pmlmepriv, _FW_LINKED)== false) { pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) SwLedOff(padapter, pLed); @@ -629,13 +629,13 @@ static void SwLedBlink3(PLED_871x pLed) } else { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) { SwLedOff(padapter, pLed); } else { - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -645,7 +645,7 @@ static void SwLedBlink3(PLED_871x pLed) break; case LED_BLINK_WPS: - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -653,7 +653,7 @@ static void SwLedBlink3(PLED_871x pLed) break; case LED_BLINK_WPS_STOP: /* WPS success */ - if(pLed->BlinkingLedState == RTW_LED_ON) + if (pLed->BlinkingLedState == RTW_LED_ON) { pLed->BlinkingLedState = RTW_LED_OFF; _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); @@ -664,9 +664,9 @@ static void SwLedBlink3(PLED_871x pLed) bStopBlinking = true; } - if(bStopBlinking) + if (bStopBlinking) { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on ) { SwLedOff(padapter, pLed); } @@ -696,7 +696,7 @@ static void SwLedBlink4(PLED_871x pLed) u8 bStopBlinking = false; /* Change LED according to BlinkingLedState specified. */ - if( pLed->BlinkingLedState == RTW_LED_ON ) + if ( pLed->BlinkingLedState == RTW_LED_ON ) { SwLedOn(padapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); @@ -707,7 +707,7 @@ static void SwLedBlink4(PLED_871x pLed) RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); } - if(!pLed1->bLedWPSBlinkInProgress && pLed1->BlinkingLedState == LED_UNKNOWN) + if (!pLed1->bLedWPSBlinkInProgress && pLed1->BlinkingLedState == LED_UNKNOWN) { pLed1->BlinkingLedState = RTW_LED_OFF; pLed1->CurrLedState = RTW_LED_OFF; @@ -717,7 +717,7 @@ static void SwLedBlink4(PLED_871x pLed) switch(pLed->CurrLedState) { case LED_BLINK_SLOWLY: - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -725,7 +725,7 @@ static void SwLedBlink4(PLED_871x pLed) break; case LED_BLINK_StartToBlink: - if( pLed->bLedOn ) + if ( pLed->bLedOn ) { pLed->BlinkingLedState = RTW_LED_OFF; _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); @@ -739,14 +739,14 @@ static void SwLedBlink4(PLED_871x pLed) case LED_BLINK_SCAN: pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) + if ( pLed->BlinkTimes == 0 ) { bStopBlinking = false; } - if(bStopBlinking) + if (bStopBlinking) { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) { SwLedOff(padapter, pLed); } @@ -754,7 +754,7 @@ static void SwLedBlink4(PLED_871x pLed) { pLed->bLedNoLinkBlinkInProgress = false; pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -764,13 +764,13 @@ static void SwLedBlink4(PLED_871x pLed) } else { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) { SwLedOff(padapter, pLed); } else { - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -781,13 +781,13 @@ static void SwLedBlink4(PLED_871x pLed) case LED_BLINK_TXRX: pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) + if ( pLed->BlinkTimes == 0 ) { bStopBlinking = true; } - if(bStopBlinking) + if (bStopBlinking) { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) { SwLedOff(padapter, pLed); } @@ -795,7 +795,7 @@ static void SwLedBlink4(PLED_871x pLed) { pLed->bLedNoLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -805,13 +805,13 @@ static void SwLedBlink4(PLED_871x pLed) } else { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) { SwLedOff(padapter, pLed); } else { - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -821,7 +821,7 @@ static void SwLedBlink4(PLED_871x pLed) break; case LED_BLINK_WPS: - if( pLed->bLedOn ) + if ( pLed->bLedOn ) { pLed->BlinkingLedState = RTW_LED_OFF; _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); @@ -834,7 +834,7 @@ static void SwLedBlink4(PLED_871x pLed) break; case LED_BLINK_WPS_STOP: /* WPS authentication fail */ - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -844,9 +844,9 @@ static void SwLedBlink4(PLED_871x pLed) case LED_BLINK_WPS_STOP_OVERLAP: /* WPS session overlap */ pLed->BlinkTimes--; - if(pLed->BlinkTimes == 0) + if (pLed->BlinkTimes == 0) { - if(pLed->bLedOn) + if (pLed->bLedOn) { pLed->BlinkTimes = 1; } @@ -856,7 +856,7 @@ static void SwLedBlink4(PLED_871x pLed) } } - if(bStopBlinking) + if (bStopBlinking) { pLed->BlinkTimes = 10; pLed->BlinkingLedState = RTW_LED_ON; @@ -864,7 +864,7 @@ static void SwLedBlink4(PLED_871x pLed) } else { - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -888,7 +888,7 @@ static void SwLedBlink5(PLED_871x pLed) u8 bStopBlinking = false; /* Change LED according to BlinkingLedState specified. */ - if( pLed->BlinkingLedState == RTW_LED_ON ) + if ( pLed->BlinkingLedState == RTW_LED_ON ) { SwLedOn(padapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); @@ -903,24 +903,24 @@ static void SwLedBlink5(PLED_871x pLed) { case LED_BLINK_SCAN: pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) + if ( pLed->BlinkTimes == 0 ) { bStopBlinking = true; } - if(bStopBlinking) + if (bStopBlinking) { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) { pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; - if(pLed->bLedOn) + if (pLed->bLedOn) SwLedOff(padapter, pLed); } else { pLed->CurrLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON; - if(!pLed->bLedOn) + if (!pLed->bLedOn) _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); } @@ -928,13 +928,13 @@ static void SwLedBlink5(PLED_871x pLed) } else { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) { SwLedOff(padapter, pLed); } else { - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -946,25 +946,25 @@ static void SwLedBlink5(PLED_871x pLed) case LED_BLINK_TXRX: pLed->BlinkTimes--; - if( pLed->BlinkTimes == 0 ) + if ( pLed->BlinkTimes == 0 ) { bStopBlinking = true; } - if(bStopBlinking) + if (bStopBlinking) { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) { pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; - if(pLed->bLedOn) + if (pLed->bLedOn) SwLedOff(padapter, pLed); } else { pLed->CurrLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON; - if(!pLed->bLedOn) + if (!pLed->bLedOn) _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); } @@ -972,13 +972,13 @@ static void SwLedBlink5(PLED_871x pLed) } else { - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) { SwLedOff(padapter, pLed); } else { - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1001,7 +1001,7 @@ static void SwLedBlink6(PLED_871x pLed) u8 bStopBlinking = false; /* Change LED according to BlinkingLedState specified. */ - if( pLed->BlinkingLedState == RTW_LED_ON ) + if ( pLed->BlinkingLedState == RTW_LED_ON ) { SwLedOn(padapter, pLed); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); @@ -1029,14 +1029,14 @@ SwLedControlMode0( { case LED_CTL_TX: case LED_CTL_RX: - if( pLed->bLedBlinkInProgress == false ) + if ( pLed->bLedBlinkInProgress == false ) { pLed->bLedBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_NORMAL; pLed->BlinkTimes = 2; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1045,14 +1045,14 @@ SwLedControlMode0( break; case LED_CTL_START_TO_LINK: - if( pLed->bLedBlinkInProgress == false ) + if ( pLed->bLedBlinkInProgress == false ) { pLed->bLedBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_StartToBlink; pLed->BlinkTimes = 24; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1066,7 +1066,7 @@ SwLedControlMode0( case LED_CTL_LINK: pLed->CurrLedState = RTW_LED_ON; - if( pLed->bLedBlinkInProgress == false ) + if ( pLed->bLedBlinkInProgress == false ) { SwLedOn(padapter, pLed); } @@ -1074,7 +1074,7 @@ SwLedControlMode0( case LED_CTL_NO_LINK: pLed->CurrLedState = RTW_LED_OFF; - if( pLed->bLedBlinkInProgress == false ) + if ( pLed->bLedBlinkInProgress == false ) { SwLedOff(padapter, pLed); } @@ -1082,7 +1082,7 @@ SwLedControlMode0( case LED_CTL_POWER_OFF: pLed->CurrLedState = RTW_LED_OFF; - if(pLed->bLedBlinkInProgress) + if (pLed->bLedBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; @@ -1091,14 +1091,14 @@ SwLedControlMode0( break; case LED_CTL_START_WPS: - if( pLed->bLedBlinkInProgress == false || pLed->CurrLedState == RTW_LED_ON) + if ( pLed->bLedBlinkInProgress == false || pLed->CurrLedState == RTW_LED_ON) { pLed->bLedBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_WPS; pLed->BlinkTimes = 20; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) { pLed->BlinkingLedState = RTW_LED_OFF; _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL); @@ -1112,7 +1112,7 @@ SwLedControlMode0( break; case LED_CTL_STOP_WPS: - if(pLed->bLedBlinkInProgress) + if (pLed->bLedBlinkInProgress) { pLed->CurrLedState = RTW_LED_OFF; _cancel_timer_ex(&(pLed->BlinkTimer)); @@ -1145,18 +1145,18 @@ SwLedControlMode1( case LED_CTL_POWER_ON: case LED_CTL_START_TO_LINK: case LED_CTL_NO_LINK: - if( pLed->bLedNoLinkBlinkInProgress == false ) + if ( pLed->bLedNoLinkBlinkInProgress == false ) { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) { return; } - if( pLed->bLedLinkBlinkInProgress == true ) + if ( pLed->bLedLinkBlinkInProgress == true ) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedLinkBlinkInProgress = false; } - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; @@ -1164,7 +1164,7 @@ SwLedControlMode1( pLed->bLedNoLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1173,25 +1173,25 @@ SwLedControlMode1( break; case LED_CTL_LINK: - if( pLed->bLedLinkBlinkInProgress == false ) + if ( pLed->bLedLinkBlinkInProgress == false ) { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) { return; } - if(pLed->bLedNoLinkBlinkInProgress == true) + if (pLed->bLedNoLinkBlinkInProgress == true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedNoLinkBlinkInProgress = false; } - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } pLed->bLedLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_NORMAL; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1200,24 +1200,24 @@ SwLedControlMode1( break; case LED_CTL_SITE_SURVEY: - if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== true)) + if ((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== true)) ; - else if(pLed->bLedScanBlinkInProgress ==false) + else if (pLed->bLedScanBlinkInProgress ==false) { - if(IS_LED_WPS_BLINKING(pLed)) + if (IS_LED_WPS_BLINKING(pLed)) return; - if(pLed->bLedNoLinkBlinkInProgress == true) + if (pLed->bLedNoLinkBlinkInProgress == true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedNoLinkBlinkInProgress = false; } - if( pLed->bLedLinkBlinkInProgress == true ) + if ( pLed->bLedLinkBlinkInProgress == true ) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedLinkBlinkInProgress = false; } - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; @@ -1225,7 +1225,7 @@ SwLedControlMode1( pLed->bLedScanBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SCAN; pLed->BlinkTimes = 24; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1235,18 +1235,18 @@ SwLedControlMode1( case LED_CTL_TX: case LED_CTL_RX: - if(pLed->bLedBlinkInProgress ==false) + if (pLed->bLedBlinkInProgress ==false) { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) { return; } - if(pLed->bLedNoLinkBlinkInProgress == true) + if (pLed->bLedNoLinkBlinkInProgress == true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedNoLinkBlinkInProgress = false; } - if( pLed->bLedLinkBlinkInProgress == true ) + if ( pLed->bLedLinkBlinkInProgress == true ) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedLinkBlinkInProgress = false; @@ -1254,7 +1254,7 @@ SwLedControlMode1( pLed->bLedBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_TXRX; pLed->BlinkTimes = 2; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1264,31 +1264,31 @@ SwLedControlMode1( case LED_CTL_START_WPS: /* wait until xinpin finish */ case LED_CTL_START_WPS_BOTTON: - if(pLed->bLedWPSBlinkInProgress ==false) + if (pLed->bLedWPSBlinkInProgress ==false) { - if(pLed->bLedNoLinkBlinkInProgress == true) + if (pLed->bLedNoLinkBlinkInProgress == true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedNoLinkBlinkInProgress = false; } - if( pLed->bLedLinkBlinkInProgress == true ) + if ( pLed->bLedLinkBlinkInProgress == true ) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedLinkBlinkInProgress = false; } - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if(pLed->bLedScanBlinkInProgress ==true) + if (pLed->bLedScanBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; } pLed->bLedWPSBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_WPS; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1298,27 +1298,27 @@ SwLedControlMode1( case LED_CTL_STOP_WPS: - if(pLed->bLedNoLinkBlinkInProgress == true) + if (pLed->bLedNoLinkBlinkInProgress == true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedNoLinkBlinkInProgress = false; } - if( pLed->bLedLinkBlinkInProgress == true ) + if ( pLed->bLedLinkBlinkInProgress == true ) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedLinkBlinkInProgress = false; } - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if(pLed->bLedScanBlinkInProgress ==true) + if (pLed->bLedScanBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; } - if(pLed->bLedWPSBlinkInProgress) + if (pLed->bLedWPSBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); } @@ -1328,7 +1328,7 @@ SwLedControlMode1( } pLed->CurrLedState = LED_BLINK_WPS_STOP; - if(pLed->bLedOn) + if (pLed->bLedOn) { pLed->BlinkingLedState = RTW_LED_OFF; _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); @@ -1341,7 +1341,7 @@ SwLedControlMode1( break; case LED_CTL_STOP_WPS_FAIL: - if(pLed->bLedWPSBlinkInProgress) + if (pLed->bLedWPSBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; @@ -1349,7 +1349,7 @@ SwLedControlMode1( pLed->bLedNoLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1359,27 +1359,27 @@ SwLedControlMode1( case LED_CTL_POWER_OFF: pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; - if( pLed->bLedNoLinkBlinkInProgress) + if ( pLed->bLedNoLinkBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedNoLinkBlinkInProgress = false; } - if( pLed->bLedLinkBlinkInProgress) + if ( pLed->bLedLinkBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedLinkBlinkInProgress = false; } - if( pLed->bLedBlinkInProgress) + if ( pLed->bLedBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if( pLed->bLedWPSBlinkInProgress ) + if ( pLed->bLedWPSBlinkInProgress ) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; } - if( pLed->bLedScanBlinkInProgress) + if ( pLed->bLedScanBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; @@ -1410,14 +1410,14 @@ SwLedControlMode2( switch(LedAction) { case LED_CTL_SITE_SURVEY: - if(pmlmepriv->LinkDetectInfo.bBusyTraffic) + if (pmlmepriv->LinkDetectInfo.bBusyTraffic) ; - else if(pLed->bLedScanBlinkInProgress ==false) + else if (pLed->bLedScanBlinkInProgress ==false) { - if(IS_LED_WPS_BLINKING(pLed)) + if (IS_LED_WPS_BLINKING(pLed)) return; - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; @@ -1425,7 +1425,7 @@ SwLedControlMode2( pLed->bLedScanBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SCAN; pLed->BlinkTimes = 24; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1435,9 +1435,9 @@ SwLedControlMode2( case LED_CTL_TX: case LED_CTL_RX: - if((pLed->bLedBlinkInProgress ==false) && (check_fwstate(pmlmepriv, _FW_LINKED)== true)) + if ((pLed->bLedBlinkInProgress ==false) && (check_fwstate(pmlmepriv, _FW_LINKED)== true)) { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) { return; } @@ -1445,7 +1445,7 @@ SwLedControlMode2( pLed->bLedBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_TXRX; pLed->BlinkTimes = 2; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1456,12 +1456,12 @@ SwLedControlMode2( case LED_CTL_LINK: pLed->CurrLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON; - if( pLed->bLedBlinkInProgress) + if ( pLed->bLedBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if( pLed->bLedScanBlinkInProgress) + if ( pLed->bLedScanBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; @@ -1472,14 +1472,14 @@ SwLedControlMode2( case LED_CTL_START_WPS: /* wait until xinpin finish */ case LED_CTL_START_WPS_BOTTON: - if(pLed->bLedWPSBlinkInProgress ==false) + if (pLed->bLedWPSBlinkInProgress ==false) { - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if(pLed->bLedScanBlinkInProgress ==true) + if (pLed->bLedScanBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; @@ -1493,7 +1493,7 @@ SwLedControlMode2( case LED_CTL_STOP_WPS: pLed->bLedWPSBlinkInProgress = false; - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on) { SwLedOff(padapter, pLed); } @@ -1508,7 +1508,7 @@ SwLedControlMode2( case LED_CTL_STOP_WPS_FAIL: pLed->bLedWPSBlinkInProgress = false; - if(adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on) + if (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on) { SwLedOff(padapter, pLed); } @@ -1523,7 +1523,7 @@ SwLedControlMode2( case LED_CTL_START_TO_LINK: case LED_CTL_NO_LINK: - if(!IS_LED_BLINKING(pLed)) + if (!IS_LED_BLINKING(pLed)) { pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; @@ -1534,17 +1534,17 @@ SwLedControlMode2( case LED_CTL_POWER_OFF: pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; - if( pLed->bLedBlinkInProgress) + if ( pLed->bLedBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if( pLed->bLedScanBlinkInProgress) + if ( pLed->bLedScanBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; } - if( pLed->bLedWPSBlinkInProgress ) + if ( pLed->bLedWPSBlinkInProgress ) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; @@ -1575,14 +1575,14 @@ SwLedControlMode2( switch(LedAction) { case LED_CTL_SITE_SURVEY: - if(pmlmepriv->LinkDetectInfo.bBusyTraffic) + if (pmlmepriv->LinkDetectInfo.bBusyTraffic) ; - else if(pLed->bLedScanBlinkInProgress ==false) + else if (pLed->bLedScanBlinkInProgress ==false) { - if(IS_LED_WPS_BLINKING(pLed)) + if (IS_LED_WPS_BLINKING(pLed)) return; - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; @@ -1590,7 +1590,7 @@ SwLedControlMode2( pLed->bLedScanBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SCAN; pLed->BlinkTimes = 24; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1600,9 +1600,9 @@ SwLedControlMode2( case LED_CTL_TX: case LED_CTL_RX: - if((pLed->bLedBlinkInProgress ==false) && (check_fwstate(pmlmepriv, _FW_LINKED)== true)) + if ((pLed->bLedBlinkInProgress ==false) && (check_fwstate(pmlmepriv, _FW_LINKED)== true)) { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) { return; } @@ -1610,7 +1610,7 @@ SwLedControlMode2( pLed->bLedBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_TXRX; pLed->BlinkTimes = 2; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1619,17 +1619,17 @@ SwLedControlMode2( break; case LED_CTL_LINK: - if(IS_LED_WPS_BLINKING(pLed)) + if (IS_LED_WPS_BLINKING(pLed)) return; pLed->CurrLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON; - if( pLed->bLedBlinkInProgress) + if ( pLed->bLedBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if( pLed->bLedScanBlinkInProgress) + if ( pLed->bLedScanBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; @@ -1640,21 +1640,21 @@ SwLedControlMode2( case LED_CTL_START_WPS: /* wait until xinpin finish */ case LED_CTL_START_WPS_BOTTON: - if(pLed->bLedWPSBlinkInProgress ==false) + if (pLed->bLedWPSBlinkInProgress ==false) { - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if(pLed->bLedScanBlinkInProgress ==true) + if (pLed->bLedScanBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; } pLed->bLedWPSBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_WPS; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1663,7 +1663,7 @@ SwLedControlMode2( break; case LED_CTL_STOP_WPS: - if(pLed->bLedWPSBlinkInProgress) + if (pLed->bLedWPSBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; @@ -1674,7 +1674,7 @@ SwLedControlMode2( } pLed->CurrLedState = LED_BLINK_WPS_STOP; - if(pLed->bLedOn) + if (pLed->bLedOn) { pLed->BlinkingLedState = RTW_LED_OFF; _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA); @@ -1688,7 +1688,7 @@ SwLedControlMode2( break; case LED_CTL_STOP_WPS_FAIL: - if(pLed->bLedWPSBlinkInProgress) + if (pLed->bLedWPSBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; @@ -1701,7 +1701,7 @@ SwLedControlMode2( case LED_CTL_START_TO_LINK: case LED_CTL_NO_LINK: - if(!IS_LED_BLINKING(pLed)) + if (!IS_LED_BLINKING(pLed)) { pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; @@ -1712,17 +1712,17 @@ SwLedControlMode2( case LED_CTL_POWER_OFF: pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; - if( pLed->bLedBlinkInProgress) + if ( pLed->bLedBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if( pLed->bLedScanBlinkInProgress) + if ( pLed->bLedScanBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; } - if( pLed->bLedWPSBlinkInProgress ) + if ( pLed->bLedWPSBlinkInProgress ) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; @@ -1755,7 +1755,7 @@ SwLedControlMode4( switch(LedAction) { case LED_CTL_START_TO_LINK: - if(pLed1->bLedWPSBlinkInProgress) + if (pLed1->bLedWPSBlinkInProgress) { pLed1->bLedWPSBlinkInProgress = false; _cancel_timer_ex(&(pLed1->BlinkTimer)); @@ -1763,22 +1763,22 @@ SwLedControlMode4( pLed1->BlinkingLedState = RTW_LED_OFF; pLed1->CurrLedState = RTW_LED_OFF; - if(pLed1->bLedOn) + if (pLed1->bLedOn) _set_timer(&(pLed->BlinkTimer), 0); } - if( pLed->bLedStartToLinkBlinkInProgress == false ) + if ( pLed->bLedStartToLinkBlinkInProgress == false ) { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) { return; } - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if(pLed->bLedNoLinkBlinkInProgress ==true) + if (pLed->bLedNoLinkBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedNoLinkBlinkInProgress = false; @@ -1786,7 +1786,7 @@ SwLedControlMode4( pLed->bLedStartToLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_StartToBlink; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) { pLed->BlinkingLedState = RTW_LED_OFF; _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); @@ -1802,9 +1802,9 @@ SwLedControlMode4( case LED_CTL_LINK: case LED_CTL_NO_LINK: /* LED1 settings */ - if(LedAction == LED_CTL_LINK) + if (LedAction == LED_CTL_LINK) { - if(pLed1->bLedWPSBlinkInProgress) + if (pLed1->bLedWPSBlinkInProgress) { pLed1->bLedWPSBlinkInProgress = false; _cancel_timer_ex(&(pLed1->BlinkTimer)); @@ -1812,18 +1812,18 @@ SwLedControlMode4( pLed1->BlinkingLedState = RTW_LED_OFF; pLed1->CurrLedState = RTW_LED_OFF; - if(pLed1->bLedOn) + if (pLed1->bLedOn) _set_timer(&(pLed->BlinkTimer), 0); } } - if( pLed->bLedNoLinkBlinkInProgress == false ) + if ( pLed->bLedNoLinkBlinkInProgress == false ) { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) { return; } - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; @@ -1831,7 +1831,7 @@ SwLedControlMode4( pLed->bLedNoLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1840,19 +1840,19 @@ SwLedControlMode4( break; case LED_CTL_SITE_SURVEY: - if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== true)) + if ((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== true)) ; - else if(pLed->bLedScanBlinkInProgress ==false) + else if (pLed->bLedScanBlinkInProgress ==false) { - if(IS_LED_WPS_BLINKING(pLed)) + if (IS_LED_WPS_BLINKING(pLed)) return; - if(pLed->bLedNoLinkBlinkInProgress == true) + if (pLed->bLedNoLinkBlinkInProgress == true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedNoLinkBlinkInProgress = false; } - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; @@ -1860,7 +1860,7 @@ SwLedControlMode4( pLed->bLedScanBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SCAN; pLed->BlinkTimes = 24; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1870,13 +1870,13 @@ SwLedControlMode4( case LED_CTL_TX: case LED_CTL_RX: - if(pLed->bLedBlinkInProgress ==false) + if (pLed->bLedBlinkInProgress ==false) { - if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) + if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed)) { return; } - if(pLed->bLedNoLinkBlinkInProgress == true) + if (pLed->bLedNoLinkBlinkInProgress == true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedNoLinkBlinkInProgress = false; @@ -1884,7 +1884,7 @@ SwLedControlMode4( pLed->bLedBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_TXRX; pLed->BlinkTimes = 2; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1894,7 +1894,7 @@ SwLedControlMode4( case LED_CTL_START_WPS: /* wait until xinpin finish */ case LED_CTL_START_WPS_BOTTON: - if(pLed1->bLedWPSBlinkInProgress) + if (pLed1->bLedWPSBlinkInProgress) { pLed1->bLedWPSBlinkInProgress = false; _cancel_timer_ex(&(pLed1->BlinkTimer)); @@ -1902,30 +1902,30 @@ SwLedControlMode4( pLed1->BlinkingLedState = RTW_LED_OFF; pLed1->CurrLedState = RTW_LED_OFF; - if(pLed1->bLedOn) + if (pLed1->bLedOn) _set_timer(&(pLed->BlinkTimer), 0); } - if(pLed->bLedWPSBlinkInProgress ==false) + if (pLed->bLedWPSBlinkInProgress ==false) { - if(pLed->bLedNoLinkBlinkInProgress == true) + if (pLed->bLedNoLinkBlinkInProgress == true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedNoLinkBlinkInProgress = false; } - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if(pLed->bLedScanBlinkInProgress ==true) + if (pLed->bLedScanBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; } pLed->bLedWPSBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_WPS; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) { pLed->BlinkingLedState = RTW_LED_OFF; _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); @@ -1939,7 +1939,7 @@ SwLedControlMode4( break; case LED_CTL_STOP_WPS: /* WPS connect success */ - if(pLed->bLedWPSBlinkInProgress) + if (pLed->bLedWPSBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; @@ -1947,7 +1947,7 @@ SwLedControlMode4( pLed->bLedNoLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -1956,7 +1956,7 @@ SwLedControlMode4( break; case LED_CTL_STOP_WPS_FAIL: /* WPS authentication fail */ - if(pLed->bLedWPSBlinkInProgress) + if (pLed->bLedWPSBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; @@ -1964,20 +1964,20 @@ SwLedControlMode4( pLed->bLedNoLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); /* LED1 settings */ - if(pLed1->bLedWPSBlinkInProgress) + if (pLed1->bLedWPSBlinkInProgress) _cancel_timer_ex(&(pLed1->BlinkTimer)); else pLed1->bLedWPSBlinkInProgress = true; pLed1->CurrLedState = LED_BLINK_WPS_STOP; - if( pLed1->bLedOn ) + if ( pLed1->bLedOn ) pLed1->BlinkingLedState = RTW_LED_OFF; else pLed1->BlinkingLedState = RTW_LED_ON; @@ -1986,7 +1986,7 @@ SwLedControlMode4( break; case LED_CTL_STOP_WPS_FAIL_OVERLAP: /* WPS session overlap */ - if(pLed->bLedWPSBlinkInProgress) + if (pLed->bLedWPSBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; @@ -1994,21 +1994,21 @@ SwLedControlMode4( pLed->bLedNoLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SLOWLY; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); /* LED1 settings */ - if(pLed1->bLedWPSBlinkInProgress) + if (pLed1->bLedWPSBlinkInProgress) _cancel_timer_ex(&(pLed1->BlinkTimer)); else pLed1->bLedWPSBlinkInProgress = true; pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP; pLed1->BlinkTimes = 10; - if( pLed1->bLedOn ) + if ( pLed1->bLedOn ) pLed1->BlinkingLedState = RTW_LED_OFF; else pLed1->BlinkingLedState = RTW_LED_ON; @@ -2020,38 +2020,38 @@ SwLedControlMode4( pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; - if( pLed->bLedNoLinkBlinkInProgress) + if ( pLed->bLedNoLinkBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedNoLinkBlinkInProgress = false; } - if( pLed->bLedLinkBlinkInProgress) + if ( pLed->bLedLinkBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedLinkBlinkInProgress = false; } - if( pLed->bLedBlinkInProgress) + if ( pLed->bLedBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; } - if( pLed->bLedWPSBlinkInProgress ) + if ( pLed->bLedWPSBlinkInProgress ) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedWPSBlinkInProgress = false; } - if( pLed->bLedScanBlinkInProgress) + if ( pLed->bLedScanBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedScanBlinkInProgress = false; } - if( pLed->bLedStartToLinkBlinkInProgress) + if ( pLed->bLedStartToLinkBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedStartToLinkBlinkInProgress = false; } - if( pLed1->bLedWPSBlinkInProgress ) + if ( pLed1->bLedWPSBlinkInProgress ) { _cancel_timer_ex(&(pLed1->BlinkTimer)); pLed1->bLedWPSBlinkInProgress = false; @@ -2095,11 +2095,11 @@ SwLedControlMode5( break; case LED_CTL_SITE_SURVEY: - if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== true)) + if ((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== true)) ; - else if(pLed->bLedScanBlinkInProgress ==false) + else if (pLed->bLedScanBlinkInProgress ==false) { - if(pLed->bLedBlinkInProgress ==true) + if (pLed->bLedBlinkInProgress ==true) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; @@ -2107,7 +2107,7 @@ SwLedControlMode5( pLed->bLedScanBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_SCAN; pLed->BlinkTimes = 24; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -2117,16 +2117,16 @@ SwLedControlMode5( case LED_CTL_TX: case LED_CTL_RX: - if(pLed->bLedBlinkInProgress ==false) + if (pLed->bLedBlinkInProgress ==false) { - if(pLed->CurrLedState == LED_BLINK_SCAN) + if (pLed->CurrLedState == LED_BLINK_SCAN) { return; } pLed->bLedBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_TXRX; pLed->BlinkTimes = 2; - if( pLed->bLedOn ) + if ( pLed->bLedOn ) pLed->BlinkingLedState = RTW_LED_OFF; else pLed->BlinkingLedState = RTW_LED_ON; @@ -2138,7 +2138,7 @@ SwLedControlMode5( pLed->CurrLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF; - if( pLed->bLedBlinkInProgress) + if ( pLed->bLedBlinkInProgress) { _cancel_timer_ex(&(pLed->BlinkTimer)); pLed->bLedBlinkInProgress = false; @@ -2200,7 +2200,7 @@ void BlinkHandler(PLED_871x pLed) /* DBG_871X("%s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); */ - if( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) + if ( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) { /* DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped); */ return; @@ -2255,10 +2255,10 @@ LedControl871x( (padapter->hw_init_completed == false) ) return; - if( ledpriv->bRegUseLed == false) + if ( ledpriv->bRegUseLed == false) return; - if( (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && + if ( (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) && (LedAction == LED_CTL_TX || LedAction == LED_CTL_RX || LedAction == LED_CTL_SITE_SURVEY || diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index 1b03616..cd6f40d 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -99,7 +99,7 @@ exit: static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen) { - if(*ppie) { + if (*ppie) { rtw_mfree(*ppie, *plen); *plen = 0; *ppie=NULL; @@ -323,7 +323,7 @@ struct wlan_network *_rtw_find_network(struct __queue *scanned_queue, u8 *addr) ; - if(_rtw_memcmp(zero_addr, addr, ETH_ALEN)){ + if (_rtw_memcmp(zero_addr, addr, ETH_ALEN)){ pnetwork=NULL; goto exit; } @@ -343,7 +343,7 @@ struct wlan_network *_rtw_find_network(struct __queue *scanned_queue, u8 *addr) plist = get_next(plist); } - if(plist == phead) + if (plist == phead) pnetwork = NULL; /* spin_unlock_bh(&scanned_queue->lock); */ @@ -398,7 +398,7 @@ sint rtw_if_up(struct adapter *padapter) { sint res; ; - if( padapter->bDriverStopped || padapter->bSurpriseRemoved || + if ( padapter->bDriverStopped || padapter->bSurpriseRemoved || (check_fwstate(&padapter->mlmepriv, _FW_LINKED)== false)){ RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_if_up:bDriverStopped(%d) OR bSurpriseRemoved(%d)", padapter->bDriverStopped, padapter->bSurpriseRemoved)); res=false; @@ -532,7 +532,7 @@ int rtw_is_same_ibss(struct adapter *adapter, struct wlan_network *pnetwork) { ret=false; } - else if((psecuritypriv->dot11PrivacyAlgrthm == _NO_PRIVACY_ ) && + else if ((psecuritypriv->dot11PrivacyAlgrthm == _NO_PRIVACY_ ) && ( pnetwork->network.Privacy == 1 ) ) { ret=false; @@ -603,7 +603,7 @@ struct wlan_network * rtw_get_oldest_wlan_network(struct __queue *scanned_queue pwlan= LIST_CONTAINOR(plist, struct wlan_network, list); - if(pwlan->fixed!=true) + if (pwlan->fixed!=true) { if (oldest == NULL ||time_after(oldest->last_scanned, pwlan->last_scanned)) oldest = pwlan; @@ -634,7 +634,7 @@ void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, rtw_hal_antdiv_rssi_compared(padapter, dst, src); /* this will update src.Rssi, need consider again */ #if defined(DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) && 1 - if(strcmp(dst->Ssid.Ssid, DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) == 0) { + if (strcmp(dst->Ssid.Ssid, DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) == 0) { DBG_871X(FUNC_ADPT_FMT" %s("MAC_FMT", ch%u) ss_ori:%3u, sq_ori:%3u, rssi_ori:%3ld, ss_smp:%3u, sq_smp:%3u, rssi_smp:%3ld\n" , FUNC_ADPT_ARG(padapter) , src->Ssid.Ssid, MAC_ARG(src->MacAddress), src->Configuration.DSConfig @@ -650,13 +650,13 @@ void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, ss_final = padapter->recvpriv.signal_strength; sq_final = padapter->recvpriv.signal_qual; /* the rssi value here is undecorated, and will be used for antenna diversity */ - if(sq_smp != 101) /* from the right channel */ + if (sq_smp != 101) /* from the right channel */ rssi_final = (src->Rssi+dst->Rssi*4)/5; else rssi_final = rssi_ori; } else { - if(sq_smp != 101) { /* from the right channel */ + if (sq_smp != 101) { /* from the right channel */ ss_final = ((u32)(src->PhyInfo.SignalStrength)+(u32)(dst->PhyInfo.SignalStrength)*4)/5; sq_final = ((u32)(src->PhyInfo.SignalQuality)+(u32)(dst->PhyInfo.SignalQuality)*4)/5; rssi_final = (src->Rssi+dst->Rssi*4)/5; @@ -680,7 +680,7 @@ void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, dst->Rssi = rssi_final; #if defined(DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) && 1 - if(strcmp(dst->Ssid.Ssid, DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) == 0) { + if (strcmp(dst->Ssid.Ssid, DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) == 0) { DBG_871X(FUNC_ADPT_FMT" %s("MAC_FMT"), SignalStrength:%u, SignalQuality:%u, RawRSSI:%ld\n" , FUNC_ADPT_ARG(padapter) , dst->Ssid.Ssid, MAC_ARG(dst->MacAddress), dst->PhyInfo.SignalStrength, dst->PhyInfo.SignalQuality, dst->Rssi); @@ -795,7 +795,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t pnetwork = rtw_alloc_network(pmlmepriv); /* will update scan_time */ - if(pnetwork==NULL){ + if (pnetwork==NULL){ RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n\n\nsomething wrong here\n\n\n")); goto exit; } @@ -881,9 +881,9 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor desired_encmode = psecuritypriv->ndisencryptstatus; privacy = pnetwork->network.Privacy; - if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) + if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { - if(rtw_get_wps_ie(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen)!=NULL) + if (rtw_get_wps_ie(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen)!=NULL) { return true; } @@ -916,9 +916,9 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor bselected = false; } - if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) { - if(pnetwork->network.InfrastructureMode != pmlmepriv->cur_network.network.InfrastructureMode) + if (pnetwork->network.InfrastructureMode != pmlmepriv->cur_network.network.InfrastructureMode) bselected = false; } @@ -951,7 +951,7 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf) RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_survey_event_callback, ssid=%s\n", pnetwork->Ssid.Ssid)); len = get_wlan_bssid_ex_sz(pnetwork); - if(len > (sizeof(struct wlan_bssid_ex))) + if (len > (sizeof(struct wlan_bssid_ex))) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n ****rtw_survey_event_callback: return a wrong bss ***\n")); return; @@ -964,7 +964,7 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf) if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) == true) { /* RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,"rtw_survey_event_callback : WIFI_ADHOC_MASTER_STATE\n\n"); */ - if(_rtw_memcmp(&(pmlmepriv->cur_network.network.MacAddress), pnetwork->MacAddress, ETH_ALEN)) + if (_rtw_memcmp(&(pmlmepriv->cur_network.network.MacAddress), pnetwork->MacAddress, ETH_ALEN)) { struct wlan_network* ibss_wlan = NULL; unsigned long irqL; @@ -972,7 +972,7 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf) memcpy(pmlmepriv->cur_network.network.IEs, pnetwork->IEs, 8); spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); ibss_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->MacAddress); - if(ibss_wlan) + if (ibss_wlan) { memcpy(ibss_wlan->network.IEs , pnetwork->IEs, 8); spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); @@ -985,7 +985,7 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf) /* lock pmlmepriv->lock when you accessing network_q */ if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == false) { - if( pnetwork->Ssid.Ssid[0] == 0 ) + if ( pnetwork->Ssid.Ssid[0] == 0 ) { pnetwork->Ssid.SsidLength = 0; } @@ -1018,7 +1018,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) ; spin_lock_bh(&pmlmepriv->lock); - if(pmlmepriv->wps_probe_req_ie) + if (pmlmepriv->wps_probe_req_ie) { u32 free_len = pmlmepriv->wps_probe_req_ie_len; pmlmepriv->wps_probe_req_ie_len = 0; @@ -1043,7 +1043,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) } spin_unlock_bh(&pmlmepriv->lock); - if(timer_cancelled) + if (timer_cancelled) _cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled); @@ -1051,15 +1051,15 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) rtw_set_signal_stat_timer(&adapter->recvpriv); - if(pmlmepriv->to_join == true) + if (pmlmepriv->to_join == true) { - if((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==true) ) + if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==true) ) { - if(check_fwstate(pmlmepriv, _FW_LINKED)==false) + if (check_fwstate(pmlmepriv, _FW_LINKED)==false) { set_fwstate(pmlmepriv, _FW_UNDER_LINKING); - if(rtw_select_and_join_from_scanned_queue(pmlmepriv)==_SUCCESS) + if (rtw_select_and_join_from_scanned_queue(pmlmepriv)==_SUCCESS) { _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT ); } @@ -1080,7 +1080,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE; - if(rtw_createbss_cmd(adapter)!=_SUCCESS) + if (rtw_createbss_cmd(adapter)!=_SUCCESS) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Error=>rtw_createbss_cmd status FAIL\n")); } @@ -1094,11 +1094,11 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) int s_ret; set_fwstate(pmlmepriv, _FW_UNDER_LINKING); pmlmepriv->to_join = false; - if(_SUCCESS == (s_ret=rtw_select_and_join_from_scanned_queue(pmlmepriv))) + if (_SUCCESS == (s_ret=rtw_select_and_join_from_scanned_queue(pmlmepriv))) { _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); } - else if(s_ret == 2)/* there is no need to wait for join */ + else if (s_ret == 2)/* there is no need to wait for join */ { _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); rtw_indicate_connect(adapter); @@ -1107,7 +1107,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) { DBG_871X("try_to_join, but select scanning queue fail, to_roaming:%d\n", rtw_to_roaming(adapter)); if (rtw_to_roaming(adapter) != 0) { - if( --pmlmepriv->to_roaming == 0 + if ( --pmlmepriv->to_roaming == 0 || _SUCCESS != rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0) ) { rtw_set_roaming(adapter, 0); @@ -1194,7 +1194,7 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("tgt_network->network.MacAddress="MAC_FMT" ssid=%s\n", MAC_ARG(tgt_network->network.MacAddress), tgt_network->network.Ssid.Ssid)); - if(check_fwstate( pmlmepriv, WIFI_STATION_STATE|WIFI_AP_STATE)) { + if (check_fwstate( pmlmepriv, WIFI_STATION_STATE|WIFI_AP_STATE)) { struct sta_info* psta; psta = rtw_get_stainfo(&adapter->stapriv, tgt_network->network.MacAddress); @@ -1206,7 +1206,7 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) } - if(check_fwstate( pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)) + if (check_fwstate( pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)) { struct sta_info* psta; @@ -1220,14 +1220,14 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) rtw_init_bcmc_stainfo(adapter); } - if(lock_scanned_queue) + if (lock_scanned_queue) spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); - if(pwlan) { + if (pwlan) { pwlan->fixed = false; #ifdef CONFIG_P2P - if(!rtw_p2p_chk_state(&adapter->wdinfo, P2P_STATE_NONE)) { + if (!rtw_p2p_chk_state(&adapter->wdinfo, P2P_STATE_NONE)) { u32 p2p_ielen=0; u8 *p2p_ie; /* u16 capability; */ @@ -1237,10 +1237,10 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) /* DBG_871X("free disconnecting network\n"); */ /* rtw_free_network_nolock(pmlmepriv, pwlan); */ - if((p2p_ie=rtw_get_p2p_ie(pwlan->network.IEs+_FIXED_IE_LENGTH_, pwlan->network.IELength-_FIXED_IE_LENGTH_, NULL, &p2p_ielen))) + if ((p2p_ie=rtw_get_p2p_ie(pwlan->network.IEs+_FIXED_IE_LENGTH_, pwlan->network.IELength-_FIXED_IE_LENGTH_, NULL, &p2p_ielen))) { pcap = rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, NULL, &capability_len); - if(pcap && capability_len==2) { + if (pcap && capability_len==2) { u16 cap = *(u16*)pcap ; *(u16*)pcap = cap&0x00ff;/* clear group capability when free this network */ } @@ -1255,13 +1255,13 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) } - if((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) && (adapter->stapriv.asoc_sta_count== 1)) + if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) && (adapter->stapriv.asoc_sta_count== 1)) /*||check_fwstate(pmlmepriv, WIFI_STATION_STATE)*/) { rtw_free_network_nolock(pmlmepriv, pwlan); } - if(lock_scanned_queue) + if (lock_scanned_queue) spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); adapter->securitypriv.key_mask = 0; @@ -1281,7 +1281,7 @@ void rtw_indicate_connect(struct adapter *padapter) pmlmepriv->to_join = false; - if(!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) + if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { set_fwstate(pmlmepriv, _FW_LINKED); @@ -1289,7 +1289,7 @@ void rtw_indicate_connect(struct adapter *padapter) #ifdef CONFIG_DRVEXT_MODULE - if(padapter->drvextpriv.enable_wpa) + if (padapter->drvextpriv.enable_wpa) { indicate_l2_connect(padapter); } @@ -1327,10 +1327,10 @@ void rtw_indicate_disconnect( struct adapter *padapter ) /* DBG_871X("clear wps when %s\n", __func__); */ - if(rtw_to_roaming(padapter) > 0) + if (rtw_to_roaming(padapter) > 0) _clr_fwstate_(pmlmepriv, _FW_LINKED); - if(check_fwstate(&padapter->mlmepriv, _FW_LINKED) + if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) || (rtw_to_roaming(padapter) <= 0) ) { @@ -1394,11 +1394,11 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str struct sta_priv *pstapriv = &padapter->stapriv; psta = rtw_get_stainfo(pstapriv, pnetwork->network.MacAddress); - if(psta==NULL) { + if (psta==NULL) { psta = rtw_alloc_stainfo(pstapriv, pnetwork->network.MacAddress); } - if(psta) /* update ptarget_sta */ + if (psta) /* update ptarget_sta */ { DBG_871X("%s\n", __FUNCTION__); @@ -1409,7 +1409,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str rtw_hal_set_odm_var(padapter,HAL_ODM_STA_INFO,psta,true); /* security related */ - if(padapter->securitypriv.dot11AuthAlgrthm== dot11AuthAlgrthm_8021X) + if (padapter->securitypriv.dot11AuthAlgrthm== dot11AuthAlgrthm_8021X) { padapter->securitypriv.binstallGrpkey=false; padapter->securitypriv.busetkipkey=false; @@ -1459,7 +1459,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str bmc_sta = rtw_get_bcmc_stainfo(padapter); - if(bmc_sta) + if (bmc_sta) { for(i=0; i < 16 ; i++) { @@ -1529,7 +1529,7 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net { case Ndis802_11Infrastructure: - if(pmlmepriv->fw_state&WIFI_UNDER_WPS) + if (pmlmepriv->fw_state&WIFI_UNDER_WPS) pmlmepriv->fw_state = WIFI_STATION_STATE|WIFI_UNDER_WPS; else pmlmepriv->fw_state = WIFI_STATION_STATE; @@ -1582,7 +1582,7 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) the_same_macaddr = _rtw_memcmp(pnetwork->network.MacAddress, cur_network->network.MacAddress, ETH_ALEN); pnetwork->network.Length = get_wlan_bssid_ex_sz(&pnetwork->network); - if(pnetwork->network.Length > sizeof(struct wlan_bssid_ex)) { + if (pnetwork->network.Length > sizeof(struct wlan_bssid_ex)) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n\n ***joinbss_evt_callback return a wrong bss ***\n\n")); goto ignore_joinbss_callback; } @@ -1591,42 +1591,42 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("\n rtw_joinbss_event_callback !! _enter_critical\n")); - if(pnetwork->join_res > 0) { + if (pnetwork->join_res > 0) { spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); retry = 0; if (check_fwstate(pmlmepriv,_FW_UNDER_LINKING) ) { /* s1. find ptarget_wlan */ - if(check_fwstate(pmlmepriv, _FW_LINKED) ) { - if(the_same_macaddr == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED) ) { + if (the_same_macaddr == true) { ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); } else { pcur_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); - if(pcur_wlan) + if (pcur_wlan) pcur_wlan->fixed = false; pcur_sta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress); - if(pcur_sta){ + if (pcur_sta){ spin_lock_bh(&(pstapriv->sta_hash_lock)); rtw_free_stainfo(adapter, pcur_sta); spin_unlock_bh(&(pstapriv->sta_hash_lock)); } ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->network.MacAddress); - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - if(ptarget_wlan) + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { + if (ptarget_wlan) ptarget_wlan->fixed = true; } } } else { ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->network.MacAddress); - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - if(ptarget_wlan) + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { + if (ptarget_wlan) ptarget_wlan->fixed = true; } } /* s2. update cur_network */ - if(ptarget_wlan) { + if (ptarget_wlan) { rtw_joinbss_update_network(adapter, ptarget_wlan, pnetwork); } else { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Can't find ptarget_wlan when joinbss_event callback\n")); @@ -1636,9 +1636,9 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) /* s3. find ptarget_sta & update ptarget_sta after update cur_network only for station mode */ - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { ptarget_sta = rtw_joinbss_update_stainfo(adapter, pnetwork); - if(ptarget_sta==NULL) { + if (ptarget_sta==NULL) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("Can't update stainfo when joinbss_event callback\n")); spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); goto exit_unlock; @@ -1646,7 +1646,7 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) } /* s4. indicate connect */ - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { pmlmepriv->cur_network_scanned = ptarget_wlan; rtw_indicate_connect(adapter); } else { @@ -1664,26 +1664,26 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) goto exit_unlock; } spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); - } else if(pnetwork->join_res == -4) { + } else if (pnetwork->join_res == -4) { rtw_reset_securitypriv(adapter); _set_timer(&pmlmepriv->assoc_timer, 1); - if((check_fwstate(pmlmepriv, _FW_UNDER_LINKING))) { + if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING))) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("fail! clear _FW_UNDER_LINKING ^^^fw_state=%x\n", get_fwstate(pmlmepriv))); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); } } else { /* if join_res < 0 (join fails), then try again */ #ifdef REJOIN res = _FAIL; - if(retry < 2) { + if (retry < 2) { res = rtw_select_and_join_from_scanned_queue(pmlmepriv); RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("rtw_select_and_join_from_scanned_queue again! res:%d\n",res)); } - if(res == _SUCCESS) { + if (res == _SUCCESS) { /* extend time of assoc_timer */ _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); retry++; - } else if(res == 2) { /* there is no need to wait for join */ + } else if (res == 2) { /* there is no need to wait for join */ _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); rtw_indicate_connect(adapter); } else { @@ -1722,7 +1722,7 @@ static u8 search_max_mac_id(struct adapter *padapter) struct sta_priv *pstapriv = &padapter->stapriv; #if defined (CONFIG_AP_MODE) - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)){ + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)){ for (aid = (pstapriv->max_num_sta); aid > 0; aid--) { @@ -1759,7 +1759,7 @@ void rtw_sta_media_status_rpt(struct adapter *adapter,struct sta_info *psta, u32 { u16 media_status_rpt; - if(psta==NULL) return; + if (psta==NULL) return; #if (RATE_ADAPTIVE_SUPPORT==1) /* for 88E RA */ { @@ -1782,14 +1782,14 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) ; - if(rtw_access_ctrl(adapter, pstassoc->macaddr) == false) + if (rtw_access_ctrl(adapter, pstassoc->macaddr) == false) return; #if defined (CONFIG_AP_MODE) - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { psta = rtw_get_stainfo(&adapter->stapriv, pstassoc->macaddr); - if(psta) + if (psta) { u8 *passoc_req = NULL; u32 assoc_req_len = 0; @@ -1803,10 +1803,10 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) /* report to upper layer */ DBG_871X("indicate_sta_assoc_event to upper layer - hostapd\n"); spin_lock_bh(&psta->lock); - if(psta->passoc_req && psta->assoc_req_len>0) + if (psta->passoc_req && psta->assoc_req_len>0) { passoc_req = rtw_zmalloc(psta->assoc_req_len); - if(passoc_req) + if (passoc_req) { assoc_req_len = psta->assoc_req_len; memcpy(passoc_req, psta->passoc_req, assoc_req_len); @@ -1818,7 +1818,7 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) } spin_unlock_bh(&psta->lock); - if(passoc_req && assoc_req_len>0) + if (passoc_req && assoc_req_len>0) { rtw_cfg80211_indicate_sta_assoc(adapter, passoc_req, assoc_req_len); @@ -1832,7 +1832,7 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) /* for AD-HOC mode */ psta = rtw_get_stainfo(&adapter->stapriv, pstassoc->macaddr); - if( psta != NULL) + if ( psta != NULL) { /* the sta have been in sta_info_queue => do nothing */ @@ -1857,7 +1857,7 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) rtw_sta_media_status_rpt(adapter, psta, 1); - if(adapter->securitypriv.dot11AuthAlgrthm==dot11AuthAlgrthm_8021X) + if (adapter->securitypriv.dot11AuthAlgrthm==dot11AuthAlgrthm_8021X) psta->dot118021XPrivacy = adapter->securitypriv.dot11PrivacyAlgrthm; @@ -1868,12 +1868,12 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf) if ( (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==true ) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==true ) ) { - if(adapter->stapriv.asoc_sta_count== 2) + if (adapter->stapriv.asoc_sta_count== 2) { spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); pmlmepriv->cur_network_scanned = ptarget_wlan; - if(ptarget_wlan) ptarget_wlan->fixed = true; + if (ptarget_wlan) ptarget_wlan->fixed = true; spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); /* a sta + bc/mc_stainfo (not Ibss_stainfo) */ rtw_indicate_connect(adapter); @@ -1906,21 +1906,21 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) ; psta = rtw_get_stainfo(&adapter->stapriv, pstadel->macaddr); - if(psta) + if (psta) mac_id = psta->mac_id; else mac_id = pstadel->mac_id; DBG_871X("%s(mac_id=%d)=" MAC_FMT "\n", __func__, mac_id, MAC_ARG(pstadel->macaddr)); - if(mac_id>=0){ + if (mac_id>=0){ u16 media_status; media_status = (mac_id<<8)|0; /* MACID|OPMODE:0 means disconnect */ /* for STA,AP,ADHOC mode, report disconnect stauts to FW */ rtw_hal_set_hwreg(adapter, HW_VAR_H2C_MEDIA_STATUS_RPT, (u8 *)&media_status); } - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { rtw_cfg80211_indicate_sta_disassoc(adapter, pstadel->macaddr, *(u16*)pstadel->rsvd); return; @@ -1931,15 +1931,15 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) spin_lock_bh(&pmlmepriv->lock); - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) ) + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) ) { - if(adapter->registrypriv.wifi_spec==1) + if (adapter->registrypriv.wifi_spec==1) rtw_set_roaming(adapter, 0); /* don't roam */ else if (rtw_to_roaming(adapter) > 0) pmlmepriv->to_roaming--; /* this stadel_event is caused by roaming, decrease to_roaming */ else if (rtw_to_roaming(adapter) == 0) rtw_set_roaming(adapter, adapter->registrypriv.max_roaming_times); - if(*((unsigned short *)(pstadel->rsvd)) != WLAN_REASON_EXPIRATION_CHK) + if (*((unsigned short *)(pstadel->rsvd)) != WLAN_REASON_EXPIRATION_CHK) rtw_set_roaming(adapter, 0); /* don't roam */ rtw_free_uc_swdec_pending_queue(adapter); @@ -1966,12 +1966,12 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) rtw_free_stainfo(adapter, psta); spin_unlock_bh(&(pstapriv->sta_hash_lock)); - if(adapter->stapriv.asoc_sta_count== 1) /* a sta + bc/mc_stainfo (not Ibss_stainfo) */ + if (adapter->stapriv.asoc_sta_count== 1) /* a sta + bc/mc_stainfo (not Ibss_stainfo) */ { spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); /* free old ibss network */ pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); - if(pwlan) + if (pwlan) { pwlan->fixed = false; rtw_free_network_nolock(pmlmepriv, pwlan); @@ -1990,13 +1990,13 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) rtw_generate_random_ibss(pibss); - if(check_fwstate(pmlmepriv,WIFI_ADHOC_STATE)) + if (check_fwstate(pmlmepriv,WIFI_ADHOC_STATE)) { set_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE); _clr_fwstate_(pmlmepriv, WIFI_ADHOC_STATE); } - if(rtw_createbss_cmd(adapter)!=_SUCCESS) + if (rtw_createbss_cmd(adapter)!=_SUCCESS) { RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("***Error=>stadel_event_callback: rtw_createbss_cmd status FAIL***\n ")); @@ -2029,7 +2029,7 @@ void _rtw_join_timeout_handler (struct adapter *adapter) ; DBG_871X("%s, fw_state=%x\n", __FUNCTION__, get_fwstate(pmlmepriv)); - if(adapter->bDriverStopped ||adapter->bSurpriseRemoved) + if (adapter->bDriverStopped ||adapter->bSurpriseRemoved) return; @@ -2040,7 +2040,7 @@ void _rtw_join_timeout_handler (struct adapter *adapter) pmlmepriv->to_roaming--; if (rtw_to_roaming(adapter) != 0) { /* try another */ DBG_871X("%s try another roaming\n", __FUNCTION__); - if( _SUCCESS!=(do_join_r=rtw_do_join(adapter)) ) { + if ( _SUCCESS!=(do_join_r=rtw_do_join(adapter)) ) { DBG_871X("%s roaming do_join return %d\n", __FUNCTION__ ,do_join_r); continue; } @@ -2097,10 +2097,10 @@ static void rtw_auto_scan_handler(struct adapter *padapter) struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); /* auto site survey per 60sec */ - if(pmlmepriv->scan_interval >0) + if (pmlmepriv->scan_interval >0) { pmlmepriv->scan_interval--; - if(pmlmepriv->scan_interval==0) + if (pmlmepriv->scan_interval==0) { DBG_871X("%s\n", __FUNCTION__); @@ -2121,28 +2121,28 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter) #endif /* CONFIG_AP_MODE */ struct registry_priv *pregistrypriv = &adapter->registrypriv; - if(!adapter) + if (!adapter) return; #if defined(CONFIG_CHECK_BT_HANG) && defined(CONFIG_BT_COEXIST) - if(adapter->HalFunc.hal_checke_bt_hang) + if (adapter->HalFunc.hal_checke_bt_hang) adapter->HalFunc.hal_checke_bt_hang(adapter); #endif - if(adapter->hw_init_completed == false) + if (adapter->hw_init_completed == false) return; if ((adapter->bDriverStopped == true)||(adapter->bSurpriseRemoved== true)) return; - if(adapter->net_closed == true) + if (adapter->net_closed == true) return; rtw_dynamic_chk_wk_cmd(adapter); - if(pregistrypriv->wifi_spec==1) + if (pregistrypriv->wifi_spec==1) { #ifdef CONFIG_P2P struct wifidirect_info *pwdinfo = &adapter->wdinfo; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) #endif { /* auto site survey */ @@ -2157,9 +2157,9 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter) #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) */ #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) - if( adapter->pnetdev->br_port + if ( adapter->pnetdev->br_port #else /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */ - if( rcu_dereference(adapter->pnetdev->rx_handler_data) + if ( rcu_dereference(adapter->pnetdev->rx_handler_data) #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */ && (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) ) { @@ -2230,8 +2230,8 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv /* check bssid, if needed */ - if(pmlmepriv->assoc_by_bssid==true) { - if(_rtw_memcmp(competitor->network.MacAddress, pmlmepriv->assoc_bssid, ETH_ALEN) ==false) + if (pmlmepriv->assoc_by_bssid==true) { + if (_rtw_memcmp(competitor->network.MacAddress, pmlmepriv->assoc_bssid, ETH_ALEN) ==false) goto exit; } @@ -2242,23 +2242,23 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv goto exit; } - if(rtw_is_desired_network(adapter, competitor) == false) + if (rtw_is_desired_network(adapter, competitor) == false) goto exit; - if(rtw_to_roaming(adapter) > 0) { - if( rtw_get_passing_time_ms((u32)competitor->last_scanned) >= RTW_SCAN_RESULT_EXPIRE + if (rtw_to_roaming(adapter) > 0) { + if ( rtw_get_passing_time_ms((u32)competitor->last_scanned) >= RTW_SCAN_RESULT_EXPIRE || is_same_ess(&competitor->network, &pmlmepriv->cur_network.network) == false ) goto exit; } - if(*candidate == NULL ||(*candidate)->network.Rssinetwork.Rssi ) + if (*candidate == NULL ||(*candidate)->network.Rssinetwork.Rssi ) { *candidate = competitor; updated = true; } - if(updated){ + if (updated){ DBG_871X("[by_bssid:%u][assoc_ssid:%s]" "[to_roaming:%u] " "new candidate: %s("MAC_FMT") rssi:%d\n", @@ -2308,7 +2308,7 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv ) while (!rtw_end_of_queue_search(phead, pmlmepriv->pscanned)) { pnetwork = LIST_CONTAINOR(pmlmepriv->pscanned, struct wlan_network, list); - if(pnetwork==NULL){ + if (pnetwork==NULL){ RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("%s return _FAIL:(pnetwork==NULL)\n", __FUNCTION__)); ret = _FAIL; goto exit; @@ -2320,7 +2320,7 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv ) } - if(candidate == NULL) { + if (candidate == NULL) { DBG_871X("%s: return _FAIL(candidate == NULL)\n", __FUNCTION__); ret = _FAIL; goto exit; @@ -2341,7 +2341,7 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv ) } rtw_hal_get_def_var(adapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &(bSupportAntDiv)); - if(true == bSupportAntDiv) + if (true == bSupportAntDiv) { u8 CurrentAntenna; rtw_hal_get_def_var(adapter, HAL_DEF_CURRENT_ANTENNA, &(CurrentAntenna)); @@ -2371,13 +2371,13 @@ sint rtw_set_auth(struct adapter * adapter,struct security_priv *psecuritypriv) ; pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmd==NULL){ + if (pcmd==NULL){ res= _FAIL; /* try again */ goto exit; } psetauthparm=(struct setauth_parm*)rtw_zmalloc(sizeof(struct setauth_parm)); - if(psetauthparm==NULL){ + if (psetauthparm==NULL){ rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -2420,13 +2420,13 @@ sint rtw_set_key(struct adapter * adapter,struct security_priv *psecuritypriv,si ; psetkeyparm=(struct setkey_parm*)rtw_zmalloc(sizeof(struct setkey_parm)); - if(psetkeyparm==NULL){ + if (psetkeyparm==NULL){ res= _FAIL; goto exit; } memset(psetkeyparm, 0, sizeof(struct setkey_parm)); - if(psecuritypriv->dot11AuthAlgrthm ==dot11AuthAlgrthm_8021X){ + if (psecuritypriv->dot11AuthAlgrthm ==dot11AuthAlgrthm_8021X){ psetkeyparm->algorithm=(unsigned char)psecuritypriv->dot118021XGrpPrivacy; RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n rtw_set_key: psetkeyparm->algorithm=(unsigned char)psecuritypriv->dot118021XGrpPrivacy=%d\n", psetkeyparm->algorithm)); } @@ -2471,9 +2471,9 @@ sint rtw_set_key(struct adapter * adapter,struct security_priv *psecuritypriv,si } - if(enqueue){ + if (enqueue){ pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmd==NULL){ + if (pcmd==NULL){ rtw_mfree((unsigned char *)psetkeyparm, sizeof(struct setkey_parm)); res= _FAIL; /* try again */ goto exit; @@ -2513,7 +2513,7 @@ int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_ { ielength = initial_out_len; - if(in_ie[i] == 0xDD && in_ie[i+2] == 0x00 && in_ie[i+3] == 0x50 && in_ie[i+4] == 0xF2 && in_ie[i+5] == 0x02 && i+5 < in_len) /* WMM element ID and OUI */ + if (in_ie[i] == 0xDD && in_ie[i+2] == 0x00 && in_ie[i+3] == 0x50 && in_ie[i+4] == 0xF2 && in_ie[i+5] == 0x02 && i+5 < in_len) /* WMM element ID and OUI */ { /* Append WMM IE to the last index of out_ie */ for ( j = i; j < i + 9; j++ ) @@ -2554,7 +2554,7 @@ static int SecIsInPMKIDList(struct adapter *Adapter, u8 *bssid) do { - if( ( psecuritypriv->PMKIDList[i].bUsed ) && + if ( ( psecuritypriv->PMKIDList[i].bUsed ) && ( _rtw_memcmp( psecuritypriv->PMKIDList[i].Bssid, bssid, ETH_ALEN ) == true ) ) { break; @@ -2567,7 +2567,7 @@ static int SecIsInPMKIDList(struct adapter *Adapter, u8 *bssid) }while(isecuritypriv; - if(ie[13]<=20){ + if (ie[13]<=20){ /* The RSN IE didn't include the PMK ID, append the PMK information */ ie[ie_len]=1; ie_len++; @@ -2629,18 +2629,18 @@ sint rtw_restruct_sec_ie(struct adapter *adapter,u8 *in_ie, u8 *out_ie, uint in_ /* copy fixed ie only */ memcpy(out_ie, in_ie,12); ielength=12; - if((ndisauthmode==Ndis802_11AuthModeWPA)||(ndisauthmode==Ndis802_11AuthModeWPAPSK)) + if ((ndisauthmode==Ndis802_11AuthModeWPA)||(ndisauthmode==Ndis802_11AuthModeWPAPSK)) authmode=_WPA_IE_ID_; - if((ndisauthmode==Ndis802_11AuthModeWPA2)||(ndisauthmode==Ndis802_11AuthModeWPA2PSK)) + if ((ndisauthmode==Ndis802_11AuthModeWPA2)||(ndisauthmode==Ndis802_11AuthModeWPA2PSK)) authmode=_WPA2_IE_ID_; - if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) + if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { memcpy(out_ie+ielength, psecuritypriv->wps_ie, psecuritypriv->wps_ie_len); ielength += psecuritypriv->wps_ie_len; } - else if((authmode==_WPA_IE_ID_)||(authmode==_WPA2_IE_ID_)) + else if ((authmode==_WPA_IE_ID_)||(authmode==_WPA2_IE_ID_)) { /* copy RSN or SSN */ memcpy(&out_ie[ielength], &psecuritypriv->supplicant_ie[0], psecuritypriv->supplicant_ie[1]+2); @@ -2661,13 +2661,13 @@ sint rtw_restruct_sec_ie(struct adapter *adapter,u8 *in_ie, u8 *out_ie, uint in_ } iEntry = SecIsInPMKIDList(adapter, pmlmepriv->assoc_bssid); - if(iEntry<0) + if (iEntry<0) { return ielength; } else { - if(authmode == _WPA2_IE_ID_) + if (authmode == _WPA2_IE_ID_) { ielength=rtw_append_pmkid(adapter, iEntry, out_ie, ielength); } @@ -2734,7 +2734,7 @@ void rtw_update_registrypriv_dev_network(struct adapter* adapter) pdev_network->NetworkTypeInUse = (Ndis802_11OFDM5); break; case WIRELESS_11ABGN: - if(pregistrypriv->channel > 14) + if (pregistrypriv->channel > 14) pdev_network->NetworkTypeInUse = (Ndis802_11OFDM5); else pdev_network->NetworkTypeInUse = (Ndis802_11OFDM24); @@ -2747,7 +2747,7 @@ void rtw_update_registrypriv_dev_network(struct adapter* adapter) pdev_network->Configuration.DSConfig = (pregistrypriv->channel); RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("pregistrypriv->channel=%d, pdev_network->Configuration.DSConfig=0x%x\n", pregistrypriv->channel, pdev_network->Configuration.DSConfig)); - if(cur_network->network.InfrastructureMode == Ndis802_11IBSS) + if (cur_network->network.InfrastructureMode == Ndis802_11IBSS) pdev_network->Configuration.ATIMWindow = (0); pdev_network->InfrastructureMode = (cur_network->network.InfrastructureMode); @@ -2783,9 +2783,9 @@ void rtw_joinbss_reset(struct adapter *padapter) /* TH=1 => means that invalidate usb rx aggregation */ /* TH=0 => means that validate usb rx aggregation, use init value. */ - if(phtpriv->ht_option) + if (phtpriv->ht_option) { - if(padapter->registrypriv.wifi_spec==1) + if (padapter->registrypriv.wifi_spec==1) threshold = 1; else threshold = 0; @@ -2815,9 +2815,9 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ p = rtw_get_ie(in_ie+12, _HT_CAPABILITY_IE_, &ielen, in_len-12); - if(p && ielen>0) + if (p && ielen>0) { - if(pqospriv->qos_option == 0) + if (pqospriv->qos_option == 0) { out_len = *pout_len; pframe = rtw_set_ie(out_ie+out_len, _VENDOR_SPECIFIC_IE_, @@ -2844,7 +2844,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); ht_capie.ampdu_params_info = (max_rx_ampdu_factor&0x03); - if(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_ ) + if (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_ ) ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2)); else ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00); @@ -2856,7 +2856,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ phtpriv->ht_option = true; p = rtw_get_ie(in_ie+12, _HT_ADD_INFO_IE_, &ielen, in_len-12); - if(p && (ielen==sizeof(struct ieee80211_ht_addt_info))) + if (p && (ielen==sizeof(struct ieee80211_ht_addt_info))) { out_len = *pout_len; pframe = rtw_set_ie(out_ie+out_len, _HT_ADD_INFO_IE_, ielen, p+2 , pout_len); @@ -2886,7 +2886,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - if(!phtpriv->ht_option) + if (!phtpriv->ht_option) return; if ((!pmlmeinfo->HT_info_enable) || (!pmlmeinfo->HT_caps_enable)) @@ -2895,9 +2895,9 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) DBG_871X("+rtw_update_ht_cap()\n"); /* maybe needs check if ap supports rx ampdu. */ - if((phtpriv->ampdu_enable==false) &&(pregistrypriv->ampdu_enable==1)) + if ((phtpriv->ampdu_enable==false) &&(pregistrypriv->ampdu_enable==1)) { - if(pregistrypriv->wifi_spec==1) + if (pregistrypriv->wifi_spec==1) { phtpriv->ampdu_enable = false; } @@ -2906,7 +2906,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) phtpriv->ampdu_enable = true; } } - else if(pregistrypriv->ampdu_enable==2) + else if (pregistrypriv->ampdu_enable==2) { phtpriv->ampdu_enable = true; } @@ -2915,7 +2915,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) /* check Max Rx A-MPDU Size */ len = 0; p = rtw_get_ie(pie+sizeof (struct ndis_802_11_fixed_ies), _HT_CAPABILITY_IE_, &len, ie_len-sizeof (struct ndis_802_11_fixed_ies)); - if(p && len>0) + if (p && len>0) { pht_capie = (struct ieee80211_ht_cap *)(p+2); max_ampdu_sz = (pht_capie->ampdu_params_info & IEEE80211_HT_CAP_AMPDU_FACTOR); @@ -2929,7 +2929,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) len=0; p = rtw_get_ie(pie+sizeof (struct ndis_802_11_fixed_ies), _HT_ADD_INFO_IE_, &len, ie_len-sizeof (struct ndis_802_11_fixed_ies)); - if(p && len>0) + if (p && len>0) { pht_addtinfo = (struct ieee80211_ht_addt_info *)(p+2); /* todo: */ @@ -2948,7 +2948,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) /* update the MCS rates */ for (i = 0; i < 16; i++) { - if((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) + if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; else pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i]; @@ -2975,7 +2975,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) /* Config SM Power Save setting */ /* */ pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & 0x0C) >> 2; - if(pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) { + if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) { DBG_871X("%s(): WLAN_HT_CAP_SM_PS_STATIC\n",__FUNCTION__); } @@ -2994,8 +2994,8 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr struct pkt_attrib *pattrib =&pxmitframe->attrib; s32 bmcst = IS_MCAST(pattrib->ra); - /* if(bmcst || (padapter->mlmepriv.LinkDetectInfo.bTxBusyTraffic == false)) */ - if(bmcst || (padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod<100)) + /* if (bmcst || (padapter->mlmepriv.LinkDetectInfo.bTxBusyTraffic == false)) */ + if (bmcst || (padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod<100)) return; priority = pattrib->priority; @@ -3008,13 +3008,13 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); } - if(psta==NULL) + if (psta==NULL) { DBG_871X("%s, psta==NUL\n", __func__); return; } - if(!(psta->state &_FW_LINKED)) + if (!(psta->state &_FW_LINKED)) { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); return; @@ -3023,12 +3023,12 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr phtpriv = &psta->htpriv; - if((phtpriv->ht_option==true) && (phtpriv->ampdu_enable==true)) + if ((phtpriv->ht_option==true) && (phtpriv->ampdu_enable==true)) { issued = (phtpriv->agg_enable_bitmap>>priority)&0x1; issued |= (phtpriv->candidate_tid_bitmap>>priority)&0x1; - if(0==issued) + if (0==issued) { DBG_871X("rtw_issue_addbareq_cmd, p=%d\n", priority); psta->htpriv.candidate_tid_bitmap |= BIT((u8)priority); @@ -3066,12 +3066,12 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) struct wlan_network *pnetwork; - if(tgt_network != NULL) + if (tgt_network != NULL) pnetwork = tgt_network; else pnetwork = &pmlmepriv->cur_network; - if(0 < rtw_to_roaming(padapter)) { + if (0 < rtw_to_roaming(padapter)) { DBG_871X("roaming from %s("MAC_FMT"), length:%d\n", pnetwork->network.Ssid.Ssid, MAC_ARG(pnetwork->network.MacAddress), pnetwork->network.Ssid.SsidLength); @@ -3080,13 +3080,13 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) pmlmepriv->assoc_by_bssid = false; while(1) { - if( _SUCCESS==(do_join_r=rtw_do_join(padapter)) ) { + if ( _SUCCESS==(do_join_r=rtw_do_join(padapter)) ) { break; } else { DBG_871X("roaming do_join return %d\n", do_join_r); pmlmepriv->to_roaming--; - if(0< rtw_to_roaming(padapter)) { + if (0< rtw_to_roaming(padapter)) { continue; } else { DBG_871X("%s(%d) -to roaming fail, indicate_disconnect\n", __FUNCTION__,__LINE__); @@ -3101,15 +3101,15 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network) sint rtw_linked_check(struct adapter *padapter) { - if( (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true) || + if ( (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true) || (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == true)) { - if(padapter->stapriv.asoc_sta_count > 2) + if (padapter->stapriv.asoc_sta_count > 2) return true; } else { /* Station mode */ - if(check_fwstate(&padapter->mlmepriv, _FW_LINKED)== true) + if (check_fwstate(&padapter->mlmepriv, _FW_LINKED)== true) return true; } return false; diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index a50f7e5..cbb152e 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -223,11 +223,11 @@ int rtw_ch_set_search_ch(struct rt_channel_info *ch_set, const u32 ch) { int i; for(i=0;ch_set[i].ChannelNum!=0;i++){ - if(ch == ch_set[i].ChannelNum) + if (ch == ch_set[i].ChannelNum) break; } - if(i >= ch_set[i].ChannelNum) + if (i >= ch_set[i].ChannelNum) return -1; return i; } @@ -273,7 +273,7 @@ static void init_mlme_ext_priv_value(struct adapter* padapter) memcpy(pmlmeext->datarate, mixed_datarate, NumRates); memcpy(pmlmeext->basicrate, mixed_basicrate, NumRates); - if(pmlmeext->cur_channel > 14) + if (pmlmeext->cur_channel > 14) pmlmeext->tx_rate = IEEE80211_OFDM_RATE_6MB; else pmlmeext->tx_rate = IEEE80211_CCK_RATE_1MB; @@ -380,49 +380,49 @@ static u8 init_channel_set(struct adapter* padapter, u8 ChannelPlan, struct rt_c memset(channel_set, 0, sizeof(struct rt_channel_info)*MAX_CHANNEL_NUM); - if(ChannelPlan >= RT_CHANNEL_DOMAIN_MAX && ChannelPlan != RT_CHANNEL_DOMAIN_REALTEK_DEFINE) + if (ChannelPlan >= RT_CHANNEL_DOMAIN_MAX && ChannelPlan != RT_CHANNEL_DOMAIN_REALTEK_DEFINE) { DBG_871X("ChannelPlan ID %x error !!!!!\n",ChannelPlan); return chanset_size; } - if(padapter->registrypriv.wireless_mode & WIRELESS_11G) + if (padapter->registrypriv.wireless_mode & WIRELESS_11G) { b2_4GBand = true; - if(RT_CHANNEL_DOMAIN_REALTEK_DEFINE == ChannelPlan) + if (RT_CHANNEL_DOMAIN_REALTEK_DEFINE == ChannelPlan) Index2G = RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE.Index2G; else Index2G = RTW_ChannelPlanMap[ChannelPlan].Index2G; } - if(padapter->registrypriv.wireless_mode & WIRELESS_11A) + if (padapter->registrypriv.wireless_mode & WIRELESS_11A) { b5GBand = true; - if(RT_CHANNEL_DOMAIN_REALTEK_DEFINE == ChannelPlan) + if (RT_CHANNEL_DOMAIN_REALTEK_DEFINE == ChannelPlan) Index5G = RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE.Index5G; else Index5G = RTW_ChannelPlanMap[ChannelPlan].Index5G; } - if(b2_4GBand) + if (b2_4GBand) { for(index=0;index= 1 && channel_set[chanset_size].ChannelNum <= 11) + if (channel_set[chanset_size].ChannelNum >= 1 && channel_set[chanset_size].ChannelNum <= 11) channel_set[chanset_size].ScanType = SCAN_ACTIVE; - else if((channel_set[chanset_size].ChannelNum >= 12 && channel_set[chanset_size].ChannelNum <= 14)) + else if ((channel_set[chanset_size].ChannelNum >= 12 && channel_set[chanset_size].ChannelNum <= 14)) channel_set[chanset_size].ScanType = SCAN_PASSIVE; } - else if(RT_CHANNEL_DOMAIN_WORLD_WIDE_13 == ChannelPlan || + else if (RT_CHANNEL_DOMAIN_WORLD_WIDE_13 == ChannelPlan || RT_CHANNEL_DOMAIN_WORLD_WIDE_5G == ChannelPlan || RT_CHANNEL_DOMAIN_2G_WORLD == Index2G)/* channel 12~13, passive scan */ { - if(channel_set[chanset_size].ChannelNum <= 11) + if (channel_set[chanset_size].ChannelNum <= 11) channel_set[chanset_size].ScanType = SCAN_ACTIVE; else channel_set[chanset_size].ScanType = SCAN_PASSIVE; @@ -436,7 +436,7 @@ static u8 init_channel_set(struct adapter* padapter, u8 ChannelPlan, struct rt_c } } - if(b5GBand) + if (b5GBand) { for(index=0;index= 149 ) { - if(RT_CHANNEL_DOMAIN_WORLD_WIDE_5G == ChannelPlan)/* passive scan for all 5G channels */ + if (RT_CHANNEL_DOMAIN_WORLD_WIDE_5G == ChannelPlan)/* passive scan for all 5G channels */ channel_set[chanset_size].ScanType = SCAN_PASSIVE; else channel_set[chanset_size].ScanType = SCAN_ACTIVE; @@ -459,7 +459,7 @@ static u8 init_channel_set(struct adapter* padapter, u8 ChannelPlan, struct rt_c if ( RTW_ChannelPlan5G[Index5G].Channel[index] <= 48 || RTW_ChannelPlan5G[Index5G].Channel[index] >= 149 ) { channel_set[chanset_size].ChannelNum = RTW_ChannelPlan5G[Index5G].Channel[index]; - if(RT_CHANNEL_DOMAIN_WORLD_WIDE_5G == ChannelPlan)/* passive scan for all 5G channels */ + if (RT_CHANNEL_DOMAIN_WORLD_WIDE_5G == ChannelPlan)/* passive scan for all 5G channels */ channel_set[chanset_size].ScanType = SCAN_PASSIVE; else channel_set[chanset_size].ScanType = SCAN_ACTIVE; @@ -536,7 +536,7 @@ static u8 cmp_pkt_chnl_diff(struct adapter *padapter,u8* pframe,uint packet_len) if (p) { channel = *(p + 2); - if(padapter->mlmeextpriv.cur_channel >= channel) + if (padapter->mlmeextpriv.cur_channel >= channel) { return (padapter->mlmeextpriv.cur_channel - channel); } @@ -556,7 +556,7 @@ static void _mgt_dispatcher(struct adapter *padapter, struct mlme_handler *ptabl u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff}; u8 *pframe = precv_frame->u.hdr.rx_data; - if(ptable->func) { + if (ptable->func) { /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */ if (!_rtw_memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) && !_rtw_memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN)) @@ -623,7 +623,7 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame) switch (GetFrameSubType(pframe)) { case WIFI_AUTH: - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) ptable->func = &OnAuth; else ptable->func = &OnAuthClient; @@ -632,12 +632,12 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame) case WIFI_REASSOCREQ: _mgt_dispatcher(padapter, ptable, precv_frame); #ifdef CONFIG_HOSTAPD_MLME - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) rtw_hostapd_mlme_rx(padapter, precv_frame); #endif break; case WIFI_PROBEREQ: - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { #ifdef CONFIG_HOSTAPD_MLME rtw_hostapd_mlme_rx(padapter, precv_frame); @@ -652,12 +652,12 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame) _mgt_dispatcher(padapter, ptable, precv_frame); break; case WIFI_ACTION: - /* if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) */ + /* if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) */ _mgt_dispatcher(padapter, ptable, precv_frame); break; default: _mgt_dispatcher(padapter, ptable, precv_frame); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) rtw_hostapd_mlme_rx(padapter, precv_frame); break; } @@ -674,9 +674,9 @@ static u32 p2p_listen_state_process(struct adapter *padapter, unsigned char *da) { bool response = true; - if( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) + if ( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) { - if(padapter->cfg80211_wdinfo.is_ro_ch == false + if (padapter->cfg80211_wdinfo.is_ro_ch == false || rtw_get_oper_ch(padapter) != padapter->wdinfo.listen_channel || wdev_to_priv(padapter->rtw_wdev)->p2p_enabled == false || padapter->mlmepriv.wps_probe_resp_ie == NULL @@ -697,7 +697,7 @@ static u32 p2p_listen_state_process(struct adapter *padapter, unsigned char *da) } } else - if( padapter->wdinfo.driver_interface == DRIVER_WEXT ) + if ( padapter->wdinfo.driver_interface == DRIVER_WEXT ) { /* do nothing if the device name is empty */ if ( !padapter->wdinfo.device_name_len ) @@ -753,17 +753,17 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame) /* Commented by Kurt 2012/10/16 */ /* IOT issue: Google Nexus7 use 1M rate to send p2p_probe_req after GO nego completed and Nexus7 is client */ - if( wifi_test_chk_rate == 1 ) { - if((is_valid_p2p_probereq = process_probe_req_p2p_ie(pwdinfo, pframe, len)) == true) + if ( wifi_test_chk_rate == 1 ) { + if ((is_valid_p2p_probereq = process_probe_req_p2p_ie(pwdinfo, pframe, len)) == true) { - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE)) { p2p_listen_state_process( padapter, get_sa(pframe)); return _SUCCESS; } - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { goto _continue; } @@ -774,12 +774,12 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame) _continue: #endif /* CONFIG_P2P */ - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE)) + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { return _SUCCESS; } - if(check_fwstate(pmlmepriv, _FW_LINKED) == false && + if (check_fwstate(pmlmepriv, _FW_LINKED) == false && check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)==false) { return _SUCCESS; @@ -790,7 +790,7 @@ _continue: /* check (wildcard) SSID */ if (p != NULL) { - if(is_valid_p2p_probereq == true) + if (is_valid_p2p_probereq == true) goto _issue_probersp; if ( (ielen != 0 && false ==_rtw_memcmp((void *)(p+2), (void *)cur->Ssid.Ssid, cur->Ssid.SsidLength)) @@ -800,7 +800,7 @@ _continue: _issue_probersp: - if(((check_fwstate(pmlmepriv, _FW_LINKED) == true && + if (((check_fwstate(pmlmepriv, _FW_LINKED) == true && pmlmepriv->cur_network.join_res == true)) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { /* DBG_871X("+issue_probersp during ap mode\n"); */ @@ -826,13 +826,13 @@ unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame) #ifdef CONFIG_P2P - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ)) { if ( true == pwdinfo->tx_prov_disc_info.benable ) { - if( _rtw_memcmp( pwdinfo->tx_prov_disc_info.peerIFAddr, GetAddr2Ptr(pframe), ETH_ALEN ) ) + if ( _rtw_memcmp( pwdinfo->tx_prov_disc_info.peerIFAddr, GetAddr2Ptr(pframe), ETH_ALEN ) ) { - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT)) { pwdinfo->tx_prov_disc_info.benable = false; issue_p2p_provision_request( padapter, @@ -852,24 +852,24 @@ unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame) } return _SUCCESS; } - else if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) + else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) { if ( true == pwdinfo->nego_req_info.benable ) { DBG_871X( "[%s] P2P State is GONEGO ING!\n", __FUNCTION__ ); - if( _rtw_memcmp( pwdinfo->nego_req_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN ) ) + if ( _rtw_memcmp( pwdinfo->nego_req_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN ) ) { pwdinfo->nego_req_info.benable = false; issue_p2p_GO_request( padapter, pwdinfo->nego_req_info.peerDevAddr); } } } - else if( rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_INVITE_REQ ) ) + else if ( rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_INVITE_REQ ) ) { if ( true == pwdinfo->invitereq_info.benable ) { DBG_871X( "[%s] P2P_STATE_TX_INVITE_REQ!\n", __FUNCTION__ ); - if( _rtw_memcmp( pwdinfo->invitereq_info.peer_macaddr, GetAddr2Ptr(pframe), ETH_ALEN ) ) + if ( _rtw_memcmp( pwdinfo->invitereq_info.peer_macaddr, GetAddr2Ptr(pframe), ETH_ALEN ) ) { pwdinfo->invitereq_info.benable = false; issue_p2p_invitation_request( padapter, pwdinfo->invitereq_info.peer_macaddr ); @@ -951,7 +951,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame) return _SUCCESS; } - if(((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) && (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) + if (((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) && (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) { if ((psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe))) != NULL) { @@ -979,7 +979,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame) } } - else if((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) + else if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) { if ((psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe))) != NULL) { @@ -1039,7 +1039,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) u8 *pframe = precv_frame->u.hdr.rx_data; uint len = precv_frame->u.hdr.len; - if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) + if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) return _FAIL; DBG_871X("+OnAuth\n"); @@ -1068,7 +1068,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) goto auth_fail; } - if(rtw_access_ctrl(padapter, sa) == false) { + if (rtw_access_ctrl(padapter, sa) == false) { status = _STATS_UNABLE_HANDLE_STA_; goto auth_fail; } @@ -1095,7 +1095,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) else { spin_lock_bh(&pstapriv->asoc_list_lock); - if(rtw_is_list_empty(&pstat->asoc_list)==false) + if (rtw_is_list_empty(&pstat->asoc_list)==false) { rtw_list_delete(&pstat->asoc_list); pstapriv->asoc_list_cnt--; @@ -1166,7 +1166,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + 4 + _AUTH_IE_OFFSET_ , _CHLGETXT_IE_, (int *)&ie_len, len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ - 4); - if((p==NULL) || (ie_len<=0)) + if ((p==NULL) || (ie_len<=0)) { DBG_871X("auth rejected because challenge failure!(1)\n"); status = _STATS_CHALLENGE_FAIL_; @@ -1210,7 +1210,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) auth_fail: - if(pstat) + if (pstat) rtw_free_stainfo(padapter , pstat); pstat = &stat; @@ -1253,9 +1253,9 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram if (status != 0) { DBG_871X("clnt auth fail, status: %d\n", status); - if(status == 13)/* pmlmeinfo->auth_algo == dot11AuthAlgrthm_Auto) */ + if (status == 13)/* pmlmeinfo->auth_algo == dot11AuthAlgrthm_Auto) */ { - if(pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared) + if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared) pmlmeinfo->auth_algo = dot11AuthAlgrthm_Open; else pmlmeinfo->auth_algo = dot11AuthAlgrthm_Shared; @@ -1359,7 +1359,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) #endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */ - if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) + if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) return _FAIL; frame_type = GetFrameSubType(pframe); @@ -1451,7 +1451,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) status = _STATS_FAILURE_; } - if(_STATS_SUCCESSFUL_ != status) + if (_STATS_SUCCESSFUL_ != status) goto OnAssocReqFail; /* check if the supported rate is ok */ @@ -1473,7 +1473,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) pkt_len - WLAN_HDR_A3_LEN - ie_offset); if (p != NULL) { - if(supportRateNum<=sizeof(supportRate)) + if (supportRateNum<=sizeof(supportRate)) { memcpy(supportRate+supportRateNum, p+2, ie_len); supportRateNum += ie_len; @@ -1497,14 +1497,14 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) pstat->wpa_pairwise_cipher = 0; pstat->wpa2_pairwise_cipher = 0; memset(pstat->wpa_ie, 0, sizeof(pstat->wpa_ie)); - if((psecuritypriv->wpa_psk & BIT(1)) && elems.rsn_ie) { + if ((psecuritypriv->wpa_psk & BIT(1)) && elems.rsn_ie) { int group_cipher=0, pairwise_cipher=0; wpa_ie = elems.rsn_ie; wpa_ie_len = elems.rsn_ie_len; - if(rtw_parse_wpa2_ie(wpa_ie-2, wpa_ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + if (rtw_parse_wpa2_ie(wpa_ie-2, wpa_ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { pstat->dot8021xalg = 1;/* psk, todo:802.1x */ pstat->wpa_psk |= BIT(1); @@ -1512,10 +1512,10 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) pstat->wpa2_group_cipher = group_cipher&psecuritypriv->wpa2_group_cipher; pstat->wpa2_pairwise_cipher = pairwise_cipher&psecuritypriv->wpa2_pairwise_cipher; - if(!pstat->wpa2_group_cipher) + if (!pstat->wpa2_group_cipher) status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID; - if(!pstat->wpa2_pairwise_cipher) + if (!pstat->wpa2_pairwise_cipher) status = WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID; } else @@ -1530,7 +1530,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) wpa_ie = elems.wpa_ie; wpa_ie_len = elems.wpa_ie_len; - if(rtw_parse_wpa_ie(wpa_ie-2, wpa_ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + if (rtw_parse_wpa_ie(wpa_ie-2, wpa_ie_len+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { pstat->dot8021xalg = 1;/* psk, todo:802.1x */ pstat->wpa_psk |= BIT(0); @@ -1538,10 +1538,10 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) pstat->wpa_group_cipher = group_cipher&psecuritypriv->wpa_group_cipher; pstat->wpa_pairwise_cipher = pairwise_cipher&psecuritypriv->wpa_pairwise_cipher; - if(!pstat->wpa_group_cipher) + if (!pstat->wpa_group_cipher) status = WLAN_STATUS_GROUP_CIPHER_NOT_VALID; - if(!pstat->wpa_pairwise_cipher) + if (!pstat->wpa_pairwise_cipher) status = WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID; } @@ -1555,11 +1555,11 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) wpa_ie_len = 0; } - if(_STATS_SUCCESSFUL_ != status) + if (_STATS_SUCCESSFUL_ != status) goto OnAssocReqFail; pstat->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS); - if(wpa_ie == NULL) { + if (wpa_ie == NULL) { if (elems.wps_ie) { DBG_871X("STA included WPS IE in " "(Re)Association Request - assume WPS is " @@ -1578,16 +1578,16 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) /* AP support WPA/RSN, and sta is going to do WPS, but AP is not ready */ /* that the selected registrar of AP is _FLASE */ - if((psecuritypriv->wpa_psk >0) + if ((psecuritypriv->wpa_psk >0) && (pstat->flags & (WLAN_STA_WPS|WLAN_STA_MAYBE_WPS))) { - if(pmlmepriv->wps_beacon_ie) + if (pmlmepriv->wps_beacon_ie) { u8 selected_registrar = 0; rtw_get_wps_attr_content(pmlmepriv->wps_beacon_ie, pmlmepriv->wps_beacon_ie_len, WPS_ATTR_SELECTED_REGISTRAR , &selected_registrar, NULL); - if(!selected_registrar) + if (!selected_registrar) { DBG_871X("selected_registrar is false , or AP is not ready to do WPS\n"); @@ -1603,7 +1603,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) { int copy_len; - if(psecuritypriv->wpa_psk == 0) + if (psecuritypriv->wpa_psk == 0) { DBG_871X("STA " MAC_FMT ": WPA/RSN IE in association " "request, but AP don't support WPA/RSN\n", MAC_ARG(pstat->hwaddr)); @@ -1627,7 +1627,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) } - if(copy_len>0) + if (copy_len>0) memcpy(pstat->wpa_ie, wpa_ie-2, copy_len); } @@ -1658,29 +1658,29 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) pstat->max_sp_len = (pstat->qos_info>>5)&0x3; - if((pstat->qos_info&0xf) !=0xf) + if ((pstat->qos_info&0xf) !=0xf) pstat->has_legacy_ac = true; else pstat->has_legacy_ac = false; - if(pstat->qos_info&0xf) + if (pstat->qos_info&0xf) { - if(pstat->qos_info&BIT(0)) + if (pstat->qos_info&BIT(0)) pstat->uapsd_vo = BIT(0)|BIT(1); else pstat->uapsd_vo = 0; - if(pstat->qos_info&BIT(1)) + if (pstat->qos_info&BIT(1)) pstat->uapsd_vi = BIT(0)|BIT(1); else pstat->uapsd_vi = 0; - if(pstat->qos_info&BIT(2)) + if (pstat->qos_info&BIT(2)) pstat->uapsd_bk = BIT(0)|BIT(1); else pstat->uapsd_bk = 0; - if(pstat->qos_info&BIT(3)) + if (pstat->qos_info&BIT(3)) pstat->uapsd_be = BIT(0)|BIT(1); else pstat->uapsd_be = 0; @@ -1711,7 +1711,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) pstat->flags &= ~WLAN_STA_HT; - if((pmlmepriv->htpriv.ht_option == false) && (pstat->flags&WLAN_STA_HT)) + if ((pmlmepriv->htpriv.ht_option == false) && (pstat->flags&WLAN_STA_HT)) { status = _STATS_FAILURE_; goto OnAssocReqFail; @@ -1750,12 +1750,12 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) #ifdef CONFIG_P2P pstat->is_p2p_device = false; - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { - if( (p2pie=rtw_get_p2p_ie(pframe + WLAN_HDR_A3_LEN + ie_offset , pkt_len - WLAN_HDR_A3_LEN - ie_offset , NULL, &p2pielen))) + if ( (p2pie=rtw_get_p2p_ie(pframe + WLAN_HDR_A3_LEN + ie_offset , pkt_len - WLAN_HDR_A3_LEN - ie_offset , NULL, &p2pielen))) { pstat->is_p2p_device = true; - if((p2p_status_code=(u8)process_assoc_req_p2p_ie(pwdinfo, pframe, pkt_len, pstat))>0) + if ((p2p_status_code=(u8)process_assoc_req_p2p_ie(pwdinfo, pframe, pkt_len, pstat))>0) { pstat->p2p_status_code = p2p_status_code; status = _STATS_CAP_FAIL_; @@ -1763,7 +1763,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) } } #ifdef CONFIG_P2P - if(rtw_get_wfd_ie(pframe + WLAN_HDR_A3_LEN + ie_offset , pkt_len - WLAN_HDR_A3_LEN - ie_offset , wfd_ie, &wfd_ielen )) + if (rtw_get_wfd_ie(pframe + WLAN_HDR_A3_LEN + ie_offset , pkt_len - WLAN_HDR_A3_LEN - ie_offset , wfd_ie, &wfd_ielen )) { u8 attr_content[ 10 ] = { 0x00 }; u32 attr_contentlen = 0; @@ -1829,7 +1829,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) spin_unlock_bh(&pstapriv->asoc_list_lock); /* now the station is qualified to join our BSS... */ - if(pstat && (pstat->state & WIFI_FW_ASSOC_SUCCESS) && (_STATS_SUCCESSFUL_==status)) + if (pstat && (pstat->state & WIFI_FW_ASSOC_SUCCESS) && (_STATS_SUCCESSFUL_==status)) { /* 1 bss_cap_update & sta_info_update */ bss_cap_update_on_sta_join(padapter, pstat); @@ -1842,7 +1842,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) issue_asocrsp(padapter, status, pstat, WIFI_REASSOCRSP); spin_lock_bh(&pstat->lock); - if(pstat->passoc_req) + if (pstat->passoc_req) { rtw_mfree(pstat->passoc_req, pstat->assoc_req_len); pstat->passoc_req = NULL; @@ -1850,7 +1850,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) } pstat->passoc_req = rtw_zmalloc(pkt_len); - if(pstat->passoc_req) + if (pstat->passoc_req) { memcpy(pstat->passoc_req, pframe, pkt_len); pstat->assoc_req_len = pkt_len; @@ -2016,7 +2016,7 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame) DBG_871X("%s Reason code(%d)\n", __FUNCTION__,reason); #ifdef CONFIG_AP_MODE - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { unsigned long irqL; struct sta_info *psta; @@ -2030,12 +2030,12 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame) reason, GetAddr2Ptr(pframe)); psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); - if(psta) + if (psta) { u8 updated; spin_lock_bh(&pstapriv->asoc_list_lock); - if(rtw_is_list_empty(&psta->asoc_list)==false) + if (rtw_is_list_empty(&psta->asoc_list)==false) { rtw_list_delete(&psta->asoc_list); pstapriv->asoc_list_cnt--; @@ -2112,7 +2112,7 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame) DBG_871X("%s Reason code(%d)\n", __FUNCTION__,reason); #ifdef CONFIG_AP_MODE - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { unsigned long irqL; struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; @@ -2125,12 +2125,12 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame) reason, GetAddr2Ptr(pframe)); psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); - if(psta) + if (psta) { u8 updated; spin_lock_bh(&pstapriv->asoc_list_lock); - if(rtw_is_list_empty(&psta->asoc_list)==false) + if (rtw_is_list_empty(&psta->asoc_list)==false) { rtw_list_delete(&psta->asoc_list); pstapriv->asoc_list_cnt--; @@ -2240,7 +2240,7 @@ unsigned int on_action_spct(struct adapter *padapter, union recv_frame *precv_fr goto exit; category = frame_body[0]; - if(category != RTW_WLAN_CATEGORY_SPECTRUM_MGMT) + if (category != RTW_WLAN_CATEGORY_SPECTRUM_MGMT) goto exit; action = frame_body[1]; @@ -2292,14 +2292,14 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra DBG_871X("%s\n", __FUNCTION__); - if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) + if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) if (!(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) return _SUCCESS; addr = GetAddr2Ptr(pframe); psta = rtw_get_stainfo(pstapriv, addr); - if(psta==NULL) + if (psta==NULL) return _SUCCESS; frame_body = (unsigned char *)(pframe + sizeof(struct rtw_ieee80211_hdr_3addr)); @@ -2322,7 +2322,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra /* process_addba_req(padapter, (u8*)&(pmlmeinfo->ADDBA_req), GetAddr3Ptr(pframe)); */ process_addba_req(padapter, (u8*)&(pmlmeinfo->ADDBA_req), addr); - if(pmlmeinfo->bAcceptAddbaReq == true) { + if (pmlmeinfo->bAcceptAddbaReq == true) { issue_action_BA(padapter, addr, RTW_WLAN_ACTION_ADDBA_RESP, 0); } else { issue_action_BA(padapter, addr, @@ -2359,7 +2359,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra /* reason_code = frame_body[4] | (frame_body[5] << 8); */ reason_code = RTW_GET_LE16(&frame_body[4]); } - else if((frame_body[3] & BIT(3)) == BIT(3)) + else if ((frame_body[3] & BIT(3)) == BIT(3)) { tid = (frame_body[3] >> 4) & 0x0F; @@ -2927,7 +2927,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8* raddr, u8* frame /* Commented by Kurt 20120113 */ /* If some device wants to do p2p handshake without sending prov_disc_req */ /* We have to get peer_req_cm from here. */ - if(_rtw_memcmp( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "000", 3) ) + if (_rtw_memcmp( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "000", 3) ) { if ( wps_devicepassword_id == WPS_DPID_USER_SPEC ) { @@ -3869,9 +3869,9 @@ void issue_p2p_invitation_response(struct adapter *padapter, u8* raddr, u8 dialo p2pie[ p2pielen++ ] = 200; /* 2 seconds needed to be the P2P GO */ p2pie[ p2pielen++ ] = 200; /* 2 seconds needed to be the P2P Client */ - if( status_code == P2P_STATUS_SUCCESS ) + if ( status_code == P2P_STATUS_SUCCESS ) { - if( rtw_p2p_chk_role( pwdinfo, P2P_ROLE_GO ) ) + if ( rtw_p2p_chk_role( pwdinfo, P2P_ROLE_GO ) ) { /* The P2P Invitation request frame asks this Wi-Fi device to be the P2P GO */ /* In this case, the P2P Invitation response frame should carry the two more P2P attributes. */ @@ -4191,9 +4191,9 @@ void issue_probersp_p2p(struct adapter *padapter, unsigned char *da) /* DS parameter set */ pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&pwdinfo->listen_channel, &pattrib->pktlen); - if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) + if (wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) { - if( pmlmepriv->wps_probe_resp_ie != NULL && pmlmepriv->p2p_probe_resp_ie != NULL ) + if ( pmlmepriv->wps_probe_resp_ie != NULL && pmlmepriv->p2p_probe_resp_ie != NULL ) { /* WPS IE */ memcpy(pframe, pmlmepriv->wps_probe_resp_ie, pmlmepriv->wps_probe_resp_ie_len); @@ -4476,7 +4476,7 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack) pframe += sizeof (struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr); - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ)) { pframe = rtw_set_ie(pframe, _SSID_IE_, pwdinfo->tx_prov_disc_info.ssid.SsidLength, pwdinfo->tx_prov_disc_info.ssid.Ssid, &(pattrib->pktlen)); } @@ -4487,9 +4487,9 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack) /* Use the OFDM rate in the P2P probe request frame. ( 6(B), 9(B), 12(B), 24(B), 36, 48, 54 ) */ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, 8, pwdinfo->support_rate, &pattrib->pktlen); - if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) + if (wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) { - if( pmlmepriv->wps_probe_req_ie != NULL && pmlmepriv->p2p_probe_req_ie != NULL ) + if ( pmlmepriv->wps_probe_req_ie != NULL && pmlmepriv->p2p_probe_req_ie != NULL ) { /* WPS IE */ memcpy(pframe, pmlmepriv->wps_probe_req_ie, pmlmepriv->wps_probe_req_ie_len); @@ -4524,7 +4524,7 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack) /* Value: */ wpsie[wpsielen++] = WPS_VERSION_1; /* Version 1.0 */ - if( pmlmepriv->wps_probe_req_ie == NULL ) + if ( pmlmepriv->wps_probe_req_ie == NULL ) { /* UUID-E */ /* Type: */ @@ -4711,7 +4711,7 @@ static int _issue_probereq_p2p(struct adapter *padapter, u8 *da, int wait_ack) pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2pie, &pattrib->pktlen ); - if( pmlmepriv->wps_probe_req_ie != NULL ) + if ( pmlmepriv->wps_probe_req_ie != NULL ) { /* WPS IE */ memcpy(pframe, pmlmepriv->wps_probe_req_ie, pmlmepriv->wps_probe_req_ie_len); @@ -4771,7 +4771,7 @@ int issue_probereq_p2p_ex(struct adapter *adapter, u8 *da, int try_cnt, int wait if (adapter->bDriverStopped || adapter->bSurpriseRemoved) break; - if(i < try_cnt && wait_ms > 0 && ret==_FAIL) + if (i < try_cnt && wait_ms > 0 && ret==_FAIL) rtw_msleep_os(wait_ms); }while((ireset_ch_sitesurvey ); - if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211) + if (wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211) { rtw_cfg80211_rx_p2p_action_public(padapter, pframe, len); } else { /* Do nothing if the driver doesn't enable the P2P function. */ - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) return _SUCCESS; len -= sizeof(struct rtw_ieee80211_hdr_3addr); @@ -4876,12 +4876,12 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) DBG_871X( "[%s] Got GO Nego Req Frame\n", __FUNCTION__); memset( &pwdinfo->groupid_info, 0x00, sizeof( struct group_id_info ) ); - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ)) { rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); } - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL)) { /* Commented by Albert 20110526 */ /* In this case, this means the previous nego fail doesn't be reset yet. */ @@ -4892,12 +4892,12 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) } /* Commented by Kurt 20110902 */ /* Add if statement to avoid receiving duplicate prov disc req. such that pre_p2p_state would be covered. */ - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); /* Commented by Kurt 20120113 */ /* Get peer_dev_addr here if peer doesn't issue prov_disc frame. */ - if( _rtw_memcmp(pwdinfo->rx_prov_disc_info.peerDevAddr, empty_addr, ETH_ALEN) ) + if ( _rtw_memcmp(pwdinfo->rx_prov_disc_info.peerDevAddr, empty_addr, ETH_ALEN) ) memcpy(pwdinfo->rx_prov_disc_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN); result = process_p2p_group_negotation_req( pwdinfo, frame_body, len ); @@ -4911,7 +4911,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) { DBG_871X( "[%s] Got GO Nego Resp Frame\n", __FUNCTION__); - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) { /* Commented by Albert 20110425 */ /* The restore timer is enabled when issuing the nego request frame of rtw_p2p_connect function. */ @@ -4937,7 +4937,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) /* Reset the dialog token for group negotiation frames. */ pwdinfo->negotiation_dialog_token = 1; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL)) { _set_timer( &pwdinfo->restore_p2p_state_timer, 5000 ); } @@ -5040,7 +5040,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) if ( rtw_get_p2p_attr_content(merged_p2pie, merged_p2p_ielen, P2P_ATTR_OPERATING_CH, operatingch_info, &attr_contentlen) ) { - if( rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, (u32)operatingch_info[4] ) ) + if ( rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, (u32)operatingch_info[4] ) ) { /* The operating channel is acceptable for this device. */ pwdinfo->rx_invitereq_info.operation_ch[0]= operatingch_info[4]; @@ -5207,7 +5207,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) /* 20110902 Kurt */ /* Add the following statement to avoid receiving duplicate prov disc req. such that pre_p2p_state would be covered. */ - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ)) + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ)) rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); rtw_p2p_set_state(pwdinfo, P2P_STATE_RX_PROVISION_DIS_REQ); @@ -5232,7 +5232,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame) exit: - if(merged_p2pie) + if (merged_p2pie) { rtw_mfree(merged_p2pie, merged_p2p_ielen + 2); } @@ -5292,7 +5292,7 @@ unsigned int on_action_public(struct adapter *padapter, union recv_frame *precv_ goto exit; category = frame_body[0]; - if(category != RTW_WLAN_CATEGORY_PUBLIC) + if (category != RTW_WLAN_CATEGORY_PUBLIC) goto exit; action = frame_body[1]; @@ -5340,7 +5340,7 @@ unsigned int OnAction_sa_query(struct adapter *padapter, union recv_frame *precv default: break; } - if(0) + if (0) { int pp; printk("pattrib->pktlen = %d =>", pattrib->pkt_len); @@ -5377,13 +5377,13 @@ unsigned int OnAction_p2p(struct adapter *padapter, union recv_frame *precv_fram frame_body = (unsigned char *)(pframe + sizeof(struct rtw_ieee80211_hdr_3addr)); category = frame_body[0]; - if(category != RTW_WLAN_CATEGORY_P2P) + if (category != RTW_WLAN_CATEGORY_P2P) return _SUCCESS; if (be32_to_cpu(*((__be32*)(frame_body + 1))) != P2POUI) return _SUCCESS; - if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) + if (wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) { rtw_cfg80211_rx_action_p2p(padapter, pframe, len); return _SUCCESS; @@ -5439,7 +5439,7 @@ unsigned int OnAction(struct adapter *padapter, union recv_frame *precv_frame) { ptable = &OnAction_tbl[i]; - if(category == ptable->num) + if (category == ptable->num) ptable->func(padapter, precv_frame); } @@ -5526,7 +5526,7 @@ void update_mgntframe_attrib(struct adapter *padapter, struct pkt_attrib *pattri pattrib->pktlen = 0; - if(pmlmeext->cur_wireless_mode & WIRELESS_11B) + if (pmlmeext->cur_wireless_mode & WIRELESS_11B) pattrib->raid = 6;/* b mode */ else pattrib->raid = 5;/* a/g mode */ @@ -5548,7 +5548,7 @@ void update_mgntframe_attrib(struct adapter *padapter, struct pkt_attrib *pattri void dump_mgntframe(struct adapter *padapter, struct xmit_frame *pmgntframe) { - if(padapter->bSurpriseRemoved == true || + if (padapter->bSurpriseRemoved == true || padapter->bDriverStopped == true) { rtw_free_xmitbuf(&padapter->xmitpriv, pmgntframe->pxmitbuf); @@ -5567,7 +5567,7 @@ s32 dump_mgntframe_and_wait(struct adapter *padapter, struct xmit_frame *pmgntfr struct xmit_buf *pxmitbuf = pmgntframe->pxmitbuf; struct submit_ctx sctx; - if(padapter->bSurpriseRemoved == true || + if (padapter->bSurpriseRemoved == true || padapter->bDriverStopped == true) { rtw_free_xmitbuf(&padapter->xmitpriv, pmgntframe->pxmitbuf); @@ -5596,7 +5596,7 @@ s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmg u32 timeout_ms = 500;/* 500ms */ struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - if(padapter->bSurpriseRemoved == true || + if (padapter->bSurpriseRemoved == true || padapter->bDriverStopped == true) { rtw_free_xmitbuf(&padapter->xmitpriv, pmgntframe->pxmitbuf); @@ -5626,7 +5626,7 @@ static int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode) ssid_ie = rtw_get_ie(ies, WLAN_EID_SSID, &ssid_len_ori, ies_len); - if(ssid_ie && ssid_len_ori>0) + if (ssid_ie && ssid_len_ori>0) { switch(hidden_ssid_mode) { @@ -5712,7 +5712,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr); - if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) + if ( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { /* DBG_871X("ie len=%d\n", cur_network->IELength); */ #ifdef CONFIG_P2P @@ -5721,7 +5721,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) u8 *wpsie=NULL; wpsie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wpsielen); - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) && wpsie && wpsielen>0) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) && wpsie && wpsielen>0) { uint wps_offset, remainder_ielen; u8 *premainder_ie, *pframe_wscie; @@ -5732,9 +5732,9 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) remainder_ielen = cur_network->IELength - wps_offset - wpsielen; - if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) + if (wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) { - if(pmlmepriv->wps_beacon_ie && pmlmepriv->wps_beacon_ie_len>0) + if (pmlmepriv->wps_beacon_ie && pmlmepriv->wps_beacon_ie_len>0) { memcpy(pframe, cur_network->IEs, wps_offset); pframe += wps_offset; @@ -5842,13 +5842,13 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) } #ifdef CONFIG_P2P - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { u32 len; - if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) + if (wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) { len = pmlmepriv->p2p_beacon_ie_len; - if(pmlmepriv->p2p_beacon_ie && len>0) + if (pmlmepriv->p2p_beacon_ie && len>0) memcpy(pframe, pmlmepriv->p2p_beacon_ie, len); } else { len = build_beacon_p2p_ie(pwdinfo, pframe); @@ -5857,11 +5857,11 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) pframe += len; pattrib->pktlen += len; #ifdef CONFIG_P2P - if(pwdinfo->wfd_info->wfd_enable) { + if (pwdinfo->wfd_info->wfd_enable) { len = build_beacon_wfd_ie( pwdinfo, pframe ); } else { len = 0; - if(pmlmepriv->wfd_beacon_ie && pmlmepriv->wfd_beacon_ie_len>0) + if (pmlmepriv->wfd_beacon_ie && pmlmepriv->wfd_beacon_ie_len>0) { len = pmlmepriv->wfd_beacon_ie_len; memcpy(pframe, pmlmepriv->wfd_beacon_ie, len); @@ -5907,7 +5907,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) /* DS parameter set */ pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pattrib->pktlen); - /* if( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) */ + /* if ( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) */ { u8 erpinfo=0; u32 ATIMWindow; @@ -5947,7 +5947,7 @@ _issue_bcn: pattrib->last_txcmdsz = pattrib->pktlen; /* DBG_871X("issue bcn_sz=%d\n", pattrib->last_txcmdsz); */ - if(timeout_ms > 0) + if (timeout_ms > 0) dump_mgntframe_and_wait(padapter, pmgntframe, timeout_ms); else dump_mgntframe(padapter, pmgntframe); @@ -6015,16 +6015,16 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p pframe += pattrib->hdrlen; - if(cur_network->IELength>MAX_IE_SZ) + if (cur_network->IELength>MAX_IE_SZ) return; #if defined (CONFIG_AP_MODE) - if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) + if ( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { pwps_ie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen); /* inerset & update wps_probe_resp_ie */ - if((pmlmepriv->wps_probe_resp_ie!=NULL) && pwps_ie && (wps_ielen>0)) + if ((pmlmepriv->wps_probe_resp_ie!=NULL) && pwps_ie && (wps_ielen>0)) { uint wps_offset, remainder_ielen; u8 *premainder_ie; @@ -6040,14 +6040,14 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p pattrib->pktlen += wps_offset; wps_ielen = (uint)pmlmepriv->wps_probe_resp_ie[1];/* to get ie data len */ - if((wps_offset+wps_ielen+2)<=MAX_IE_SZ) + if ((wps_offset+wps_ielen+2)<=MAX_IE_SZ) { memcpy(pframe, pmlmepriv->wps_probe_resp_ie, wps_ielen+2); pframe += wps_ielen+2; pattrib->pktlen += wps_ielen+2; } - if((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ) + if ((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ) { memcpy(pframe, premainder_ie, remainder_ielen); pframe += remainder_ielen; @@ -6129,7 +6129,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p /* DS parameter set */ pframe =rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pattrib->pktlen); - if( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) + if ( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) { u8 erpinfo=0; u32 ATIMWindow; @@ -6155,14 +6155,14 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p } #ifdef CONFIG_P2P - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) /*&& is_valid_p2p_probereq*/) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) /*&& is_valid_p2p_probereq*/) { u32 len; - if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) + if (wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) { /* if pwdinfo->role == P2P_ROLE_DEVICE will call issue_probersp_p2p() */ len = pmlmepriv->p2p_go_probe_resp_ie_len; - if(pmlmepriv->p2p_go_probe_resp_ie && len>0) + if (pmlmepriv->p2p_go_probe_resp_ie && len>0) memcpy(pframe, pmlmepriv->p2p_go_probe_resp_ie, len); } else { len = build_probe_resp_p2p_ie(pwdinfo, pframe); @@ -6172,14 +6172,14 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p pattrib->pktlen += len; #ifdef CONFIG_P2P - if(true == pwdinfo->wfd_info->wfd_enable) + if (true == pwdinfo->wfd_info->wfd_enable) { len = build_probe_resp_wfd_ie(pwdinfo, pframe, 0); } else { len = 0; - if(pmlmepriv->wfd_probe_resp_ie && pmlmepriv->wfd_probe_resp_ie_len>0) + if (pmlmepriv->wfd_probe_resp_ie && pmlmepriv->wfd_probe_resp_ie_len>0) { len = pmlmepriv->wfd_probe_resp_ie_len; memcpy(pframe, pmlmepriv->wfd_probe_resp_ie, len); @@ -6263,7 +6263,7 @@ static int _issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *ps pframe += sizeof (struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr); - if(pssid) + if (pssid) pframe = rtw_set_ie(pframe, _SSID_IE_, pssid->SsidLength, pssid->Ssid, &(pattrib->pktlen)); else pframe = rtw_set_ie(pframe, _SSID_IE_, 0, NULL, &(pattrib->pktlen)); @@ -6281,7 +6281,7 @@ static int _issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *ps } /* add wps_ie for wps2.0 */ - if(pmlmepriv->wps_probe_req_ie_len>0 && pmlmepriv->wps_probe_req_ie) + if (pmlmepriv->wps_probe_req_ie_len>0 && pmlmepriv->wps_probe_req_ie) { memcpy(pframe, pmlmepriv->wps_probe_req_ie, pmlmepriv->wps_probe_req_ie_len); pframe += pmlmepriv->wps_probe_req_ie_len; @@ -6324,7 +6324,7 @@ int issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, if (padapter->bDriverStopped || padapter->bSurpriseRemoved) break; - if(i < try_cnt && wait_ms > 0 && ret==_FAIL) + if (i < try_cnt && wait_ms > 0 && ret==_FAIL) rtw_msleep_os(wait_ms); }while((ipktlen = sizeof(struct rtw_ieee80211_hdr_3addr); - if(psta) { /* for AP mode */ + if (psta) { /* for AP mode */ memcpy(pwlanhdr->addr1, psta->hwaddr, ETH_ALEN); memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN); @@ -6399,7 +6399,7 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short /* setting auth algo number */ val16 = (u16)psta->authalg; - if(status != _STATS_SUCCESSFUL_) + if (status != _STATS_SUCCESSFUL_) val16 = 0; if (val16) { @@ -6563,7 +6563,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i /* FILL HT CAP INFO IE */ /* p = hostapd_eid_ht_capabilities_info(hapd, p); */ pbuf = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pnetwork->IELength - _BEACON_IE_OFFSET_)); - if(pbuf && ie_len>0) { + if (pbuf && ie_len>0) { memcpy(pframe, pbuf, ie_len+2); pframe += (ie_len+2); pattrib->pktlen +=(ie_len+2); @@ -6572,7 +6572,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i /* FILL HT ADD INFO IE */ /* p = hostapd_eid_ht_operation(hapd, p); */ pbuf = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - _BEACON_IE_OFFSET_)); - if(pbuf && ie_len>0) { + if (pbuf && ie_len>0) { memcpy(pframe, pbuf, ie_len+2); pframe += (ie_len+2); pattrib->pktlen +=(ie_len+2); @@ -6587,7 +6587,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i for (pbuf = ie + _BEACON_IE_OFFSET_; ;pbuf+= (ie_len + 2)) { pbuf = rtw_get_ie(pbuf, _VENDOR_SPECIFIC_IE_, &ie_len, (pnetwork->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2))); - if(pbuf && _rtw_memcmp(pbuf+2, WMM_PARA_IE, 6)) { + if (pbuf && _rtw_memcmp(pbuf+2, WMM_PARA_IE, 6)) { memcpy(pframe, pbuf, ie_len+2); pframe += (ie_len+2); pattrib->pktlen +=(ie_len+2); @@ -6604,7 +6604,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 6 , REALTEK_96B_IE, &(pattrib->pktlen)); /* add WPS IE ie for wps 2.0 */ - if(pmlmepriv->wps_assoc_resp_ie && pmlmepriv->wps_assoc_resp_ie_len>0) { + if (pmlmepriv->wps_assoc_resp_ie && pmlmepriv->wps_assoc_resp_ie_len>0) { memcpy(pframe, pmlmepriv->wps_assoc_resp_ie, pmlmepriv->wps_assoc_resp_ie_len); pframe += pmlmepriv->wps_assoc_resp_ie_len; @@ -6612,8 +6612,8 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i } #ifdef CONFIG_P2P - if( padapter->wdinfo.driver_interface == DRIVER_WEXT ) { - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) && (pstat->is_p2p_device == true)) { + if ( padapter->wdinfo.driver_interface == DRIVER_WEXT ) { + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) && (pstat->is_p2p_device == true)) { u32 len; len = build_assoc_resp_p2p_ie(pwdinfo, pframe, pstat->p2p_status_code); @@ -6623,7 +6623,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i } } #ifdef CONFIG_P2P - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO) && (true == pwdinfo->wfd_info->wfd_enable) ) { @@ -6726,7 +6726,7 @@ void issue_assocreq(struct adapter *padapter) get_rate_set(padapter, sta_bssrate, &sta_bssrate_len); /* DBG_871X("sta_bssrate_len=%d\n", sta_bssrate_len); */ - if(pmlmeext->cur_channel == 14)/* for JAPAN, channel 14 can only uses B Mode(CCK) */ + if (pmlmeext->cur_channel == 14)/* for JAPAN, channel 14 can only uses B Mode(CCK) */ { sta_bssrate_len = 4; } @@ -6790,7 +6790,7 @@ void issue_assocreq(struct adapter *padapter) pframe = rtw_set_ie(pframe, _RSN_IE_2_, ie_len, (p + 2), &(pattrib->pktlen)); /* HT caps */ - if(padapter->mlmepriv.htpriv.ht_option==true) { + if (padapter->mlmepriv.htpriv.ht_option==true) { p = rtw_get_ie((pmlmeinfo->network.IEs + sizeof(struct ndis_802_11_fixed_ies)), _HT_CAPABILITY_IE_, &ie_len, (pmlmeinfo->network.IELength - sizeof(struct ndis_802_11_fixed_ies))); if (p && (!is_ap_in_tkip(padapter))) { memcpy(&(pmlmeinfo->HT_caps), (p + 2), sizeof(struct HT_caps_element)); @@ -6808,7 +6808,7 @@ void issue_assocreq(struct adapter *padapter) /* switch (pregpriv->rf_config) */ switch(rf_type) { case RF_1T1R: - if(pregpriv->rx_stbc) + if (pregpriv->rx_stbc) pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info |= cpu_to_le16(0x0100);/* RX STBC One spatial stream */ memcpy(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_rate_1R, 16); @@ -6816,7 +6816,7 @@ void issue_assocreq(struct adapter *padapter) case RF_2T2R: case RF_1T2R: default: - if((pregpriv->rx_stbc == 0x3) ||/* enable for 2.4/5 GHz */ + if ((pregpriv->rx_stbc == 0x3) ||/* enable for 2.4/5 GHz */ ((pmlmeext->cur_wireless_mode & WIRELESS_11_24N) && (pregpriv->rx_stbc == 0x1)) || /* enable for 2.4GHz */ ((pmlmeext->cur_wireless_mode & WIRELESS_11_5N) && (pregpriv->rx_stbc == 0x2)) || /* enable for 5GHz */ (pregpriv->wifi_spec==1)) { @@ -6851,12 +6851,12 @@ void issue_assocreq(struct adapter *padapter) (_rtw_memcmp(pIE->data, WMM_OUI, 4)) || (_rtw_memcmp(pIE->data, WPS_OUI, 4))) { - if(!padapter->registrypriv.wifi_spec) + if (!padapter->registrypriv.wifi_spec) { /* Commented by Kurt 20110629 */ /* In some older APs, WPS handshake */ /* would be fail if we append vender extensions informations to AP */ - if(_rtw_memcmp(pIE->data, WPS_OUI, 4)){ + if (_rtw_memcmp(pIE->data, WPS_OUI, 4)){ pIE->Length=14; } } @@ -6876,16 +6876,16 @@ void issue_assocreq(struct adapter *padapter) #ifdef CONFIG_P2P - if(wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) + if (wdev_to_priv(padapter->rtw_wdev)->p2p_enabled && pwdinfo->driver_interface == DRIVER_CFG80211 ) { - if(pmlmepriv->p2p_assoc_req_ie && pmlmepriv->p2p_assoc_req_ie_len>0) + if (pmlmepriv->p2p_assoc_req_ie && pmlmepriv->p2p_assoc_req_ie_len>0) { memcpy(pframe, pmlmepriv->p2p_assoc_req_ie, pmlmepriv->p2p_assoc_req_ie_len); pframe += pmlmepriv->p2p_assoc_req_ie_len; pattrib->pktlen += pmlmepriv->p2p_assoc_req_ie_len; } } else { - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) { /* Should add the P2P IE in the association request frame. */ /* P2P OUI */ @@ -7071,7 +7071,7 @@ static int _issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned /* DBG_871X("%s:%d\n", __FUNCTION__, power_mode); */ - if(!padapter) + if (!padapter) goto exit; pxmitpriv = &(padapter->xmitpriv); @@ -7096,11 +7096,11 @@ static int _issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned fctrl = &(pwlanhdr->frame_ctl); *(fctrl) = 0; - if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) + if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { SetFrDs(fctrl); } - else if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) + else if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) { SetToDs(fctrl); } @@ -7123,7 +7123,7 @@ static int _issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned pattrib->last_txcmdsz = pattrib->pktlen; - if(wait_ack) + if (wait_ack) { ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe); } @@ -7161,7 +7161,7 @@ int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int pow if (padapter->bDriverStopped || padapter->bSurpriseRemoved) break; - if(i < try_cnt && wait_ms > 0 && ret==_FAIL) + if (i < try_cnt && wait_ms > 0 && ret==_FAIL) rtw_msleep_os(wait_ms); }while((iframe_ctl); *(fctrl) = 0; - if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) + if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { SetFrDs(fctrl); } - else if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) + else if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) { SetToDs(fctrl); } - if(pattrib->mdata) + if (pattrib->mdata) SetMData(fctrl); qc = (unsigned short *)(pframe + pattrib->hdrlen - 2); @@ -7259,7 +7259,7 @@ static int _issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 pattrib->last_txcmdsz = pattrib->pktlen; - if(wait_ack) + if (wait_ack) { ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe); } @@ -7296,7 +7296,7 @@ int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 tid, int if (padapter->bDriverStopped || padapter->bSurpriseRemoved) break; - if(i < try_cnt && wait_ms > 0 && ret==_FAIL) + if (i < try_cnt && wait_ms > 0 && ret==_FAIL) rtw_msleep_os(wait_ms); }while((ilast_txcmdsz = pattrib->pktlen; - if(wait_ack) + if (wait_ack) { ret = dump_mgntframe_and_wait_ack(padapter, pmgntframe); } @@ -7419,7 +7419,7 @@ int issue_deauth_ex(struct adapter *padapter, u8 *da, unsigned short reason, int if (padapter->bDriverStopped || padapter->bSurpriseRemoved) break; - if(i < try_cnt && wait_ms > 0 && ret==_FAIL) + if (i < try_cnt && wait_ms > 0 && ret==_FAIL) rtw_msleep_os(wait_ms); }while((iframe_ctl); *(fctrl) = 0; - if(raddr) + if (raddr) memcpy(pwlanhdr->addr1, raddr, ETH_ALEN); else memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); @@ -7698,13 +7698,13 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr, pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->ADDBA_req.dialog_token), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&status), &(pattrib->pktlen)); rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); - if(MAX_AMPDU_FACTOR_64K == max_rx_ampdu_factor) + if (MAX_AMPDU_FACTOR_64K == max_rx_ampdu_factor) BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); /* 64 buffer size */ - else if(MAX_AMPDU_FACTOR_32K == max_rx_ampdu_factor) + else if (MAX_AMPDU_FACTOR_32K == max_rx_ampdu_factor) BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0800); /* 32 buffer size */ - else if(MAX_AMPDU_FACTOR_16K == max_rx_ampdu_factor) + else if (MAX_AMPDU_FACTOR_16K == max_rx_ampdu_factor) BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0400); /* 16 buffer size */ - else if(MAX_AMPDU_FACTOR_8K == max_rx_ampdu_factor) + else if (MAX_AMPDU_FACTOR_8K == max_rx_ampdu_factor) BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0200); /* 8 buffer size */ else BA_para_set = ((le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); /* 64 buffer size */ @@ -7719,9 +7719,9 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr, } #endif - if(pregpriv->ampdu_amsdu==0)/* disabled */ + if (pregpriv->ampdu_amsdu==0)/* disabled */ le_tmp = cpu_to_le16(BA_para_set & ~BIT(0)); - else if(pregpriv->ampdu_amsdu==1)/* enabled */ + else if (pregpriv->ampdu_amsdu==1)/* enabled */ le_tmp = cpu_to_le16(BA_para_set | BIT(0)); else /* auto */ le_tmp = cpu_to_le16(BA_para_set); @@ -7766,10 +7766,10 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) struct __queue *queue = &(pmlmepriv->scanned_queue); u8 InfoContent[16] = {0}; u8 ICS[8][15]; - if((pmlmepriv->num_FortyMHzIntolerant==0) || (pmlmepriv->num_sta_no_ht==0)) + if ((pmlmepriv->num_FortyMHzIntolerant==0) || (pmlmepriv->num_sta_no_ht==0)) return; - if(true == pmlmeinfo->bwmode_updated) + if (true == pmlmeinfo->bwmode_updated) return; @@ -7812,7 +7812,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) /* */ - if(pmlmepriv->num_FortyMHzIntolerant>0) + if (pmlmepriv->num_FortyMHzIntolerant>0) { u8 iedata=0; @@ -7825,7 +7825,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) /* */ memset(ICS, 0, sizeof(ICS)); - if(pmlmepriv->num_sta_no_ht>0) + if (pmlmepriv->num_sta_no_ht>0) { int i; @@ -7850,13 +7850,13 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) pbss_network = (struct wlan_bssid_ex *)&pnetwork->network; p = rtw_get_ie(pbss_network->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pbss_network->IELength - _FIXED_IE_LENGTH_); - if((p==NULL) || (len==0))/* non-HT */ + if ((p==NULL) || (len==0))/* non-HT */ { - if((pbss_network->Configuration.DSConfig<=0) || (pbss_network->Configuration.DSConfig>14)) + if ((pbss_network->Configuration.DSConfig<=0) || (pbss_network->Configuration.DSConfig>14)) continue; ICS[0][pbss_network->Configuration.DSConfig]=1; - if(ICS[0][0] == 0) + if (ICS[0][0] == 0) ICS[0][0] = 1; } } @@ -7865,7 +7865,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) for(i= 0;i<8;i++) { - if(ICS[i][0] == 1) + if (ICS[i][0] == 1) { int j, k = 0; @@ -7875,9 +7875,9 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) for(j=1;j<=14;j++) { - if(ICS[i][j]==1) + if (ICS[i][j]==1) { - if(k<16) + if (k<16) { InfoContent[k] = j; /* channel number */ /* SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); */ @@ -7903,21 +7903,21 @@ unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u16 tid; - if((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) + if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) if (!(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)) return _SUCCESS; psta = rtw_get_stainfo(pstapriv, addr); - if(psta==NULL) + if (psta==NULL) return _SUCCESS; /* DBG_871X("%s:%s\n", __FUNCTION__, (initiator==0)?"RX_DIR":"TX_DIR"); */ - if(initiator==0) /* recipient */ + if (initiator==0) /* recipient */ { for(tid = 0;tidrecvreorder_ctrl[tid].enable == true) + if (psta->recvreorder_ctrl[tid].enable == true) { DBG_871X("rx agg disable tid(%d)\n",tid); issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, @@ -7931,12 +7931,12 @@ unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr) } } } - else if(initiator == 1)/* originator */ + else if (initiator == 1)/* originator */ { /* DBG_871X("tx agg_enable_bitmap(0x%08x)\n", psta->htpriv.agg_enable_bitmap); */ for(tid = 0;tidhtpriv.agg_enable_bitmap & BIT(tid)) + if (psta->htpriv.agg_enable_bitmap & BIT(tid)) { DBG_871X("tx agg disable tid(%d)\n",tid); issue_action_BA(padapter, addr, RTW_WLAN_ACTION_DELBA, @@ -7969,13 +7969,13 @@ unsigned int send_beacon(struct adapter *padapter) }while(false == bxmitok && issue<100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); - if(padapter->bSurpriseRemoved || padapter->bDriverStopped) + if (padapter->bSurpriseRemoved || padapter->bDriverStopped) { return _FAIL; } - if(false == bxmitok) + if (false == bxmitok) { DBG_871X("%s fail! %u ms\n", __FUNCTION__, rtw_get_passing_time_ms(start)); return _FAIL; @@ -7984,7 +7984,7 @@ unsigned int send_beacon(struct adapter *padapter) { u32 passing_time = rtw_get_passing_time_ms(start); - if(passing_time > 100 || issue > 3) + if (passing_time > 100 || issue > 3) DBG_871X("%s success, issue:%d, poll:%d, %u ms\n", __FUNCTION__, issue, poll, rtw_get_passing_time_ms(start)); /* else */ /* DBG_871X("%s success, issue:%d, poll:%d, %u ms\n", __FUNCTION__, issue, poll, rtw_get_passing_time_ms(start)); */ @@ -8010,7 +8010,7 @@ bool IsLegal5GChannel( 124,126,128,130,132,134,136,138,140,149,151,153,155,157,159, 161,163,165}; for(i=0;isitesurvey_res.channel_idx == 0) + if (pmlmeext->sitesurvey_res.channel_idx == 0) { #ifdef DBG_FIXED_CHAN - if(pmlmeext->fixed_chan !=0xff) + if (pmlmeext->fixed_chan !=0xff) set_channel_bwmode(padapter, pmlmeext->fixed_chan, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); else #endif @@ -8094,17 +8094,17 @@ void site_survey(struct adapter *padapter) else { #ifdef DBG_FIXED_CHAN - if(pmlmeext->fixed_chan!=0xff) + if (pmlmeext->fixed_chan!=0xff) SelectChannel(padapter, pmlmeext->fixed_chan); else #endif SelectChannel(padapter, survey_channel); } - if(ScanType == SCAN_ACTIVE) /* obey the channel plan setting... */ + if (ScanType == SCAN_ACTIVE) /* obey the channel plan setting... */ { #ifdef CONFIG_P2P - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH) ) { @@ -8117,7 +8117,7 @@ void site_survey(struct adapter *padapter) { int i; for(i=0;isitesurvey_res.ssid[i].SsidLength) { + if (pmlmeext->sitesurvey_res.ssid[i].SsidLength) { /* todo: to issue two probe req??? */ issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL); /* rtw_msleep_os(SURVEY_TO>>1); */ @@ -8125,7 +8125,7 @@ void site_survey(struct adapter *padapter) } } - if(pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) { + if (pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) { /* todo: to issue two probe req??? */ issue_probereq(padapter, NULL, NULL); /* rtw_msleep_os(SURVEY_TO>>1); */ @@ -8137,9 +8137,9 @@ void site_survey(struct adapter *padapter) } else { /* channel number is 0 or this channel is not valid. */ #ifdef CONFIG_P2P - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH)) { - if( ( pwdinfo->rx_invitereq_info.scan_op_ch_only ) || ( pwdinfo->p2p_info.scan_op_ch_only ) ) + if ( ( pwdinfo->rx_invitereq_info.scan_op_ch_only ) || ( pwdinfo->p2p_info.scan_op_ch_only ) ) { /* Set the find_phase_state_exchange_cnt to P2P_FINDPHASE_EX_CNT. */ /* This will let the following flow to run the scanning end. */ @@ -8150,7 +8150,7 @@ void site_survey(struct adapter *padapter) #endif } - if(rtw_p2p_findphase_ex_is_needed(pwdinfo)) + if (rtw_p2p_findphase_ex_is_needed(pwdinfo)) { /* Set the P2P State to the listen state of find phase and set the current channel to the listen channel */ set_channel_bwmode(padapter, pwdinfo->listen_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); @@ -8171,7 +8171,7 @@ void site_survey(struct adapter *padapter) /* 20100721:Interrupt scan operation here. */ /* For SW antenna diversity before link, it needs to switch to another antenna and scan again. */ /* It compares the scan result and select beter one to do connection. */ - if(rtw_hal_antdiv_before_linked(padapter)) + if (rtw_hal_antdiv_before_linked(padapter)) { pmlmeext->sitesurvey_res.bss_cnt = 0; pmlmeext->sitesurvey_res.channel_idx = -1; @@ -8181,7 +8181,7 @@ void site_survey(struct adapter *padapter) } #ifdef CONFIG_P2P - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_SCAN) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH)) rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE); #endif /* CONFIG_P2P */ @@ -8192,16 +8192,16 @@ void site_survey(struct adapter *padapter) /* SelectChannel(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset); */ { - if( pwdinfo->driver_interface == DRIVER_WEXT ) + if ( pwdinfo->driver_interface == DRIVER_WEXT ) { - if( rtw_p2p_chk_state(pwdinfo, P2P_STATE_LISTEN) ) + if ( rtw_p2p_chk_state(pwdinfo, P2P_STATE_LISTEN) ) { set_channel_bwmode(padapter, pwdinfo->listen_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); } else set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); } - else if( pwdinfo->driver_interface == DRIVER_CFG80211 ) + else if ( pwdinfo->driver_interface == DRIVER_CFG80211 ) { set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); } @@ -8267,7 +8267,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str subtype = GetFrameSubType(pframe); - if(subtype==WIFI_BEACON) { + if (subtype==WIFI_BEACON) { bssid->Reserved[0] = 1; ie_offset = _BEACON_IE_OFFSET_; } else { @@ -8390,7 +8390,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str {/* In 5G, some ap do not have DSSET IE */ /* checking HT info for channel */ p = rtw_get_ie(bssid->IEs + ie_offset, _HT_ADD_INFO_IE_, &len, bssid->IELength - ie_offset); - if(p) + if (p) { struct HT_info_element *HT_info = (struct HT_info_element *)(p + 2); bssid->Configuration.DSConfig = HT_info->primary_channel; @@ -8422,7 +8422,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str bssid->Configuration.ATIMWindow = 0; /* 20/40 BSS Coexistence check */ - if((pregistrypriv->wifi_spec==1) && (false == pmlmeinfo->bwmode_updated)) + if ((pregistrypriv->wifi_spec==1) && (false == pmlmeinfo->bwmode_updated)) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; p = rtw_get_ie(bssid->IEs + ie_offset, _HT_CAPABILITY_IE_, &len, bssid->IELength - ie_offset); @@ -8430,7 +8430,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str struct HT_caps_element *pHT_caps; pHT_caps = (struct HT_caps_element *)(p + 2); - if(le16_to_cpu(pHT_caps->u.HT_cap_element.HT_caps_info) & BIT(14)) + if (le16_to_cpu(pHT_caps->u.HT_cap_element.HT_caps_info) & BIT(14)) pmlmepriv->num_FortyMHzIntolerant++; } else { pmlmepriv->num_sta_no_ht++; @@ -8438,7 +8438,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str } #if defined(DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) & 1 - if(strcmp(bssid->Ssid.Ssid, DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) == 0) { + if (strcmp(bssid->Ssid.Ssid, DBG_RX_SIGNAL_DISPLAY_SSID_MONITORED) == 0) { DBG_871X("Receiving %s("MAC_FMT", DSConfig:%u) from ch%u with ss:%3u, sq:%3u, RawRSSI:%3ld\n" , bssid->Ssid.Ssid, MAC_ARG(bssid->MacAddress), bssid->Configuration.DSConfig , rtw_get_oper_ch(padapter) @@ -8448,7 +8448,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str #endif /* mark bss info receving from nearby channel as SignalQuality 101 */ - if(bssid->Configuration.DSConfig != rtw_get_oper_ch(padapter)) + if (bssid->Configuration.DSConfig != rtw_get_oper_ch(padapter)) { bssid->PhyInfo.SignalQuality= 101; } @@ -8473,7 +8473,7 @@ void start_create_ibss(struct adapter* padapter) /* udpate capability */ caps = rtw_get_capability((struct wlan_bssid_ex *)pnetwork); update_capinfo(padapter, caps); - if(caps&cap_IBSS)/* adhoc master */ + if (caps&cap_IBSS)/* adhoc master */ { val8 = 0xcf; rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); @@ -8489,7 +8489,7 @@ void start_create_ibss(struct adapter* padapter) Set_MSR(padapter, (pmlmeinfo->state & 0x3)); /* issue beacon */ - if(send_beacon(padapter)==_FAIL) + if (send_beacon(padapter)==_FAIL) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("issuing beacon frame fail....\n")); @@ -8561,7 +8561,7 @@ void start_clnt_join(struct adapter* padapter) for (pos = get_next(head);!rtw_end_of_queue_search(head, pos); pos = get_next(pos)) { scanned = LIST_CONTAINOR(pos, struct wlan_network, list); - if(scanned==NULL) { + if (scanned==NULL) { spin_unlock_bh(&(padapter->mlmepriv.scanned_queue.lock)); rtw_warn_on(1); return; @@ -8672,7 +8672,7 @@ unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr DBG_871X("%s\n", __FUNCTION__); - if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) + if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) { if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) { @@ -8909,7 +8909,7 @@ static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssid if (chplan_new[i].ScanType == SCAN_PASSIVE) { /* 5G Bnad 2, 3 (DFS) doesn't change to active scan */ - if(channel >= 52 && channel <= 144) + if (channel >= 52 && channel <= 144) break; chplan_new[i].ScanType = SCAN_ACTIVE; @@ -8942,7 +8942,7 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame /* u8 *pframe = precv_frame->u.hdr.rx_data; */ /* uint len = precv_frame->u.hdr.len; */ - if(!padapter) + if (!padapter) return; pmlmeext = &padapter->mlmeextpriv; @@ -9140,7 +9140,7 @@ void report_del_sta_event(struct adapter *padapter, unsigned char* MacAddr, unsi psta = rtw_get_stainfo(&padapter->stapriv, MacAddr); - if(psta) + if (psta) mac_id = (int)psta->mac_id; else mac_id = (-1); @@ -9219,7 +9219,7 @@ void update_sta_info(struct adapter *padapter, struct sta_info *psta) VCS_update(padapter, psta); /* HT */ - if(pmlmepriv->htpriv.ht_option) + if (pmlmepriv->htpriv.ht_option) { psta->htpriv.ht_option = true; @@ -9248,7 +9248,7 @@ void update_sta_info(struct adapter *padapter, struct sta_info *psta) psta->htpriv.candidate_tid_bitmap = 0x0;/* reset */ /* QoS */ - if(pmlmepriv->qospriv.qos_option) + if (pmlmepriv->qospriv.qos_option) psta->qos_option = true; @@ -9268,7 +9268,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress); - if(join_res < 0) + if (join_res < 0) { join_type = 1; rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type)); @@ -9285,11 +9285,11 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) goto exit_mlmeext_joinbss_event_callback; } - if((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) + if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) { /* for bc/mc */ psta_bmc = rtw_get_bcmc_stainfo(padapter); - if(psta_bmc) + if (psta_bmc) { pmlmeinfo->FW_sta_info[psta_bmc->mac_id].psta = psta_bmc; update_bmc_sta_support_rate(padapter, psta_bmc->mac_id); @@ -9340,7 +9340,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) join_type = 2; rtw_hal_set_hwreg(padapter, HW_VAR_MLME_JOIN, (u8 *)(&join_type)); - if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) + if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) { /* correcting TSF */ correct_TSF(padapter, pmlmeext); @@ -9362,9 +9362,9 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *p DBG_871X("%s\n", __FUNCTION__); - if((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) + if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) { - if(pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)/* adhoc master or sta_count>1 */ + if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS)/* adhoc master or sta_count>1 */ { /* nothing to do */ } @@ -9377,7 +9377,7 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *p correct_TSF(padapter, pmlmeext); /* start beacon */ - if(send_beacon(padapter)==_FAIL) + if (send_beacon(padapter)==_FAIL) { pmlmeinfo->FW_sta_info[psta->mac_id].status = 0; @@ -9450,11 +9450,11 @@ static void _linked_rx_signal_strehgth_display(struct adapter *padapter) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u8 mac_id; int UndecoratedSmoothedPWDB; - if((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) + if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) { mac_id=0; } - else if((pmlmeinfo->state&0x03) == _HW_STATE_AP_) + else if ((pmlmeinfo->state&0x03) == _HW_STATE_AP_) { mac_id=2; } @@ -9468,7 +9468,7 @@ static u8 chk_ap_is_alive(struct adapter *padapter, struct sta_info *psta) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - if((sta_rx_data_pkts(psta) == sta_last_rx_data_pkts(psta)) + if ((sta_rx_data_pkts(psta) == sta_last_rx_data_pkts(psta)) && sta_rx_beacon_pkts(psta) == sta_last_rx_beacon_pkts(psta) && sta_rx_probersp_pkts(psta) == sta_last_rx_probersp_pkts(psta) ) @@ -9494,7 +9494,7 @@ void linked_status_chk(struct adapter *padapter) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct sta_priv *pstapriv = &padapter->stapriv; - if(padapter->bRxRSSIDisplay) + if (padapter->bRxRSSIDisplay) _linked_rx_signal_strehgth_display(padapter); rtw_hal_sreset_linked_status_check(padapter); @@ -9544,7 +9544,7 @@ void linked_status_chk(struct adapter *padapter) } /* back to the original operation channel */ - if(backup_oper_channel>0) + if (backup_oper_channel>0) SelectChannel(padapter, backup_oper_channel); } else { if (rx_chk != _SUCCESS) { @@ -9592,12 +9592,12 @@ void linked_status_chk(struct adapter *padapter) { psta = pmlmeinfo->FW_sta_info[i].psta; - if(NULL==psta) continue; + if (NULL==psta) continue; if (pmlmeinfo->FW_sta_info[i].rx_pkt == sta_rx_pkts(psta)) { - if(pmlmeinfo->FW_sta_info[i].retry<3) + if (pmlmeinfo->FW_sta_info[i].retry<3) { pmlmeinfo->FW_sta_info[i].retry++; } @@ -9636,12 +9636,12 @@ void survey_timer_hdl(struct adapter *padapter) /* issue rtw_sitesurvey_cmd */ if (pmlmeext->sitesurvey_res.state > SCAN_START) { - if(pmlmeext->sitesurvey_res.state == SCAN_PROCESS) + if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) pmlmeext->sitesurvey_res.channel_idx++; - if(pmlmeext->scan_abort == true) { + if (pmlmeext->scan_abort == true) { #ifdef CONFIG_P2P - if(!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE)) + if (!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE)) { rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_MAX); pmlmeext->sitesurvey_res.channel_idx = 3; @@ -9741,14 +9741,14 @@ void addba_timer_hdl(struct sta_info *psta) { struct ht_priv *phtpriv; - if(!psta) + if (!psta) return; phtpriv = &psta->htpriv; - if((phtpriv->ht_option==true) && (phtpriv->ampdu_enable==true)) + if ((phtpriv->ht_option==true) && (phtpriv->ampdu_enable==true)) { - if(phtpriv->candidate_tid_bitmap) + if (phtpriv->candidate_tid_bitmap) phtpriv->candidate_tid_bitmap=0x0; } @@ -9787,18 +9787,18 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct setopmode_parm *psetop = (struct setopmode_parm *)pbuf; - if(psetop->mode == Ndis802_11APMode) + if (psetop->mode == Ndis802_11APMode) { pmlmeinfo->state = WIFI_FW_AP_STATE; type = _HW_STATE_AP_; } - else if(psetop->mode == Ndis802_11Infrastructure) + else if (psetop->mode == Ndis802_11Infrastructure) { pmlmeinfo->state &= ~(BIT(0)|BIT(1));/* clear state */ pmlmeinfo->state |= WIFI_FW_STATION_STATE;/* set to STATION_STATE */ type = _HW_STATE_STATION_; } - else if(psetop->mode == Ndis802_11IBSS) + else if (psetop->mode == Ndis802_11IBSS) { type = _HW_STATE_ADHOC_; } @@ -9823,11 +9823,11 @@ u8 createbss_hdl(struct adapter *padapter, u8 *pbuf) /* u32 initialgain; */ - if(pparm->network.InfrastructureMode == Ndis802_11APMode) + if (pparm->network.InfrastructureMode == Ndis802_11APMode) { #ifdef CONFIG_AP_MODE - if(pmlmeinfo->state == WIFI_FW_AP_STATE) + if (pmlmeinfo->state == WIFI_FW_AP_STATE) { /* todo: */ return H2C_SUCCESS; @@ -9836,7 +9836,7 @@ u8 createbss_hdl(struct adapter *padapter, u8 *pbuf) } /* below is for ad-hoc master */ - if(pparm->network.InfrastructureMode == Ndis802_11IBSS) + if (pparm->network.InfrastructureMode == Ndis802_11IBSS) { rtw_joinbss_reset(padapter); @@ -9867,7 +9867,7 @@ u8 createbss_hdl(struct adapter *padapter, u8 *pbuf) memcpy(pnetwork, pbuf, FIELD_OFFSET(struct wlan_bssid_ex, IELength)); pnetwork->IELength = ((struct wlan_bssid_ex *)pbuf)->IELength; - if(pnetwork->IELength>MAX_IE_SZ)/* Check pbuf->IELength */ + if (pnetwork->IELength>MAX_IE_SZ)/* Check pbuf->IELength */ return H2C_PARAMETERS_ERROR; memcpy(pnetwork->IEs, ((struct wlan_bssid_ex *)pbuf)->IEs, pnetwork->IELength); @@ -9933,7 +9933,7 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) memcpy(pnetwork, pbuf, FIELD_OFFSET(struct wlan_bssid_ex, IELength)); pnetwork->IELength = ((struct wlan_bssid_ex *)pbuf)->IELength; - if(pnetwork->IELength>MAX_IE_SZ)/* Check pbuf->IELength */ + if (pnetwork->IELength>MAX_IE_SZ)/* Check pbuf->IELength */ return H2C_PARAMETERS_ERROR; memcpy(pnetwork->IEs, ((struct wlan_bssid_ex *)pbuf)->IEs, pnetwork->IELength); @@ -10000,7 +10000,7 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) } /* check channel, bandwidth, offset and switch */ - if(rtw_chk_start_clnt_join(padapter, &ch, &bw, &offset) == _FAIL) { + if (rtw_chk_start_clnt_join(padapter, &ch, &bw, &offset) == _FAIL) { report_join_res(padapter, (-4)); return H2C_SUCCESS; } @@ -10051,7 +10051,7 @@ u8 disconnect_hdl(struct adapter *padapter, unsigned char *pbuf) /* restore to initial setting. */ update_tx_basic_rate(padapter, padapter->registrypriv.wireless_mode); - if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) + if (((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) { /* Stop BCN */ val8 = 0; @@ -10093,27 +10093,27 @@ static int rtw_scan_ch_decision(struct adapter *padapter, struct rtw_ieee80211_c /* acquire channels from in */ j = 0; for (i=0;ichannel_set, in[i].hw_value)) >=0 ) { memcpy(&out[j], &in[i], sizeof(struct rtw_ieee80211_channel)); - if(pmlmeext->channel_set[set_idx].ScanType == SCAN_PASSIVE) + if (pmlmeext->channel_set[set_idx].ScanType == SCAN_PASSIVE) out[j].flags |= RTW_IEEE80211_CHAN_PASSIVE_SCAN; j++; } - if(j>=out_num) + if (j>=out_num) break; } /* if out is empty, use channel_set as default */ - if(j == 0) { + if (j == 0) { for (i=0;imax_chan_nums;i++) { out[i].hw_value = pmlmeext->channel_set[i].ChannelNum; - if(pmlmeext->channel_set[i].ScanType == SCAN_PASSIVE) + if (pmlmeext->channel_set[i].ScanType == SCAN_PASSIVE) out[i].flags |= RTW_IEEE80211_CHAN_PASSIVE_SCAN; j++; @@ -10161,7 +10161,7 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf) pmlmeext->sitesurvey_res.channel_idx = 0; for(i=0;issid[i].SsidLength) { + if (pparm->ssid[i].SsidLength) { memcpy(pmlmeext->sitesurvey_res.ssid[i].Ssid, pparm->ssid[i].Ssid, IW_ESSID_MAX_SIZE); pmlmeext->sitesurvey_res.ssid[i].SsidLength= pparm->ssid[i].SsidLength; } else { @@ -10190,7 +10190,7 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf) bdelayscan = true; } - if(bdelayscan) + if (bdelayscan) { /* delay 50ms to protect nulldata(1). */ set_survey_timer(pmlmeext, 50); @@ -10206,7 +10206,7 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf) /* config the initial gain under scaning, need to write the BB registers */ #ifdef CONFIG_P2P - if((wdev_to_priv(padapter->rtw_wdev))->p2p_enabled == true && pwdinfo->driver_interface == DRIVER_CFG80211 ) + if ((wdev_to_priv(padapter->rtw_wdev))->p2p_enabled == true && pwdinfo->driver_interface == DRIVER_CFG80211 ) initialgain = 0x30; else if ( !rtw_p2p_chk_state( pwdinfo, P2P_STATE_NONE ) ) @@ -10255,7 +10255,7 @@ u8 setkey_hdl(struct adapter *padapter, u8 *pbuf) unsigned char null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; /* main tx key for wep. */ - if(pparm->set_tx) + if (pparm->set_tx) pmlmeinfo->key_index = pparm->keyid; /* write cam */ @@ -10296,26 +10296,26 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) DBG_871X_LEVEL(_drv_always_, "set pairwise key to hw: alg:%d(WEP40-1 WEP104-5 TKIP-2 AES-4) camid:%d\n", pparm->algorithm, cam_id); - if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) + if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; - if(pparm->algorithm == _NO_PRIVACY_) /* clear cam entry */ + if (pparm->algorithm == _NO_PRIVACY_) /* clear cam entry */ { clear_cam_entry(padapter, pparm->id); return H2C_SUCCESS_RSP; } psta = rtw_get_stainfo(pstapriv, pparm->addr); - if(psta) + if (psta) { ctrl = (BIT(15) | ((pparm->algorithm) << 2)); DBG_871X("r871x_set_stakey_hdl(): enc_algorithm=%d\n", pparm->algorithm); - if((psta->mac_id<1) || (psta->mac_id>(NUM_STA-4))) + if ((psta->mac_id<1) || (psta->mac_id>(NUM_STA-4))) { DBG_871X("r871x_set_stakey_hdl():set_stakey failed, mac_id(aid)=%d\n", psta->mac_id); return H2C_REJECTED; @@ -10342,7 +10342,7 @@ u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf) /* below for sta mode */ - if(pparm->algorithm == _NO_PRIVACY_) /* clear cam entry */ + if (pparm->algorithm == _NO_PRIVACY_) /* clear cam entry */ { clear_cam_entry(padapter, pparm->id); return H2C_SUCCESS; @@ -10365,7 +10365,7 @@ u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf) struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, pparm->addr); - if(!psta) + if (!psta) return H2C_SUCCESS; if (((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && (pmlmeinfo->HT_enable)) || @@ -10479,7 +10479,7 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf) peventbuf += 2; - if(peventbuf) { + if (peventbuf) { event_callback = wlanevents[evt_code].event_callback; event_callback(padapter, (u8*)peventbuf); @@ -10492,7 +10492,7 @@ _abort_event_: u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf) { - if(!pbuf) + if (!pbuf) return H2C_PARAMETERS_ERROR; return H2C_SUCCESS; @@ -10500,7 +10500,7 @@ u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf) u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) { - if(send_beacon(padapter)==_FAIL) + if (send_beacon(padapter)==_FAIL) { DBG_871X("issue_beacon, fail!\n"); return H2C_PARAMETERS_ERROR; @@ -10517,10 +10517,10 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) /* for BC/MC Frames */ psta_bmc = rtw_get_bcmc_stainfo(padapter); - if(!psta_bmc) + if (!psta_bmc) return H2C_SUCCESS; - if((pstapriv->tim_bitmap&BIT(0)) && (psta_bmc->sleepq_len>0)) + if ((pstapriv->tim_bitmap&BIT(0)) && (psta_bmc->sleepq_len>0)) { rtw_msleep_os(10);/* 10ms, ATIM(HIQ) Windows */ spin_lock_bh(&pxmitpriv->lock); @@ -10537,7 +10537,7 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf) rtw_list_delete(&pxmitframe->list); psta_bmc->sleepq_len--; - if(psta_bmc->sleepq_len>0) + if (psta_bmc->sleepq_len>0) pxmitframe->attrib.mdata = 1; else pxmitframe->attrib.mdata = 0; @@ -10646,7 +10646,7 @@ u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - if(!pbuf) + if (!pbuf) return H2C_PARAMETERS_ERROR; set_ch_parm = (struct set_ch_parm *)pbuf; @@ -10670,7 +10670,7 @@ u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - if(!pbuf) + if (!pbuf) return H2C_PARAMETERS_ERROR; setChannelPlan_param = (struct SetChannelPlan_param *)pbuf; @@ -10685,7 +10685,7 @@ u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf) { struct LedBlink_param *ledBlink_param; - if(!pbuf) + if (!pbuf) return H2C_PARAMETERS_ERROR; ledBlink_param = (struct LedBlink_param *)pbuf; @@ -10702,7 +10702,7 @@ u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf) u8 new_ch_no; u8 gval8 = 0x00, sval8 = 0xff; - if(!pbuf) + if (!pbuf) return H2C_PARAMETERS_ERROR; setChannelSwitch_param = (struct SetChannelSwitch_param *)pbuf; diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index 62d6f6d..577dd80 100644 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -75,7 +75,7 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) plist = get_next(plist); - if(psta->is_p2p_device) + if (psta->is_p2p_device) { tmplen = 0; @@ -105,7 +105,7 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) memcpy(pcur, psta->secdev_types_list, psta->num_of_secdev_type*8); pcur += psta->num_of_secdev_type*8; - if(psta->dev_name_len>0) + if (psta->dev_name_len>0) { /* u16*)(pcur) = cpu_to_be16( WPS_ATTR_DEVICE_NAME ); */ RTW_PUT_BE16(pcur, WPS_ATTR_DEVICE_NAME); @@ -135,7 +135,7 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf) } spin_unlock_bh(&pstapriv->asoc_list_lock); - if(attr_len>0) + if (attr_len>0) { len = rtw_set_p2p_attr_content(pbuf, P2P_ATTR_GROUP_INFO, attr_len, pdata_attr); } @@ -489,7 +489,7 @@ u32 build_beacon_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) /* Group Capability Bitmap, 1 byte */ capability = P2P_DEVCAP_INVITATION_PROC|P2P_DEVCAP_CLIENT_DISCOVERABILITY; capability |= ((P2P_GRPCAP_GO | P2P_GRPCAP_INTRABSS) << 8); - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) capability |= (P2P_GRPCAP_GROUP_FORMATION<<8); le_tmp = cpu_to_le16(capability); @@ -885,7 +885,7 @@ u32 build_probe_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 tunnel wfdie[ wfdielen++ ] = 0; wfdie[ wfdielen++ ] = 0; - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { /* WFD Session Information ATTR */ /* Type: */ @@ -915,7 +915,7 @@ u32 build_assoc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) struct wifi_display_info *pwfd_info = NULL; /* WFD OUI */ - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) { return 0; } @@ -1867,11 +1867,11 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) p2pie[ p2pielen++ ] = DMP_P2P_DEVCAP_SUPPORT; /* Group Capability Bitmap, 1 byte */ - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { p2pie[ p2pielen ] = (P2P_GRPCAP_GO | P2P_GRPCAP_INTRABSS); - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) p2pie[ p2pielen ] |= P2P_GRPCAP_GROUP_FORMATION; p2pielen++; @@ -1910,7 +1910,7 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) /* Type: */ /* Length: */ /* Value: */ - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { /* go_add_noa_attr(pwdinfo); */ } @@ -1972,7 +1972,7 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) /* Type: */ /* Length: */ /* Value: */ - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { p2pielen += go_add_group_info_attr(pwdinfo, p2pie + p2pielen); } @@ -2211,9 +2211,9 @@ u32 process_probe_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_); ssid_len &= 0xff; /* Just last 1 byte is valid for ssid len of the probe request */ - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE) || rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE) || rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { - if((p2pie=rtw_get_p2p_ie( pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_ , len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_ , NULL, &p2pielen))) + if ((p2pie=rtw_get_p2p_ie( pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_ , len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_ , NULL, &p2pielen))) { if ( (p != NULL) && _rtw_memcmp( ( void * ) ( p+2 ), ( void * ) pwdinfo->p2p_wildcard_ssid , 7 )) { @@ -2254,7 +2254,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l __le16 le_tmp; __be16 be_tmp; - if(!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) return P2P_STATUS_FAIL_REQUEST_UNABLE; frame_type = GetFrameSubType(pframe); @@ -2285,7 +2285,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l while ( p2p_ie ) { /* Check P2P Capability ATTR */ - if( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*) &attr_contentlen) ) + if ( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*) &attr_contentlen) ) { DBG_8192C( "[%s] Got P2P Capability Attr!!\n", __FUNCTION__ ); cap_attr = le16_to_cpu(le_tmp); @@ -2296,11 +2296,11 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l /* Check P2P Device Info ATTR */ - if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, NULL, (uint*)&attr_contentlen)) + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, NULL, (uint*)&attr_contentlen)) { DBG_8192C( "[%s] Got P2P DEVICE INFO Attr!!\n", __FUNCTION__ ); pattr_content = pbuf = rtw_zmalloc(attr_contentlen); - if(pattr_content) { + if (pattr_content) { u8 num_of_secdev_type; u16 dev_name_len; @@ -2322,7 +2322,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l num_of_secdev_type = *pattr_content; pattr_content += 1; - if(num_of_secdev_type==0) + if (num_of_secdev_type==0) { psta->num_of_secdev_type = 0; } @@ -2342,7 +2342,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l /* dev_name_len = attr_contentlen - ETH_ALEN - 2 - 8 - 1 - (num_of_secdev_type*8); */ psta->dev_name_len=0; - if(WPS_ATTR_DEVICE_NAME == be16_to_cpu(*(__be16*)pattr_content)) + if (WPS_ATTR_DEVICE_NAME == be16_to_cpu(*(__be16*)pattr_content)) { dev_name_len = be16_to_cpu(*(__be16*)(pattr_content+2)); @@ -2387,13 +2387,13 @@ u32 process_p2p_devdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint le u8 dev_addr[ETH_ALEN] = { 0x00 }; u32 attr_contentlen = 0; - if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GROUP_ID, groupid, &attr_contentlen)) + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GROUP_ID, groupid, &attr_contentlen)) { - if(_rtw_memcmp(pwdinfo->device_addr, groupid, ETH_ALEN) && + if (_rtw_memcmp(pwdinfo->device_addr, groupid, ETH_ALEN) && _rtw_memcmp(pwdinfo->p2p_group_ssid, groupid+ETH_ALEN, pwdinfo->p2p_group_ssid_len)) { attr_contentlen=0; - if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_ID, dev_addr, &attr_contentlen)) + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_ID, dev_addr, &attr_contentlen)) { unsigned long irqL; struct list_head *phead, *plist; @@ -2409,7 +2409,7 @@ u32 process_p2p_devdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint le plist = get_next(plist); - if(psta->is_p2p_device && (psta->dev_cap&P2P_DEVCAP_CLIENT_DISCOVERABILITY) && + if (psta->is_p2p_device && (psta->dev_cap&P2P_DEVCAP_CLIENT_DISCOVERABILITY) && _rtw_memcmp(psta->dev_addr, dev_addr, ETH_ALEN)) { @@ -2561,7 +2561,7 @@ static u8 rtw_p2p_ch_inclusion(struct mlme_ext_priv *pmlmeext, u8 *peer_ch_list, { for( j = temp; j < pmlmeext->max_chan_nums; j++ ) { - if( *( peer_ch_list + i ) == pmlmeext->channel_set[ j ].ChannelNum ) + if ( *( peer_ch_list + i ) == pmlmeext->channel_set[ j ].ChannelNum ) { ch_list_inclusioned[ ch_no++ ] = *( peer_ch_list + i ); temp = j; @@ -2595,7 +2595,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe /* Commented by Kurt 20120113 */ /* If some device wants to do p2p handshake without sending prov_disc_req */ /* We have to get peer_req_cm from here. */ - if(_rtw_memcmp( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "000", 3) ) + if (_rtw_memcmp( pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "000", 3) ) { rtw_get_wps_attr_content( wpsie, wps_ielen, WPS_ATTR_DEVICE_PWID, (u8*) &be_tmp, &wps_devicepassword_id_len); wps_devicepassword_id = be16_to_cpu(be_tmp); @@ -2657,7 +2657,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_ING); /* Check P2P Capability ATTR */ - if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*)&attr_contentlen) ) + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*)&attr_contentlen) ) cap_attr = le16_to_cpu(le_tmp); if ( rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GO_INTENT , &attr_content, &attr_contentlen) ) @@ -2694,7 +2694,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe rtw_p2p_set_role(pwdinfo, P2P_ROLE_CLIENT); } - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { /* Store the group id information. */ memcpy( pwdinfo->groupid_info.go_device_addr, pwdinfo->device_addr, ETH_ALEN ); @@ -2717,7 +2717,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe peer_ch_num = rtw_p2p_get_peer_ch_list(pwdinfo, ch_content, ch_cnt, peer_ch_list); ch_num_inclusioned = rtw_p2p_ch_inclusion(&padapter->mlmeextpriv, peer_ch_list, peer_ch_num, ch_list_inclusioned); - if( ch_num_inclusioned == 0) + if ( ch_num_inclusioned == 0) { DBG_871X( "[%s] No common channel in channel list!\n", __FUNCTION__ ); result = P2P_STATUS_FAIL_NO_COMMON_CH; @@ -2725,7 +2725,7 @@ u8 process_p2p_group_negotation_req( struct wifidirect_info *pwdinfo, u8 *pframe break; } - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { if ( !rtw_p2p_is_channel_list_ok( pwdinfo->operating_channel, ch_list_inclusioned, ch_num_inclusioned) ) @@ -2840,7 +2840,7 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram { /* Check P2P Capability ATTR */ - if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*)&attr_contentlen) ) + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*)&attr_contentlen) ) cap_attr = le16_to_cpu(le_tmp); rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_STATUS, &attr_content, &attr_contentlen); @@ -2917,7 +2917,7 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram rtw_p2p_set_role(pwdinfo, P2P_ROLE_CLIENT); } - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { /* Store the group id information. */ memcpy( pwdinfo->groupid_info.go_device_addr, pwdinfo->device_addr, ETH_ALEN ); @@ -2943,7 +2943,7 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram peer_ch_num = rtw_p2p_get_peer_ch_list(pwdinfo, pwdinfo->channel_list_attr, pwdinfo->channel_list_attr_len, peer_ch_list); ch_num_inclusioned = rtw_p2p_ch_inclusion(&padapter->mlmeextpriv, peer_ch_list, peer_ch_num, ch_list_inclusioned); - if( ch_num_inclusioned == 0) + if ( ch_num_inclusioned == 0) { DBG_871X( "[%s] No common channel in channel list!\n", __FUNCTION__ ); result = P2P_STATUS_FAIL_NO_COMMON_CH; @@ -2951,7 +2951,7 @@ u8 process_p2p_group_negotation_resp( struct wifidirect_info *pwdinfo, u8 *pfram break; } - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { if ( !rtw_p2p_is_channel_list_ok( pwdinfo->operating_channel, ch_list_inclusioned, ch_num_inclusioned) ) @@ -3161,14 +3161,14 @@ static void restore_p2p_state_handler( struct adapter* padapter ) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING) || rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_FAIL)) { rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE); } rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE)) { /* In the P2P client mode, the driver should not switch back to its listen channel */ /* because this P2P client should stay at the operating channel of P2P GO. */ @@ -3274,7 +3274,7 @@ static void rtw_change_p2pie_op_ch(struct adapter *padapter, const u8 *frame_bod /* Check P2P_ATTR_OPERATING_CH */ attr_contentlen = 0; pattr = NULL; - if((pattr = rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, NULL, (uint*)&attr_contentlen))!=NULL) + if ((pattr = rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_OPERATING_CH, NULL, (uint*)&attr_contentlen))!=NULL) { *(pattr+4) = ch; } @@ -3351,7 +3351,7 @@ void rtw_append_wfd_ie(struct adapter *padapter, u8 *buf, u32* len) frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr)); category = frame_body[0]; - if(category == RTW_WLAN_CATEGORY_PUBLIC) + if (category == RTW_WLAN_CATEGORY_PUBLIC) { action = frame_body[1]; if (action == ACT_PUBLIC_VENDOR @@ -3417,7 +3417,7 @@ void rtw_append_wfd_ie(struct adapter *padapter, u8 *buf, u32* len) } } - else if(category == RTW_WLAN_CATEGORY_P2P) + else if (category == RTW_WLAN_CATEGORY_P2P) { OUI_Subtype = frame_body[5]; dialogToken = frame_body[6]; @@ -3537,7 +3537,7 @@ int rtw_p2p_check_frames(struct adapter *padapter, const u8 *buf, u32 len, u8 tx frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr)); category = frame_body[0]; /* just for check */ - if(category == RTW_WLAN_CATEGORY_PUBLIC) + if (category == RTW_WLAN_CATEGORY_PUBLIC) { action = frame_body[1]; if (action == ACT_PUBLIC_VENDOR @@ -3567,7 +3567,7 @@ int rtw_p2p_check_frames(struct adapter *padapter, const u8 *buf, u32 len, u8 tx if (tx) { #ifdef CONFIG_DRV_ISSUE_PROV_REQ /* IOT FOR S2 */ - if(pwdev_priv->provdisc_req_issued == false) + if (pwdev_priv->provdisc_req_issued == false) rtw_cfg80211_issue_p2p_provision_request(padapter, buf, len); #endif /* CONFIG_DRV_ISSUE_PROV_REQ */ } @@ -3690,7 +3690,7 @@ int rtw_p2p_check_frames(struct adapter *padapter, const u8 *buf, u32 len, u8 tx if ((cont = rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_STATUS, NULL, &cont_len))) { #ifdef CONFIG_P2P_INVITE_IOT - if(tx && *cont==7) + if (tx && *cont==7) { DBG_871X("TX_P2P_INVITE_RESP, status is no common channel, change to unknown group\n"); *cont = 8; /* unknow group status */ @@ -3735,14 +3735,14 @@ int rtw_p2p_check_frames(struct adapter *padapter, const u8 *buf, u32 len, u8 tx DBG_871X("RTW_%s:P2P_PROVISION_DISC_REQ, dialogToken=%d\n", (tx==true)?"Tx":"Rx", dialogToken); - /* if(tx) */ + /* if (tx) */ { pwdev_priv->provdisc_req_issued = false; - if( (p2p_ie=rtw_get_p2p_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &p2p_ielen))) + if ( (p2p_ie=rtw_get_p2p_ie( frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &p2p_ielen))) { - if(rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_GROUP_ID, NULL, &contentlen)) + if (rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_GROUP_ID, NULL, &contentlen)) { pwdev_priv->provdisc_req_issued = false;/* case: p2p_client join p2p GO */ } @@ -3769,7 +3769,7 @@ int rtw_p2p_check_frames(struct adapter *padapter, const u8 *buf, u32 len, u8 tx } } - else if(category == RTW_WLAN_CATEGORY_P2P) + else if (category == RTW_WLAN_CATEGORY_P2P) { OUI_Subtype = frame_body[5]; dialogToken = frame_body[6]; @@ -3868,11 +3868,11 @@ void process_p2p_ps_ie(struct adapter *padapter, u8 *IEs, u32 IELength) u8 noa_offset, noa_num, noa_index; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { return; } - if(IELength <= _BEACON_IE_OFFSET_) + if (IELength <= _BEACON_IE_OFFSET_) return; ies = IEs + _BEACON_IE_OFFSET_; @@ -3884,12 +3884,12 @@ void process_p2p_ps_ie(struct adapter *padapter, u8 *IEs, u32 IELength) { find_p2p = true; /* Get Notice of Absence IE. */ - if(rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_NOA, noa_attr, &attr_contentlen)) + if (rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_NOA, noa_attr, &attr_contentlen)) { find_p2p_ps = true; noa_index = noa_attr[0]; - if( (pwdinfo->p2p_ps_mode == P2P_PS_NONE) || + if ( (pwdinfo->p2p_ps_mode == P2P_PS_NONE) || (noa_index != pwdinfo->noa_index) )/* if index change, driver should reconfigure related setting. */ { pwdinfo->noa_index = noa_index; @@ -3899,7 +3899,7 @@ void process_p2p_ps_ie(struct adapter *padapter, u8 *IEs, u32 IELength) noa_offset = 2; noa_num = 0; /* NoA length should be n*(13) + 2 */ - if(attr_contentlen > 2) + if (attr_contentlen > 2) { while(noa_offset < attr_contentlen) { @@ -3921,21 +3921,21 @@ void process_p2p_ps_ie(struct adapter *padapter, u8 *IEs, u32 IELength) } pwdinfo->noa_num = noa_num; - if( pwdinfo->opp_ps == 1 ) + if ( pwdinfo->opp_ps == 1 ) { pwdinfo->p2p_ps_mode = P2P_PS_CTWINDOW; /* driver should wait LPS for entering CTWindow */ - if(adapter_to_pwrctl(padapter)->bFwCurrentInPSMode == true) + if (adapter_to_pwrctl(padapter)->bFwCurrentInPSMode == true) { p2p_ps_wk_cmd(padapter, P2P_PS_ENABLE, 1); } } - else if( pwdinfo->noa_num > 0 ) + else if ( pwdinfo->noa_num > 0 ) { pwdinfo->p2p_ps_mode = P2P_PS_NOA; p2p_ps_wk_cmd(padapter, P2P_PS_ENABLE, 1); } - else if( pwdinfo->p2p_ps_mode > P2P_PS_NONE) + else if ( pwdinfo->p2p_ps_mode > P2P_PS_NONE) { p2p_ps_wk_cmd(padapter, P2P_PS_DISABLE, 1); } @@ -3949,9 +3949,9 @@ void process_p2p_ps_ie(struct adapter *padapter, u8 *IEs, u32 IELength) } - if(find_p2p == true) + if (find_p2p == true) { - if( (pwdinfo->p2p_ps_mode > P2P_PS_NONE) && (find_p2p_ps == false) ) + if ( (pwdinfo->p2p_ps_mode > P2P_PS_NONE) && (find_p2p_ps == false) ) { p2p_ps_wk_cmd(padapter, P2P_PS_DISABLE, 1); } @@ -3978,9 +3978,9 @@ void p2p_ps_wk_hdl(struct adapter *padapter, u8 p2p_ps_state) pwdinfo->opp_ps = 0; pwdinfo->noa_num = 0; pwdinfo->p2p_ps_mode = P2P_PS_NONE; - if(pwrpriv->bFwCurrentInPSMode == true) + if (pwrpriv->bFwCurrentInPSMode == true) { - if(pwrpriv->smart_ps == 0) + if (pwrpriv->smart_ps == 0) { pwrpriv->smart_ps = 2; rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&(pwrpriv->pwr_mode))); @@ -3991,9 +3991,9 @@ void p2p_ps_wk_hdl(struct adapter *padapter, u8 p2p_ps_state) if (pwdinfo->p2p_ps_mode > P2P_PS_NONE) { pwdinfo->p2p_ps_state = p2p_ps_state; - if( pwdinfo->ctwindow > 0 ) + if ( pwdinfo->ctwindow > 0 ) { - if(pwrpriv->smart_ps != 0) + if (pwrpriv->smart_ps != 0) { pwrpriv->smart_ps = 0; DBG_871X("%s(): Enter CTW, change SmartPS\n", __FUNCTION__); @@ -4029,16 +4029,16 @@ u8 p2p_ps_wk_cmd(struct adapter*padapter, u8 p2p_ps_state, u8 enqueue) if ( rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return res; - if(enqueue) + if (enqueue) { ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(ph2c==NULL){ + if (ph2c==NULL){ res= _FAIL; goto exit; } pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if(pdrvextra_cmd_parm==NULL){ + if (pdrvextra_cmd_parm==NULL){ rtw_mfree((unsigned char *)ph2c, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -4068,7 +4068,7 @@ static void reset_ch_sitesurvey_timer_process (void *FunctionContext) struct adapter *adapter = (struct adapter *)FunctionContext; struct wifidirect_info *pwdinfo = &adapter->wdinfo; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; DBG_871X( "[%s] In\n", __FUNCTION__ ); @@ -4087,7 +4087,7 @@ static void reset_ch_sitesurvey_timer_process2 (void *FunctionContext) struct adapter *adapter = (struct adapter *)FunctionContext; struct wifidirect_info *pwdinfo = &adapter->wdinfo; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; DBG_871X( "[%s] In\n", __FUNCTION__ ); @@ -4106,7 +4106,7 @@ static void restore_p2p_state_timer_process (void *FunctionContext) struct adapter *adapter = (struct adapter *)FunctionContext; struct wifidirect_info *pwdinfo = &adapter->wdinfo; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; p2p_protocol_wk_cmd( adapter, P2P_RESTORE_STATE_WK ); @@ -4120,13 +4120,13 @@ static void pre_tx_scan_timer_process (void *FunctionContext) struct mlme_priv *pmlmepriv = &adapter->mlmepriv; u8 _status = 0; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; spin_lock_bh(&pmlmepriv->lock); - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ)) { if ( true == pwdinfo->tx_prov_disc_info.benable ) /* the provision discovery request frame is trigger to send or not */ { @@ -4162,7 +4162,7 @@ static void find_phase_timer_process (void *FunctionContext) struct adapter *adapter = (struct adapter *)FunctionContext; struct wifidirect_info *pwdinfo = &adapter->wdinfo; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; adapter->wdinfo.find_phase_state_exchange_cnt++; @@ -4432,7 +4432,7 @@ const char * rtw_p2p_state_txt(enum P2P_STATE state) void dbg_rtw_p2p_set_state(struct wifidirect_info *wdinfo, enum P2P_STATE state, const char *caller, int line) { - if(!_rtw_p2p_chk_state(wdinfo, state)) { + if (!_rtw_p2p_chk_state(wdinfo, state)) { enum P2P_STATE old_state = _rtw_p2p_state(wdinfo); _rtw_p2p_set_state(wdinfo, state); DBG_871X("[CONFIG_DBG_P2P]%s:%d set_state from %s to %s\n", caller, line @@ -4446,7 +4446,7 @@ void dbg_rtw_p2p_set_state(struct wifidirect_info *wdinfo, enum P2P_STATE state, } void dbg_rtw_p2p_set_pre_state(struct wifidirect_info *wdinfo, enum P2P_STATE state, const char *caller, int line) { - if(_rtw_p2p_pre_state(wdinfo) != state) { + if (_rtw_p2p_pre_state(wdinfo) != state) { enum P2P_STATE old_state = _rtw_p2p_pre_state(wdinfo); _rtw_p2p_set_pre_state(wdinfo, state); DBG_871X("[CONFIG_DBG_P2P]%s:%d set_pre_state from %s to %s\n", caller, line @@ -4461,7 +4461,7 @@ void dbg_rtw_p2p_set_pre_state(struct wifidirect_info *wdinfo, enum P2P_STATE st void dbg_rtw_p2p_set_role(struct wifidirect_info *wdinfo, enum P2P_ROLE role, const char *caller, int line) { - if(wdinfo->role != role) { + if (wdinfo->role != role) { enum P2P_ROLE old_role = wdinfo->role; _rtw_p2p_set_role(wdinfo, role); DBG_871X("[CONFIG_DBG_P2P]%s:%d set_role from %s to %s\n", caller, line @@ -4508,7 +4508,7 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role) } else if (role == P2P_ROLE_DISABLE) { - if( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) + if ( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) wdev_to_priv(padapter->rtw_wdev)->p2p_enabled = false; if (_FAIL == rtw_pwr_wakeup(padapter)) { @@ -4517,7 +4517,7 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role) } /* Disable P2P function */ - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { _cancel_timer_ex( &pwdinfo->find_phase_timer ); _cancel_timer_ex( &pwdinfo->restore_p2p_state_timer ); diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index a30509a..a6faf03 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -49,12 +49,12 @@ void _ips_enter(struct adapter * padapter) #ifdef CONFIG_BT_COEXIST BTDM_TurnOffBtCoexistBeforeEnterIPS(padapter); #endif - if(rf_off == pwrpriv->change_rfpwrstate ) + if (rf_off == pwrpriv->change_rfpwrstate ) { pwrpriv->bpower_saving = true; DBG_871X_LEVEL(_drv_always_, "nolinked power save enter\n"); - if(pwrpriv->ips_mode == IPS_LEVEL_2) + if (pwrpriv->ips_mode == IPS_LEVEL_2) pwrpriv->bkeepfwalive = true; rtw_ips_pwr_down(padapter); @@ -78,7 +78,7 @@ int _ips_leave(struct adapter * padapter) struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); int result = _SUCCESS; - if((pwrpriv->rf_pwrstate == rf_off) &&(!pwrpriv->bips_processing)) + if ((pwrpriv->rf_pwrstate == rf_off) &&(!pwrpriv->bips_processing)) { pwrpriv->bips_processing = true; pwrpriv->change_rfpwrstate = rf_on; @@ -175,7 +175,7 @@ static bool rtw_pwr_unassociated_idle(struct adapter *adapter) #endif #ifdef CONFIG_INTEL_PROXIM - if(adapter->proximity.proxim_on==true){ + if (adapter->proximity.proxim_on==true){ return; } #endif @@ -205,25 +205,25 @@ void rtw_ps_processor(struct adapter*padapter) pwrpriv->ps_processing = true; - if(pwrpriv->bips_processing == true) + if (pwrpriv->bips_processing == true) goto exit; /* DBG_871X("==> fw report state(0x%x)\n",rtw_read8(padapter,0x1ca)); */ - if(pwrpriv->bHWPwrPindetect) + if (pwrpriv->bHWPwrPindetect) { #ifdef CONFIG_AUTOSUSPEND - if(padapter->registrypriv.usbss_enable) + if (padapter->registrypriv.usbss_enable) { - if(pwrpriv->rf_pwrstate == rf_on) + if (pwrpriv->rf_pwrstate == rf_on) { - if(padapter->net_closed == true) + if (padapter->net_closed == true) pwrpriv->ps_flag = true; rfpwrstate = RfOnOffDetect(padapter); DBG_871X("@@@@- #1 %s==> rfstate:%s\n",__FUNCTION__,(rfpwrstate==rf_on)?"rf_on":"rf_off"); - if(rfpwrstate!= pwrpriv->rf_pwrstate) + if (rfpwrstate!= pwrpriv->rf_pwrstate) { - if(rfpwrstate == rf_off) + if (rfpwrstate == rf_off) { pwrpriv->change_rfpwrstate = rf_off; @@ -241,9 +241,9 @@ void rtw_ps_processor(struct adapter*padapter) rfpwrstate = RfOnOffDetect(padapter); DBG_871X("@@@@- #2 %s==> rfstate:%s\n",__FUNCTION__,(rfpwrstate==rf_on)?"rf_on":"rf_off"); - if(rfpwrstate!= pwrpriv->rf_pwrstate) + if (rfpwrstate!= pwrpriv->rf_pwrstate) { - if(rfpwrstate == rf_off) + if (rfpwrstate == rf_off) { pwrpriv->change_rfpwrstate = rf_off; pwrpriv->brfoffbyhw = true; @@ -267,7 +267,7 @@ void rtw_ps_processor(struct adapter*padapter) if (rtw_pwr_unassociated_idle(padapter) == false) goto exit; - if((pwrpriv->rf_pwrstate == rf_on) && ((pwrpriv->pwr_state_check_cnts%4)==0)) + if ((pwrpriv->rf_pwrstate == rf_on) && ((pwrpriv->pwr_state_check_cnts%4)==0)) { DBG_871X("==>%s .fw_state(%x)\n",__FUNCTION__,get_fwstate(pmlmepriv)); #if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) @@ -275,12 +275,12 @@ void rtw_ps_processor(struct adapter*padapter) pwrpriv->change_rfpwrstate = rf_off; #endif #ifdef CONFIG_AUTOSUSPEND - if(padapter->registrypriv.usbss_enable) + if (padapter->registrypriv.usbss_enable) { - if(pwrpriv->bHWPwrPindetect) + if (pwrpriv->bHWPwrPindetect) pwrpriv->bkeepfwalive = true; - if(padapter->net_closed == true) + if (padapter->net_closed == true) pwrpriv->ps_flag = true; #if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) @@ -297,7 +297,7 @@ void rtw_ps_processor(struct adapter*padapter) autosuspend_enter(padapter); #endif /* if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) */ } - else if(pwrpriv->bHWPwrPindetect) + else if (pwrpriv->bHWPwrPindetect) { } else @@ -433,13 +433,13 @@ u8 PS_RDY_CHECK(struct adapter * padapter) struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - if(true == pwrpriv->bInSuspend ) + if (true == pwrpriv->bInSuspend ) return false; curr_time = rtw_get_current_time(); delta_time = curr_time -pwrpriv->DelayLPSLastTimeStamp; - if(delta_time < LPS_DELAY_TIME) + if (delta_time < LPS_DELAY_TIME) { return false; } @@ -452,7 +452,7 @@ u8 PS_RDY_CHECK(struct adapter * padapter) (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) ) return false; - if( (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) && (padapter->securitypriv.binstallGrpkey == false) ) + if ( (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) && (padapter->securitypriv.binstallGrpkey == false) ) { DBG_871X("Group handshake still in progress !!!\n"); return false; @@ -474,7 +474,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a ("%s: PowerMode=%d Smart_PS=%d\n", __FUNCTION__, ps_mode, smart_ps)); - if(ps_mode > PM_Card_Disable) { + if (ps_mode > PM_Card_Disable) { RT_TRACE(_module_rtl871x_pwrctrl_c_,_drv_err_,("ps_mode:%d error\n", ps_mode)); return; } @@ -490,11 +490,11 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a } } - /* if(pwrpriv->pwr_mode == PS_MODE_ACTIVE) */ - if(ps_mode == PS_MODE_ACTIVE) + /* if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) */ + if (ps_mode == PS_MODE_ACTIVE) { #ifdef CONFIG_P2P - if(pwdinfo->opp_ps == 0) + if (pwdinfo->opp_ps == 0) #endif /* CONFIG_P2P */ { DBG_871X("rtw_set_ps_mode: Leave 802.11 power save\n"); @@ -521,7 +521,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a #ifdef CONFIG_P2P /* Set CTWindow after LPS */ - if(pwdinfo->opp_ps == 1) + if (pwdinfo->opp_ps == 1) p2p_ps_wk_cmd(padapter, P2P_PS_ENABLE, 0); #endif /* CONFIG_P2P */ @@ -584,9 +584,9 @@ void LPS_Enter(struct adapter *padapter) if (pwrpriv->bLeisurePs) { /* Idle for a while if we connect to AP a while ago. */ - if(pwrpriv->LpsIdleCount >= 2) /* 4 Sec */ + if (pwrpriv->LpsIdleCount >= 2) /* 4 Sec */ { - if(pwrpriv->pwr_mode == PS_MODE_ACTIVE) + if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) { pwrpriv->bpower_saving = true; DBG_871X("%s smart_ps:%d\n", __func__, pwrpriv->smart_ps); @@ -612,10 +612,10 @@ void LPS_Leave(struct adapter *padapter) u8 bAwake = false; if (pwrpriv->bLeisurePs) { - if(pwrpriv->pwr_mode != PS_MODE_ACTIVE) { + if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) { rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0x40); - if(pwrpriv->pwr_mode == PS_MODE_ACTIVE) + if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) LPS_RF_ON_check(padapter, LPS_LEAVE_TIMEOUT_MS); } } @@ -643,10 +643,10 @@ void LeaveAllPowerSaveMode(struct adapter *Adapter) rtw_lps_ctrl_wk_cmd(Adapter, LPS_CTRL_LEAVE, enqueue); } else { - if(adapter_to_pwrctl(Adapter)->rf_pwrstate== rf_off) + if (adapter_to_pwrctl(Adapter)->rf_pwrstate== rf_off) { #ifdef CONFIG_AUTOSUSPEND - if(Adapter->registrypriv.usbss_enable) + if (Adapter->registrypriv.usbss_enable) { #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) usb_disable_autosuspend(adapter_to_dvobj(Adapter)->pusbdev); @@ -762,7 +762,7 @@ static void rtw_late_resume(struct early_suspend *h) struct adapter *adapter = dvobj->if1; DBG_871X("%s\n",__FUNCTION__); - if(pwrpriv->do_late_resume) { + if (pwrpriv->do_late_resume) { rtw_set_do_late_resume(pwrpriv, false); rtw_resume_process(adapter); } @@ -810,7 +810,7 @@ static void rtw_late_resume(android_early_suspend_t *h) struct adapter *adapter = dvobj->if1; DBG_871X("%s\n",__FUNCTION__); - if(pwrpriv->do_late_resume) { + if (pwrpriv->do_late_resume) { rtw_set_do_late_resume(pwrpriv, false); rtw_resume_process(adapter); } @@ -908,13 +908,13 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal } /* System suspend is not allowed to wakeup */ - if((pwrpriv->bInternalAutoSuspend == false) && (true == pwrpriv->bInSuspend )){ + if ((pwrpriv->bInternalAutoSuspend == false) && (true == pwrpriv->bInSuspend )){ ret = _FAIL; goto exit; } /* block??? */ - if((pwrpriv->bInternalAutoSuspend == true) && (padapter->net_closed == true)) { + if ((pwrpriv->bInternalAutoSuspend == true) && (padapter->net_closed == true)) { ret = _FAIL; goto exit; } @@ -923,8 +923,8 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { #if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) - if(true==pwrpriv->bInternalAutoSuspend){ - if(0==pwrpriv->autopm_cnt){ + if (true==pwrpriv->bInternalAutoSuspend){ + if (0==pwrpriv->autopm_cnt){ #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) if (usb_autopm_get_interface(adapter_to_dvobj(padapter)->pusbintf) < 0) { @@ -945,19 +945,19 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal #endif /* if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) */ } - if(rf_off == pwrpriv->rf_pwrstate ) + if (rf_off == pwrpriv->rf_pwrstate ) { #ifdef CONFIG_AUTOSUSPEND - if(pwrpriv->brfoffbyhw==true) + if (pwrpriv->brfoffbyhw==true) { DBG_8192C("hw still in rf_off state ...........\n"); ret = _FAIL; goto exit; } - else if(padapter->registrypriv.usbss_enable) + else if (padapter->registrypriv.usbss_enable) { DBG_8192C("%s call autoresume_enter....\n",__FUNCTION__); - if(_FAIL == autoresume_enter(padapter)) + if (_FAIL == autoresume_enter(padapter)) { DBG_8192C("======> autoresume fail.............\n"); ret = _FAIL; @@ -968,7 +968,7 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal #endif { DBG_8192C("%s call ips_leave....\n",__FUNCTION__); - if(_FAIL == ips_leave(padapter)) + if (_FAIL == ips_leave(padapter)) { DBG_8192C("======> ips_leave fail.............\n"); ret = _FAIL; @@ -978,7 +978,7 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal } /* TODO: the following checking need to be merged... */ - if(padapter->bDriverStopped + if (padapter->bDriverStopped || !padapter->bup || !padapter->hw_init_completed ){ @@ -1005,9 +1005,9 @@ int rtw_pm_set_lps(struct adapter *padapter, u8 mode) if ( mode < PS_MODE_NUM ) { - if(pwrctrlpriv->power_mgnt !=mode) + if (pwrctrlpriv->power_mgnt !=mode) { - if(PS_MODE_ACTIVE == mode) + if (PS_MODE_ACTIVE == mode) { LeaveAllPowerSaveMode(padapter); } @@ -1031,15 +1031,15 @@ int rtw_pm_set_ips(struct adapter *padapter, u8 mode) { struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); - if( mode == IPS_NORMAL || mode == IPS_LEVEL_2 ) { + if ( mode == IPS_NORMAL || mode == IPS_LEVEL_2 ) { rtw_ips_mode_req(pwrctrlpriv, mode); DBG_871X("%s %s\n", __FUNCTION__, mode == IPS_NORMAL?"IPS_NORMAL":"IPS_LEVEL_2"); return 0; } - else if(mode ==IPS_NONE){ + else if (mode ==IPS_NONE){ rtw_ips_mode_req(pwrctrlpriv, mode); DBG_871X("%s %s\n", __FUNCTION__, "IPS_NONE"); - if((padapter->bSurpriseRemoved ==0)&&(_FAIL == rtw_pwr_wakeup(padapter)) ) + if ((padapter->bSurpriseRemoved ==0)&&(_FAIL == rtw_pwr_wakeup(padapter)) ) return -EFAULT; } else { diff --git a/core/rtw_recv.c b/core/rtw_recv.c index a6ec111..64c565c 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -82,7 +82,7 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) precvpriv->pallocated_frame_buf = rtw_zvmalloc(NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ); - if(precvpriv->pallocated_frame_buf==NULL){ + if (precvpriv->pallocated_frame_buf==NULL){ res= _FAIL; goto exit; } @@ -132,7 +132,7 @@ void _rtw_free_recv_priv (struct recv_priv *precvpriv) rtw_os_recv_resource_free(precvpriv); - if(precvpriv->pallocated_frame_buf) { + if (precvpriv->pallocated_frame_buf) { rtw_vmfree(precvpriv->pallocated_frame_buf, NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ); } @@ -151,7 +151,7 @@ union recv_frame *_rtw_alloc_recvframe (struct __queue *pfree_recv_queue) struct recv_priv *precvpriv; ; - if(_rtw_queue_empty(pfree_recv_queue) == true) + if (_rtw_queue_empty(pfree_recv_queue) == true) { precvframe = NULL; } @@ -165,9 +165,9 @@ union recv_frame *_rtw_alloc_recvframe (struct __queue *pfree_recv_queue) rtw_list_delete(&precvframe->u.hdr.list); padapter=precvframe->u.hdr.adapter; - if(padapter !=NULL){ + if (padapter !=NULL){ precvpriv=&padapter->recvpriv; - if(pfree_recv_queue == &precvpriv->free_recv_queue) + if (pfree_recv_queue == &precvpriv->free_recv_queue) precvpriv->free_recvframe_cnt--; } } @@ -206,7 +206,7 @@ int rtw_free_recvframe(union recv_frame *precvframe, struct __queue *pfree_recv struct adapter *padapter=precvframe->u.hdr.adapter; struct recv_priv *precvpriv = &padapter->recvpriv; - if(precvframe->u.hdr.pkt) { + if (precvframe->u.hdr.pkt) { rtw_skb_free(precvframe->u.hdr.pkt);/* free skb by driver */ precvframe->u.hdr.pkt = NULL; } @@ -219,8 +219,8 @@ int rtw_free_recvframe(union recv_frame *precvframe, struct __queue *pfree_recv rtw_list_insert_tail(&(precvframe->u.hdr.list), get_list_head(pfree_recv_queue)); - if(padapter !=NULL){ - if(pfree_recv_queue == &precvpriv->free_recv_queue) + if (padapter !=NULL){ + if (pfree_recv_queue == &precvpriv->free_recv_queue) precvpriv->free_recvframe_cnt++; } @@ -349,7 +349,7 @@ struct recv_buf *rtw_dequeue_recvbuf(struct __queue *queue) _enter_critical_ex(&queue->lock, &irqL); - if(_rtw_queue_empty(queue) == true) + if (_rtw_queue_empty(queue) == true) { precvbuf = NULL; } @@ -391,16 +391,16 @@ sint recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe){ stainfo=rtw_get_stainfo(&adapter->stapriv ,&prxattrib->ta[0]); - if(prxattrib->encrypt ==_TKIP_) + if (prxattrib->encrypt ==_TKIP_) { RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("\n recvframe_chkmic:prxattrib->encrypt ==_TKIP_\n")); RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("\n recvframe_chkmic:da=0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n", prxattrib->ra[0],prxattrib->ra[1],prxattrib->ra[2],prxattrib->ra[3],prxattrib->ra[4],prxattrib->ra[5])); /* calculate mic code */ - if(stainfo!= NULL) + if (stainfo!= NULL) { - if(IS_MCAST(prxattrib->ra)) + if (IS_MCAST(prxattrib->ra)) { /* mickey=&psecuritypriv->dot118021XGrprxmickey.skey[0]; */ /* iv = precvframe->u.hdr.rx_data+prxattrib->hdrlen; */ @@ -411,7 +411,7 @@ sint recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe){ /* DBG_871X("\n recvframe_chkmic: bcmc key psecuritypriv->dot118021XGrpKeyid(%d),pmlmeinfo->key_index(%d) ,recv key_id(%d)\n", */ /* psecuritypriv->dot118021XGrpKeyid,pmlmeinfo->key_index,rxdata_key_idx); */ - if(psecuritypriv->binstallGrpkey==false) + if (psecuritypriv->binstallGrpkey==false) { res=_FAIL; RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("\n recvframe_chkmic:didn't install group key!!!!!!!!!!\n")); @@ -437,14 +437,14 @@ sint recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe){ bmic_err=false; for(i=0;i<8;i++){ - if(miccode[i] != *(pframemic+i)){ + if (miccode[i] != *(pframemic+i)){ RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("recvframe_chkmic:miccode[%d](%02x) != *(pframemic+%d)(%02x) ",i,miccode[i],i,*(pframemic+i))); bmic_err=true; } } - if(bmic_err==true){ + if (bmic_err==true){ RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("\n *(pframemic-8)-*(pframemic-1)=0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n", *(pframemic-8),*(pframemic-7),*(pframemic-6),*(pframemic-5),*(pframemic-4),*(pframemic-3),*(pframemic-2),*(pframemic-1))); @@ -471,10 +471,10 @@ sint recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe){ /* double check key_index for some timing issue , */ /* cannot compare with psecuritypriv->dot118021XGrpKeyid also cause timing issue */ - if((IS_MCAST(prxattrib->ra)==true) && (prxattrib->key_index != pmlmeinfo->key_index )) + if ((IS_MCAST(prxattrib->ra)==true) && (prxattrib->key_index != pmlmeinfo->key_index )) brpt_micerror = false; - if((prxattrib->bdecrypted ==true)&& (brpt_micerror == true)) + if ((prxattrib->bdecrypted ==true)&& (brpt_micerror == true)) { rtw_handle_tkip_mic_err(adapter,(u8)IS_MCAST(prxattrib->ra)); RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,(" mic error :prxattrib->bdecrypted=%d ",prxattrib->bdecrypted)); @@ -491,7 +491,7 @@ sint recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe){ } else{ /* mic checked ok */ - if((psecuritypriv->bcheck_grpkey ==false)&&(IS_MCAST(prxattrib->ra)==true)){ + if ((psecuritypriv->bcheck_grpkey ==false)&&(IS_MCAST(prxattrib->ra)==true)){ psecuritypriv->bcheck_grpkey =true; RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("psecuritypriv->bcheck_grpkey =true")); } @@ -525,11 +525,11 @@ static union recv_frame *decryptor(struct adapter *padapter,union recv_frame *pr RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("prxstat->decrypted=%x prxattrib->encrypt = 0x%03x\n",prxattrib->bdecrypted,prxattrib->encrypt)); - if(prxattrib->encrypt>0) { + if (prxattrib->encrypt>0) { u8 *iv = precv_frame->u.hdr.rx_data+prxattrib->hdrlen; prxattrib->key_index = ( ((iv[3])>>6)&0x3) ; - if(prxattrib->key_index > WEP_KEYS) + if (prxattrib->key_index > WEP_KEYS) { DBG_871X("prxattrib->key_index(%d) > WEP_KEYS\n", prxattrib->key_index); @@ -547,7 +547,7 @@ static union recv_frame *decryptor(struct adapter *padapter,union recv_frame *pr } } - if((prxattrib->encrypt>0) && ((prxattrib->bdecrypted==0) ||(psecuritypriv->sw_decrypt==true))) + if ((prxattrib->encrypt>0) && ((prxattrib->bdecrypted==0) ||(psecuritypriv->sw_decrypt==true))) { psecuritypriv->hw_decrypted=false; @@ -571,7 +571,7 @@ static union recv_frame *decryptor(struct adapter *padapter,union recv_frame *pr break; } } - else if(prxattrib->bdecrypted==1 + else if (prxattrib->bdecrypted==1 && prxattrib->encrypt >0 && (psecuritypriv->busetkipkey==1 || prxattrib->encrypt !=_TKIP_ ) ) @@ -588,7 +588,7 @@ static union recv_frame *decryptor(struct adapter *padapter,union recv_frame *pr #endif } - if(res == _FAIL) + if (res == _FAIL) { rtw_free_recvframe(return_packet,&padapter->recvpriv.free_recv_queue); return_packet = NULL; @@ -630,7 +630,7 @@ static union recv_frame * portctrl(struct adapter *adapter,union recv_frame * pr RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("########portctrl:adapter->securitypriv.dot11AuthAlgrthm=%d\n",adapter->securitypriv.dot11AuthAlgrthm)); - if(auth_alg==2) + if (auth_alg==2) { if ((psta!=NULL) && (psta->ieee8021x_blocked)) { @@ -668,7 +668,7 @@ static union recv_frame * portctrl(struct adapter *adapter,union recv_frame * pr prtnframe=precv_frame; /* check is the EAPOL frame or not (Rekey) */ - if(ether_type == eapol_type){ + if (ether_type == eapol_type){ RT_TRACE(_module_rtl871x_recv_c_,_drv_notice_,("########portctrl:ether_type == 0x888e\n")); /* check Rekey */ @@ -701,16 +701,16 @@ sint recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcac ; - if(tid>15) + if (tid>15) { RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, ("recv_decache, (tid>15)! seq_ctrl=0x%x, tid=0x%x\n", seq_ctrl, tid)); return _FAIL; } - if(1)/* if(bretry) */ + if (1)/* if (bretry) */ { - if(seq_ctrl == prxcache->tid_rxseq[tid]) + if (seq_ctrl == prxcache->tid_rxseq[tid]) { RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, ("recv_decache, seq_ctrl=0x%x, tid=0x%x, tid_rxseq=0x%x\n", seq_ctrl, tid, prxcache->tid_rxseq[tid])); @@ -740,11 +740,11 @@ void process_pwrbit_data(struct adapter *padapter, union recv_frame *precv_frame pwrbit = GetPwrMgt(ptr); - if(psta) + if (psta) { - if(pwrbit) + if (pwrbit) { - if(!(psta->state & WIFI_SLEEP_STATE)) + if (!(psta->state & WIFI_SLEEP_STATE)) { /* psta->state |= WIFI_SLEEP_STATE; */ /* pstapriv->sta_dz_bitmap |= BIT(psta->aid); */ @@ -756,7 +756,7 @@ void process_pwrbit_data(struct adapter *padapter, union recv_frame *precv_frame } else { - if(psta->state & WIFI_SLEEP_STATE) + if (psta->state & WIFI_SLEEP_STATE) { /* psta->state ^= WIFI_SLEEP_STATE; */ /* pstapriv->sta_dz_bitmap &= ~BIT(psta->aid); */ @@ -782,15 +782,15 @@ void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame) psta = rtw_get_stainfo(pstapriv, pattrib->src); - if(!psta) return; + if (!psta) return; - if(!psta->qos_option) + if (!psta->qos_option) return; - if(!(psta->qos_info&0xf)) + if (!(psta->qos_info&0xf)) return; - if(psta->state&WIFI_SLEEP_STATE) + if (psta->state&WIFI_SLEEP_STATE) { u8 wmmps_ac=0; @@ -815,9 +815,9 @@ void process_wmmps_data(struct adapter *padapter, union recv_frame *precv_frame) break; } - if(wmmps_ac) + if (wmmps_ac) { - if(psta->sleepq_ac_len>0) + if (psta->sleepq_ac_len>0) { /* process received triggered frame */ xmit_delivery_enabled_frames(padapter, psta); @@ -849,16 +849,16 @@ static void count_rx_stats(struct adapter *padapter, union recv_frame *prframe, padapter->mlmepriv.LinkDetectInfo.NumRxOkInPeriod++; - if( (!MacAddr_isBcst(pattrib->dst)) && (!IS_MCAST(pattrib->dst))){ + if ( (!MacAddr_isBcst(pattrib->dst)) && (!IS_MCAST(pattrib->dst))){ padapter->mlmepriv.LinkDetectInfo.NumRxUnicastOkInPeriod++; } - if(sta) + if (sta) psta = sta; else psta = prframe->u.hdr.psta; - if(psta) + if (psta) { pstats = &psta->sta_stats; @@ -900,12 +900,12 @@ sint sta2sta_data_frame( goto exit; } - if( (!_rtw_memcmp(myhwaddr, pattrib->dst, ETH_ALEN)) && (!bmcast) ){ + if ( (!_rtw_memcmp(myhwaddr, pattrib->dst, ETH_ALEN)) && (!bmcast) ){ ret= _FAIL; goto exit; } - if( _rtw_memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || + if ( _rtw_memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || _rtw_memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || (!_rtw_memcmp(pattrib->bssid, mybssid, ETH_ALEN)) ) { ret= _FAIL; @@ -915,11 +915,11 @@ sint sta2sta_data_frame( sta_addr = pattrib->src; } - else if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) + else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { { /* For Station mode, sa and bssid should always be BSSID, and DA is my mac-address */ - if(!_rtw_memcmp(pattrib->bssid, pattrib->src, ETH_ALEN) ) + if (!_rtw_memcmp(pattrib->bssid, pattrib->src, ETH_ALEN) ) { RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("bssid != TA under STATION_MODE; drop pkt\n")); ret= _FAIL; @@ -929,7 +929,7 @@ sint sta2sta_data_frame( } } - else if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { if (bmcast) { @@ -942,7 +942,7 @@ sint sta2sta_data_frame( else /* not mc-frame */ { /* For AP mode, if DA is non-MCAST, then it must be BSSID, and bssid == BSSID */ - if(!_rtw_memcmp(pattrib->bssid, pattrib->dst, ETH_ALEN)) { + if (!_rtw_memcmp(pattrib->bssid, pattrib->dst, ETH_ALEN)) { ret= _FAIL; goto exit; } @@ -951,7 +951,7 @@ sint sta2sta_data_frame( } } - else if(check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) + else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) { memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN); memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN); @@ -968,7 +968,7 @@ sint sta2sta_data_frame( - if(bmcast) + if (bmcast) *psta = rtw_get_bcmc_stainfo(adapter); else *psta = rtw_get_stainfo(pstapriv, sta_addr); /* get ap_info */ @@ -1023,7 +1023,7 @@ sint ap2sta_data_frame( } /* da should be for me */ - if((!_rtw_memcmp(myhwaddr, pattrib->dst, ETH_ALEN))&& (!bmcast)) + if ((!_rtw_memcmp(myhwaddr, pattrib->dst, ETH_ALEN))&& (!bmcast)) { RT_TRACE(_module_rtl871x_recv_c_,_drv_info_, (" ap2sta_data_frame: compare DA fail; DA="MAC_FMT"\n", MAC_ARG(pattrib->dst))); @@ -1036,7 +1036,7 @@ sint ap2sta_data_frame( /* check BSSID */ - if( _rtw_memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || + if ( _rtw_memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || _rtw_memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || (!_rtw_memcmp(pattrib->bssid, mybssid, ETH_ALEN)) ) { @@ -1049,7 +1049,7 @@ sint ap2sta_data_frame( DBG_871X( "this adapter = %d, buddy adapter = %d\n", adapter->adapter_type, adapter->pbuddy_adapter->adapter_type ); #endif - if(!bmcast) + if (!bmcast) { DBG_871X("issue_deauth to the nonassociated ap=" MAC_FMT " for the reason(7)\n", MAC_ARG(pattrib->bssid)); issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); @@ -1059,7 +1059,7 @@ sint ap2sta_data_frame( goto exit; } - if(bmcast) + if (bmcast) *psta = rtw_get_bcmc_stainfo(adapter); else *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get ap_info */ @@ -1117,7 +1117,7 @@ sint ap2sta_data_frame( } else { - if(_rtw_memcmp(myhwaddr, pattrib->dst, ETH_ALEN)&& (!bmcast)) + if (_rtw_memcmp(myhwaddr, pattrib->dst, ETH_ALEN)&& (!bmcast)) { *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get sta_info */ if (*psta == NULL) @@ -1163,7 +1163,7 @@ sint sta2ap_data_frame( if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { /* For AP mode, RA=BSSID, TX=STA(SRC_ADDR), A3=DST_ADDR */ - if(!_rtw_memcmp(pattrib->bssid, mybssid, ETH_ALEN)) + if (!_rtw_memcmp(pattrib->bssid, mybssid, ETH_ALEN)) { ret= _FAIL; goto exit; @@ -1237,7 +1237,7 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ } /* only handle ps-poll */ - if(GetFrameSubType(pframe) == WIFI_PSPOLL) + if (GetFrameSubType(pframe) == WIFI_PSPOLL) { u16 aid; u8 wmmps_ac=0; @@ -1246,7 +1246,7 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ aid = GetAid(pframe); psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); - if((psta==NULL) || (psta->aid!=aid)) + if ((psta==NULL) || (psta->aid!=aid)) { return _FAIL; } @@ -1275,17 +1275,17 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ break; } - if(wmmps_ac) + if (wmmps_ac) return _FAIL; - if(psta->state & WIFI_STA_ALIVE_CHK_STATE) + if (psta->state & WIFI_STA_ALIVE_CHK_STATE) { DBG_871X("%s alive check-rx ps-poll\n", __func__); psta->expire_to = pstapriv->expire_to; psta->state ^= WIFI_STA_ALIVE_CHK_STATE; } - if((psta->state&WIFI_SLEEP_STATE) && (pstapriv->sta_dz_bitmap&BIT(psta->aid))) + if ((psta->state&WIFI_SLEEP_STATE) && (pstapriv->sta_dz_bitmap&BIT(psta->aid))) { unsigned long irqL; struct list_head *xmitframe_plist, *xmitframe_phead; @@ -1308,7 +1308,7 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ psta->sleepq_len--; - if(psta->sleepq_len>0) + if (psta->sleepq_len>0) pxmitframe->attrib.mdata = 1; else pxmitframe->attrib.mdata = 0; @@ -1319,7 +1319,7 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ rtw_hal_xmitframe_enqueue(padapter, pxmitframe); - if(psta->sleepq_len==0) + if (psta->sleepq_len==0) { pstapriv->tim_bitmap &= ~BIT(psta->aid); @@ -1338,9 +1338,9 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ spin_unlock_bh(&pxmitpriv->lock); /* DBG_871X("no buffered packets to xmit\n"); */ - if(pstapriv->tim_bitmap&BIT(psta->aid)) + if (pstapriv->tim_bitmap&BIT(psta->aid)) { - if(psta->sleepq_len==0) + if (psta->sleepq_len==0) { DBG_871X("no buffered packets to xmit\n"); @@ -1408,7 +1408,7 @@ sint validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_ } #ifdef CONFIG_INTEL_PROXIM - if(padapter->proximity.proxim_on==true) + if (padapter->proximity.proxim_on==true) { struct rx_pkt_attrib * pattrib=&precv_frame->u.hdr.attrib; struct recv_stat* prxstat=( struct recv_stat * ) precv_frame->u.hdr.rx_head ; @@ -1480,7 +1480,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f psa = get_sa(ptr); pbssid = get_hdr_bssid(ptr); - if(pbssid == NULL){ + if (pbssid == NULL){ #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s pbssid == NULL\n", __func__); #endif @@ -1526,7 +1526,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f } - if(ret ==_FAIL){ + if (ret ==_FAIL){ #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s case:%d, res:%d\n", __FUNCTION__, pattrib->to_fr_ds, ret); #endif @@ -1536,7 +1536,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f } - if(psta==NULL){ + if (psta==NULL){ RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,(" after to_fr_ds_chk; psta==NULL\n")); #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s psta == NULL\n", __func__); @@ -1553,14 +1553,14 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f pattrib->amsdu=0; pattrib->ack_policy = 0; /* parsing QC field */ - if(pattrib->qos == 1) + if (pattrib->qos == 1) { pattrib->priority = GetPriority((ptr + 24)); pattrib->ack_policy = GetAckpolicy((ptr + 24)); pattrib->amsdu = GetAMsdu((ptr + 24)); pattrib->hdrlen = pattrib->to_fr_ds==3 ? 32 : 26; - if(pattrib->priority!=0 && pattrib->priority!=3) + if (pattrib->priority!=0 && pattrib->priority!=3) { adapter->recvpriv.bIsAnyNonBEPkts = true; } @@ -1572,7 +1572,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f } - if(pattrib->order)/* HT-CTRL 11n */ + if (pattrib->order)/* HT-CTRL 11n */ { pattrib->hdrlen += 4; } @@ -1580,7 +1580,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f precv_frame->u.hdr.preorder_ctrl = &psta->recvreorder_ctrl[pattrib->priority]; /* decache, drop duplicate recv packets */ - if(recv_decache(precv_frame, bretry, &psta->sta_recvpriv.rxcache) == _FAIL) + if (recv_decache(precv_frame, bretry, &psta->sta_recvpriv.rxcache) == _FAIL) { RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("decache : drop pkt\n")); #ifdef DBG_RX_DROP_FRAME @@ -1590,7 +1590,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f goto exit; } - if(pattrib->privacy){ + if (pattrib->privacy){ RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("validate_recv_data_frame:pattrib->privacy=%x\n", pattrib->privacy)); RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("\n ^^^^^^^^^^^IS_MCAST(pattrib->ra(0x%02x))=%d^^^^^^^^^^^^^^^6\n", pattrib->ra[0],IS_MCAST(pattrib->ra))); @@ -1626,11 +1626,11 @@ static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *prec subtype = GetFrameSubType(ptr); /* bit(7)~bit(2) */ /* only support station mode */ - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) && adapter->securitypriv.binstallBIPkey == true) { /* unicast management frame decrypt */ - if(pattrib->privacy && !(IS_MCAST(GetAddr1Ptr(ptr))) && + if (pattrib->privacy && !(IS_MCAST(GetAddr1Ptr(ptr))) && (subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC || subtype == WIFI_ACTION)) { u8 *ppp, *mgmt_DATA; @@ -1647,7 +1647,7 @@ static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *prec /* actual management data frame body */ data_len = pattrib->pkt_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; mgmt_DATA = rtw_zmalloc(data_len); - if(mgmt_DATA == NULL) + if (mgmt_DATA == NULL) { DBG_871X("%s mgmt allocate fail !!!!!!!!!\n", __FUNCTION__); goto validate_80211w_fail; @@ -1677,24 +1677,24 @@ static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *prec printk(" %02x ", ptr[pp]); printk("\n"); }*/ - if(!precv_frame) + if (!precv_frame) { DBG_871X("%s mgmt descrypt fail !!!!!!!!!\n", __FUNCTION__); goto validate_80211w_fail; } } - else if(IS_MCAST(GetAddr1Ptr(ptr)) && + else if (IS_MCAST(GetAddr1Ptr(ptr)) && (subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC)) { sint BIP_ret = _SUCCESS; /* verify BIP MME IE of broadcast/multicast de-auth/disassoc packet */ BIP_ret = rtw_BIP_verify(adapter, (u8 * )precv_frame); - if(BIP_ret == _FAIL) + if (BIP_ret == _FAIL) { /* DBG_871X("802.11w BIP verify fail\n"); */ goto validate_80211w_fail; } - else if(BIP_ret == RTW_RX_HANDLED) + else if (BIP_ret == RTW_RX_HANDLED) { /* DBG_871X("802.11w recv none protected packet\n"); */ /* issue sa query request */ @@ -1704,10 +1704,10 @@ static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *prec }/* 802.11w protect */ else { - if(subtype == WIFI_ACTION) + if (subtype == WIFI_ACTION) { /* according 802.11-2012 standard, these five types are not robust types */ - if( ptr[WLAN_HDR_A3_LEN] != RTW_WLAN_CATEGORY_PUBLIC && + if ( ptr[WLAN_HDR_A3_LEN] != RTW_WLAN_CATEGORY_PUBLIC && ptr[WLAN_HDR_A3_LEN] != RTW_WLAN_CATEGORY_HT && ptr[WLAN_HDR_A3_LEN] != RTW_WLAN_CATEGORY_UNPROTECTED_WNM && ptr[WLAN_HDR_A3_LEN] != RTW_WLAN_CATEGORY_SELF_PROTECTED && @@ -1717,7 +1717,7 @@ static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *prec goto validate_80211w_fail; } } - else if(subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC) + else if (subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC) { DBG_871X("802.11w recv none protected packet\n"); /* issue sa query request */ @@ -1761,7 +1761,7 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) #endif /* add version chk */ - if(ver!=0){ + if (ver!=0){ RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("validate_recv_data_frame fail! (ver!=0)\n")); retval= _FAIL; goto exit; @@ -1782,7 +1782,7 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) pattrib->order = GetOrder(ptr); rtw_hal_get_def_var(adapter, HAL_DEF_DBG_DUMP_RXPKT, &(bDumpRxPkt)); - if(bDumpRxPkt ==1){/* dump all rx packets */ + if (bDumpRxPkt ==1){/* dump all rx packets */ int i; DBG_871X("#############################\n"); @@ -1791,8 +1791,8 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) *(ptr+i+1), *(ptr+i+2) ,*(ptr+i+3) ,*(ptr+i+4),*(ptr+i+5), *(ptr+i+6), *(ptr+i+7)); DBG_871X("#############################\n"); } - else if(bDumpRxPkt ==2){ - if(type== WIFI_MGT_TYPE){ + else if (bDumpRxPkt ==2){ + if (type== WIFI_MGT_TYPE){ int i; DBG_871X("#############################\n"); @@ -1802,8 +1802,8 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) DBG_871X("#############################\n"); } } - else if(bDumpRxPkt ==3){ - if(type== WIFI_DATA_TYPE){ + else if (bDumpRxPkt ==3){ + if (type== WIFI_DATA_TYPE){ int i; DBG_871X("#############################\n"); @@ -1817,7 +1817,7 @@ sint validate_recv_frame(struct adapter *adapter, union recv_frame *precv_frame) { case WIFI_MGT_TYPE: /* mgnt */ #ifdef CONFIG_IEEE80211W - if(validate_80211w_mgmt(adapter, precv_frame) == _FAIL) + if (validate_80211w_mgmt(adapter, precv_frame) == _FAIL) { retval = _FAIL; break; @@ -1886,7 +1886,7 @@ static sint wlanhdr_to_ethhdr ( union recv_frame *precvframe) ; - if(pattrib->encrypt){ + if (pattrib->encrypt){ recvframe_pull_tail(precvframe, pattrib->icv_len); } @@ -1894,7 +1894,7 @@ static sint wlanhdr_to_ethhdr ( union recv_frame *precvframe) psnap_type=ptr+pattrib->hdrlen + pattrib->iv_len+SNAP_SIZE; /* convert hdr + possible LLC headers into Ethernet header */ /* eth_type = (psnap_type[0] << 8) | psnap_type[1]; */ - if((_rtw_memcmp(psnap, rtw_rfc1042_header, SNAP_SIZE) && + if ((_rtw_memcmp(psnap, rtw_rfc1042_header, SNAP_SIZE) && (_rtw_memcmp(psnap_type, SNAP_ETH_TYPE_IPX, 2) == false) && (_rtw_memcmp(psnap_type, SNAP_ETH_TYPE_APPLETALK_AARP, 2)==false) )|| /* eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) || */ @@ -1935,7 +1935,7 @@ static sint wlanhdr_to_ethhdr ( union recv_frame *precvframe) memcpy(ptr, pattrib->dst, ETH_ALEN); memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN); - if(!bsnaphdr) { + if (!bsnaphdr) { be_tmp = htons(len); memcpy(ptr+12, &be_tmp, 2); } @@ -1964,7 +1964,7 @@ static union recv_frame * recvframe_defrag(struct adapter *adapter, struct __qu pfhdr=&prframe->u.hdr; rtw_list_delete(&(prframe->u.list)); - if(curfragnum!=pfhdr->attrib.frag_num) + if (curfragnum!=pfhdr->attrib.frag_num) { /* the first fragment number must be 0 */ /* free the whole queue */ @@ -1990,7 +1990,7 @@ static union recv_frame * recvframe_defrag(struct adapter *adapter, struct __qu /* check the fragment sequence (2nd ~n fragment frame) */ - if(curfragnum!=pnfhdr->attrib.frag_num) + if (curfragnum!=pnfhdr->attrib.frag_num) { /* the fragment number must be increasing (after decache) */ /* release the defrag_q & prframe */ @@ -2077,12 +2077,12 @@ union recv_frame* recvframe_chk_defrag(struct adapter *padapter, union recv_fram { /* 0~(n-1) fragment frame */ /* enqueue to defraf_g */ - if(pdefrag_q != NULL) + if (pdefrag_q != NULL) { - if(fragnum==0) + if (fragnum==0) { /* the first fragment */ - if(_rtw_queue_empty(pdefrag_q) == false) + if (_rtw_queue_empty(pdefrag_q) == false) { /* free current defrag_q */ rtw_free_recvframe_queue(pdefrag_q, pfree_recv_queue); @@ -2112,11 +2112,11 @@ union recv_frame* recvframe_chk_defrag(struct adapter *padapter, union recv_fram } - if((ismfrag==0)&&(fragnum!=0)) + if ((ismfrag==0)&&(fragnum!=0)) { /* the last fragment frame */ /* enqueue the last fragment */ - if(pdefrag_q != NULL) + if (pdefrag_q != NULL) { /* _rtw_spinlock(&pdefrag_q->lock); */ phead = get_list_head(pdefrag_q); @@ -2140,10 +2140,10 @@ union recv_frame* recvframe_chk_defrag(struct adapter *padapter, union recv_fram } - if((prtnframe!=NULL)&&(prtnframe->u.hdr.attrib.privacy)) + if ((prtnframe!=NULL)&&(prtnframe->u.hdr.attrib.privacy)) { /* after defrag we must check tkip mic code */ - if(recvframe_chkmic(padapter, prtnframe)==_FAIL) + if (recvframe_chkmic(padapter, prtnframe)==_FAIL) { RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("recvframe_chkmic(padapter, prtnframe)==_FAIL\n")); rtw_free_recvframe(prtnframe,pfree_recv_queue); @@ -2177,7 +2177,7 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) recvframe_pull(prframe, prframe->u.hdr.attrib.hdrlen); - if(prframe->u.hdr.attrib.iv_len >0) + if (prframe->u.hdr.attrib.iv_len >0) { recvframe_pull(prframe, prframe->u.hdr.attrib.iv_len); } @@ -2199,7 +2199,7 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) /* ntohs(nSubframe_Length); */ #endif /* ENDIAN_FREE */ - if( a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length) ) { + if ( a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length) ) { DBG_871X("nRemain_Length is %d and nSubframe_Length is : %d\n",a_len,nSubframe_Length); goto exit; } @@ -2210,13 +2210,13 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) /* Allocate new skb for releasing to upper layer */ sub_skb = rtw_skb_alloc(nSubframe_Length + 12); - if(sub_skb) { + if (sub_skb) { skb_reserve(sub_skb, 12); data_ptr = (u8 *)skb_put(sub_skb, nSubframe_Length); memcpy(data_ptr, pdata, nSubframe_Length); } else { sub_skb = rtw_skb_clone(prframe->u.hdr.pkt); - if(sub_skb) + if (sub_skb) { sub_skb->data = pdata; sub_skb->len = nSubframe_Length; @@ -2232,20 +2232,20 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) /* sub_skb->dev = padapter->pnetdev; */ subframes[nr_subframes++] = sub_skb; - if(nr_subframes >= MAX_SUBFRAME_COUNT) { + if (nr_subframes >= MAX_SUBFRAME_COUNT) { DBG_871X("ParseSubframe(): Too many Subframes! Packets dropped!\n"); break; } pdata += nSubframe_Length; a_len -= nSubframe_Length; - if(a_len != 0) { + if (a_len != 0) { padding_len = 4 - ((nSubframe_Length + ETH_HLEN) & (4-1)); - if(padding_len == 4) { + if (padding_len == 4) { padding_len = 0; } - if(a_len < padding_len) { + if (a_len < padding_len) { goto exit; } pdata += padding_len; @@ -2297,7 +2297,7 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */ - if( br_port && (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) ) + if ( br_port && (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) ) { if (nat25_handle_frame(padapter, sub_skb) == -1) { /* priv->ext_stats.rx_data_drops++; */ @@ -2346,7 +2346,7 @@ static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_n /* DbgPrint("enter->check_indicate_seq(): IndicateSeq: %d, NewSeq: %d\n", precvpriv->indicate_seq, seq_num); */ /* Drop out the packet which SeqNum is smaller than WinStart */ - if( SN_LESS(seq_num, preorder_ctrl->indicate_seq) ) + if ( SN_LESS(seq_num, preorder_ctrl->indicate_seq) ) { /* RT_TRACE(COMP_RX_REORDER, DBG_LOUD, ("CheckRxTsIndicateSeq(): Packet Drop! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, NewSeqNum)); */ /* DbgPrint("CheckRxTsIndicateSeq(): Packet Drop! IndicateSeq: %d, NewSeq: %d\n", precvpriv->indicate_seq, seq_num); */ @@ -2365,7 +2365,7 @@ static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_n /* 1. Incoming SeqNum is equal to WinStart =>Window shift 1 */ /* 2. Incoming SeqNum is larger than the WinEnd => Window shift N */ /* */ - if( SN_EQUAL(seq_num, preorder_ctrl->indicate_seq) ) + if ( SN_EQUAL(seq_num, preorder_ctrl->indicate_seq) ) { preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) & 0xFFF; #ifdef DBG_RX_SEQ @@ -2373,13 +2373,13 @@ static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_n preorder_ctrl->indicate_seq, seq_num); #endif } - else if(SN_LESS(wend, seq_num)) + else if (SN_LESS(wend, seq_num)) { /* RT_TRACE(COMP_RX_REORDER, DBG_LOUD, ("CheckRxTsIndicateSeq(): Window Shift! IndicateSeq: %d, NewSeq: %d\n", pTS->RxIndicateSeq, NewSeqNum)); */ /* DbgPrint("CheckRxTsIndicateSeq(): Window Shift! IndicateSeq: %d, NewSeq: %d\n", precvpriv->indicate_seq, seq_num); */ /* boundary situation, when seq_num cross 0xFFF */ - if(seq_num >= (wsize - 1)) + if (seq_num >= (wsize - 1)) preorder_ctrl->indicate_seq = seq_num + 1 -wsize; else preorder_ctrl->indicate_seq = 0xFFF - (wsize - (seq_num + 1)) + 1; @@ -2412,11 +2412,11 @@ int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union rec pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u); pnextattrib = &pnextrframe->u.hdr.attrib; - if(SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) + if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) { plist = get_next(plist); } - else if( SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num)) + else if ( SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num)) { return false; } @@ -2455,9 +2455,9 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr plist = get_next(phead); /* Handling some condition for forced indicate case. */ - if(bforced==true) + if (bforced==true) { - if(rtw_is_list_empty(phead)) + if (rtw_is_list_empty(phead)) { /* _exit_critical_ex(&ppending_recvframe_queue->lock); */ /* _rtw_spinunlock_ex(&ppending_recvframe_queue->lock); */ @@ -2481,7 +2481,7 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr prframe = LIST_CONTAINOR(plist, union recv_frame, u); pattrib = &prframe->u.hdr.attrib; - if(!SN_LESS(preorder_ctrl->indicate_seq, pattrib->seq_num)) + if (!SN_LESS(preorder_ctrl->indicate_seq, pattrib->seq_num)) { RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, ("recv_indicatepkts_in_order: indicate=%d seq=%d amsdu=%d\n", @@ -2489,7 +2489,7 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr plist = get_next(plist); rtw_list_delete(&(prframe->u.hdr.list)); - if(SN_EQUAL(preorder_ctrl->indicate_seq, pattrib->seq_num)) + if (SN_EQUAL(preorder_ctrl->indicate_seq, pattrib->seq_num)) { preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) & 0xFFF; #ifdef DBG_RX_SEQ @@ -2507,7 +2507,7 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr /* indicate this recv_frame */ /* DbgPrint("recv_indicatepkts_in_order, indicate_seq=%d, seq_num=%d\n", precvpriv->indicate_seq, pattrib->seq_num); */ - if(!pattrib->amsdu) + if (!pattrib->amsdu) { /* DBG_871X("recv_indicatepkts_in_order, amsdu!=1, indicate_seq=%d, seq_num=%d\n", preorder_ctrl->indicate_seq, pattrib->seq_num); */ @@ -2519,9 +2519,9 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr } } - else if(pattrib->amsdu==1) + else if (pattrib->amsdu==1) { - if(amsdu_to_msdu(padapter, prframe)!=_SUCCESS) + if (amsdu_to_msdu(padapter, prframe)!=_SUCCESS) { rtw_free_recvframe(prframe, &precvpriv->free_recv_queue); } @@ -2556,7 +2556,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame * struct recv_reorder_ctrl *preorder_ctrl = prframe->u.hdr.preorder_ctrl; struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; - if(!pattrib->amsdu) { + if (!pattrib->amsdu) { /* s1. */ wlanhdr_to_ethhdr(prframe); @@ -2593,7 +2593,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame * return _SUCCESS; } - } else if(pattrib->amsdu==1) { /* temp filter -> means didn't support A-MSDUs in a A-MPDU */ + } else if (pattrib->amsdu==1) { /* temp filter -> means didn't support A-MSDUs in a A-MPDU */ if (preorder_ctrl->enable == false) { preorder_ctrl->indicate_seq = pattrib->seq_num; #ifdef DBG_RX_SEQ @@ -2609,7 +2609,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame * preorder_ctrl->indicate_seq, pattrib->seq_num); #endif - if(retval != _SUCCESS){ + if (retval != _SUCCESS){ #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s amsdu_to_msdu fail\n", __FUNCTION__); #endif @@ -2626,7 +2626,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame * preorder_ctrl->indicate_seq, pattrib->seq_num)); /* s2. check if winstart_b(indicate_seq) needs to been updated */ - if(!check_indicate_seq(preorder_ctrl, pattrib->seq_num)) { + if (!check_indicate_seq(preorder_ctrl, pattrib->seq_num)) { #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s check_indicate_seq fail\n", __FUNCTION__); #endif @@ -2634,7 +2634,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame * } /* s3. Insert all packet into Reorder Queue to maintain its ordering. */ - if(!enqueue_reorder_recvframe(preorder_ctrl, prframe)) { + if (!enqueue_reorder_recvframe(preorder_ctrl, prframe)) { #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s enqueue_reorder_recvframe fail\n", __FUNCTION__); #endif @@ -2651,7 +2651,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame * /* 2. All packets with SeqNum larger than or equal to WinStart => Buffer it. */ /* */ - if(recv_indicatepkts_in_order(padapter, preorder_ctrl, false)) { + if (recv_indicatepkts_in_order(padapter, preorder_ctrl, false)) { _set_timer(&preorder_ctrl->reordering_ctrl_timer, REORDER_WAIT_TIME); spin_unlock_bh(&ppending_recvframe_queue->lock); } else { @@ -2673,12 +2673,12 @@ void rtw_reordering_ctrl_timeout_handler(void *pcontext) struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; - if(padapter->bDriverStopped ||padapter->bSurpriseRemoved) + if (padapter->bDriverStopped ||padapter->bSurpriseRemoved) return; spin_lock_bh(&ppending_recvframe_queue->lock); - if(recv_indicatepkts_in_order(padapter, preorder_ctrl, true)==true) + if (recv_indicatepkts_in_order(padapter, preorder_ctrl, true)==true) _set_timer(&preorder_ctrl->reordering_ctrl_timer, REORDER_WAIT_TIME); spin_unlock_bh(&ppending_recvframe_queue->lock); @@ -2690,9 +2690,9 @@ static int process_recv_indicatepkts(struct adapter *padapter, union recv_frame struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; - if(phtpriv->ht_option==true) /* B/G/N Mode */ + if (phtpriv->ht_option==true) /* B/G/N Mode */ { - if(recv_indicatepkt_reorder(padapter, prframe)!=_SUCCESS)/* including perform A-MPDU Rx Ordering Buffer Control */ + if (recv_indicatepkt_reorder(padapter, prframe)!=_SUCCESS)/* including perform A-MPDU Rx Ordering Buffer Control */ { #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s recv_indicatepkt_reorder error!\n", __FUNCTION__); @@ -2709,7 +2709,7 @@ static int process_recv_indicatepkts(struct adapter *padapter, union recv_frame else /* B/G mode */ { retval=wlanhdr_to_ethhdr (prframe); - if(retval != _SUCCESS) + if (retval != _SUCCESS) { RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("wlanhdr_to_ethhdr: drop pkt\n")); #ifdef DBG_RX_DROP_FRAME @@ -2784,7 +2784,7 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr } prframe = recvframe_chk_defrag(padapter, prframe); - if(prframe==NULL) { + if (prframe==NULL) { RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("recvframe_chk_defrag: drop pkt\n")); #ifdef DBG_RX_DROP_FRAME DBG_871X("DBG_RX_DROP_FRAME %s recvframe_chk_defrag: drop pkt\n", __FUNCTION__); @@ -2849,7 +2849,7 @@ int recv_func(struct adapter *padapter, union recv_frame *rframe) ret = recv_func_prehandle(padapter, rframe); - if(ret == _SUCCESS) { + if (ret == _SUCCESS) { /* check if need to enqueue into uc_swdec_pending_queue*/ if (check_fwstate(mlmepriv, WIFI_STATION_STATE) && @@ -2925,20 +2925,20 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS){ u32 num_signal_qual = 0; u8 _alpha = 3; /* this value is based on converging_constant = 5000 and sampling_interval = 1000 */ - if(adapter->recvpriv.is_signal_dbg) { + if (adapter->recvpriv.is_signal_dbg) { /* update the user specific value, signal_strength_dbg, to signal_strength, rssi */ adapter->recvpriv.signal_strength= adapter->recvpriv.signal_strength_dbg; adapter->recvpriv.rssi=(s8)translate_percentage_to_dbm((u8)adapter->recvpriv.signal_strength_dbg); } else { - if(recvpriv->signal_strength_data.update_req == 0) {/* update_req is clear, means we got rx */ + if (recvpriv->signal_strength_data.update_req == 0) {/* update_req is clear, means we got rx */ avg_signal_strength = recvpriv->signal_strength_data.avg_val; num_signal_strength = recvpriv->signal_strength_data.total_num; /* after avg_vals are accquired, we can re-stat the signal values */ recvpriv->signal_strength_data.update_req = 1; } - if(recvpriv->signal_qual_data.update_req == 0) {/* update_req is clear, means we got rx */ + if (recvpriv->signal_qual_data.update_req == 0) {/* update_req is clear, means we got rx */ avg_signal_qual = recvpriv->signal_qual_data.avg_val; num_signal_qual = recvpriv->signal_qual_data.total_num; /* after avg_vals are accquired, we can re-stat the signal values */ @@ -2956,7 +2956,7 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS){ } } - if(check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == true + if (check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == true || check_fwstate(&adapter->mlmepriv, _FW_LINKED) == false ) { goto set_timer; @@ -2964,19 +2964,19 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS){ /* update value of signal_strength, rssi, signal_qual */ tmp_s = (avg_signal_strength+(_alpha-1)*recvpriv->signal_strength); - if(tmp_s %_alpha) + if (tmp_s %_alpha) tmp_s = tmp_s/_alpha + 1; else tmp_s = tmp_s/_alpha; - if(tmp_s>100) + if (tmp_s>100) tmp_s = 100; tmp_q = (avg_signal_qual+(_alpha-1)*recvpriv->signal_qual); - if(tmp_q %_alpha) + if (tmp_q %_alpha) tmp_q = tmp_q/_alpha + 1; else tmp_q = tmp_q/_alpha; - if(tmp_q>100) + if (tmp_q>100) tmp_q = 100; recvpriv->signal_strength = tmp_s; diff --git a/core/rtw_security.c b/core/rtw_security.c index d4bd2b5..44f6739 100644 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -179,7 +179,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) ; - if(((struct xmit_frame*)pxmitframe)->buf_addr==NULL) + if (((struct xmit_frame*)pxmitframe)->buf_addr==NULL) return; hw_hdr_offset = TXDESC_SIZE + @@ -188,7 +188,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + hw_hdr_offset; /* start to encrypt each fragment */ - if((pattrib->encrypt==_WEP40_)||(pattrib->encrypt==_WEP104_)) + if ((pattrib->encrypt==_WEP40_)||(pattrib->encrypt==_WEP104_)) { keylength=psecuritypriv->dot11DefKeylen[psecuritypriv->dot11PrivacyKeyIndex]; @@ -199,7 +199,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0],keylength); payload=pframe+pattrib->iv_len+pattrib->hdrlen; - if((curfragnum+1)==pattrib->nr_frags) + if ((curfragnum+1)==pattrib->nr_frags) { /* the last fragment */ length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; @@ -240,7 +240,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe) pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; /* start to decrypt recvframe */ - if((prxattrib->encrypt==_WEP40_)||(prxattrib->encrypt==_WEP104_)) + if ((prxattrib->encrypt==_WEP40_)||(prxattrib->encrypt==_WEP104_)) { iv=pframe+prxattrib->hdrlen; /* keyindex=(iv[3]&0x3); */ @@ -260,7 +260,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe) /* calculate icv and compare the icv */ *((__le32 *)crc)=getcrc32(payload,length-4); - if(crc[3]!=payload[length-1] || crc[2]!=payload[length-2] || crc[1]!=payload[length-3] || crc[0]!=payload[length-4]) + if (crc[3]!=payload[length-1] || crc[2]!=payload[length-2] || crc[1]!=payload[length-3] || crc[0]!=payload[length-4]) { RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_wep_decrypt:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n", crc[3],payload[length-1],crc[2],payload[length-2],crc[1],payload[length-3],crc[0],payload[length-4])); @@ -332,7 +332,7 @@ void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b ) pmicdata->M |= ((unsigned long)b) << (8*pmicdata->nBytesInM); pmicdata->nBytesInM++; /* Process the word if it is full. */ - if( pmicdata->nBytesInM >= 4 ) + if ( pmicdata->nBytesInM >= 4 ) { pmicdata->L ^= pmicdata->M; pmicdata->R ^= ROL32( pmicdata->L, 17 ); @@ -390,15 +390,15 @@ void rtw_seccalctkipmic(u8 * key,u8 *header,u8 *data,u32 data_len,u8 *mic_code, priority[0]=pri; /* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */ - if(header[1]&1){ /* ToDS==1 */ + if (header[1]&1){ /* ToDS==1 */ rtw_secmicappend(&micdata, &header[16], 6); /* DA */ - if(header[1]&2) /* From Ds==1 */ + if (header[1]&2) /* From Ds==1 */ rtw_secmicappend(&micdata, &header[24], 6); else rtw_secmicappend(&micdata, &header[10], 6); } else{ /* ToDS==0 */ rtw_secmicappend(&micdata, &header[4], 6); /* DA */ - if(header[1]&2) /* From Ds==1 */ + if (header[1]&2) /* From Ds==1 */ rtw_secmicappend(&micdata, &header[16], 6); else rtw_secmicappend(&micdata, &header[10], 6); @@ -646,7 +646,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) u32 res=_SUCCESS; ; - if(((struct xmit_frame*)pxmitframe)->buf_addr==NULL) + if (((struct xmit_frame*)pxmitframe)->buf_addr==NULL) return _FAIL; hw_hdr_offset = TXDESC_SIZE + @@ -654,9 +654,9 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + hw_hdr_offset; /* 4 start to encrypt each fragment */ - if(pattrib->encrypt==_TKIP_){ + if (pattrib->encrypt==_TKIP_){ - if(pattrib->psta) + if (pattrib->psta) { stainfo = pattrib->psta; } @@ -668,7 +668,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) if (stainfo!=NULL){ - if(!(stainfo->state &_FW_LINKED)) + if (!(stainfo->state &_FW_LINKED)) { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); return _FAIL; @@ -676,7 +676,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_tkip_encrypt: stainfo!=NULL!!!\n")); - if(IS_MCAST(pattrib->ra)) + if (IS_MCAST(pattrib->ra)) { prwskey=psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; } @@ -700,7 +700,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) phase2(&rc4key[0],prwskey,(u16 *)&ttkey[0],pnl); - if((curfragnum+1)==pattrib->nr_frags){ /* 4 the last fragment */ + if ((curfragnum+1)==pattrib->nr_frags){ /* 4 the last fragment */ length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; RT_TRACE(_module_rtl871x_security_c_,_drv_info_,("pattrib->iv_len =%x, pattrib->icv_len =%x\n", pattrib->iv_len,pattrib->icv_len)); *((__le32 *)crc)=getcrc32(payload,length);/* modified by Amy*/ @@ -762,18 +762,18 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe) pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; /* 4 start to decrypt recvframe */ - if(prxattrib->encrypt==_TKIP_){ + if (prxattrib->encrypt==_TKIP_){ stainfo=rtw_get_stainfo(&padapter->stapriv ,&prxattrib->ta[0] ); if (stainfo!=NULL){ - if(IS_MCAST(prxattrib->ra)) + if (IS_MCAST(prxattrib->ra)) { static u32 start = 0; static u32 no_gkey_bc_cnt = 0; static u32 no_gkey_mc_cnt = 0; - if(psecuritypriv->binstallGrpkey==false) + if (psecuritypriv->binstallGrpkey==false) { res=_FAIL; @@ -836,7 +836,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe) *((__le32 *)crc)=getcrc32(payload,length-4); - if(crc[3]!=payload[length-1] || crc[2]!=payload[length-2] || crc[1]!=payload[length-3] || crc[0]!=payload[length-4]) + if (crc[3]!=payload[length-1] || crc[2]!=payload[length-2] || crc[1]!=payload[length-3] || crc[0]!=payload[length-4]) { RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_wep_decrypt:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n", crc[3],payload[length-1],crc[2],payload[length-2],crc[1],payload[length-3],crc[0],payload[length-4])); @@ -1172,7 +1172,7 @@ static void construct_mic_iv( if (!qc_exists) mic_iv[1] = 0x00; #ifdef CONFIG_IEEE80211W /* 802.11w management frame should set management bit(4) */ - if(frtype == WIFI_MGT_TYPE) + if (frtype == WIFI_MGT_TYPE) mic_iv[1] |= BIT(4); #endif /* CONFIG_IEEE80211W */ for (i = 2; i < 8; i++) @@ -1206,7 +1206,7 @@ static void construct_mic_header1( mic_header1[1] = (u8)((header_length - 2) % 256); #ifdef CONFIG_IEEE80211W /* 802.11w management frame don't AND subtype bits 4,5,6 of frame control field */ - if(frtype == WIFI_MGT_TYPE) + if (frtype == WIFI_MGT_TYPE) mic_header1[2] = mpdu[0]; /* Mute CF poll & CF ack bits */ else #endif /* CONFIG_IEEE80211W */ @@ -1310,7 +1310,7 @@ static void construct_ctr_preload( ctr_preload[1] = mpdu[24] & 0x0f; #ifdef CONFIG_IEEE80211W /* 802.11w management frame should set management bit(4) */ - if(frtype == WIFI_MGT_TYPE) + if (frtype == WIFI_MGT_TYPE) ctr_preload[1] |= BIT(4); #endif /* CONFIG_IEEE80211W */ for (i = 2; i < 8; i++) @@ -1381,7 +1381,7 @@ static sint aes_cipher(u8 *key, uint hdrlen, ((frtype|frsubtype) == WIFI_DATA_CFPOLL)|| ((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) { qc_exists = 1; - if(hdrlen != WLAN_HDR_A3_QOS_LEN) + if (hdrlen != WLAN_HDR_A3_QOS_LEN) hdrlen += 2; } /* add for CONFIG_IEEE80211W, none 11w also can use */ @@ -1390,7 +1390,7 @@ static sint aes_cipher(u8 *key, uint hdrlen, (frsubtype == 0x09)|| (frsubtype == 0x0a)|| (frsubtype == 0x0b))) { - if(hdrlen != WLAN_HDR_A3_QOS_LEN) + if (hdrlen != WLAN_HDR_A3_QOS_LEN) hdrlen += 2; qc_exists = 1; } else @@ -1543,7 +1543,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) struct xmit_priv *pxmitpriv=&padapter->xmitpriv; u32 res=_SUCCESS; - if(((struct xmit_frame*)pxmitframe)->buf_addr==NULL) + if (((struct xmit_frame*)pxmitframe)->buf_addr==NULL) return _FAIL; hw_hdr_offset = TXDESC_SIZE + @@ -1552,8 +1552,8 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + hw_hdr_offset; /* 4 start to encrypt each fragment */ - if((pattrib->encrypt==_AES_)){ - if(pattrib->psta) { + if ((pattrib->encrypt==_AES_)){ + if (pattrib->psta) { stainfo = pattrib->psta; } else { DBG_871X("%s, call rtw_get_stainfo()\n", __func__); @@ -1561,14 +1561,14 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) } if (stainfo!=NULL){ - if(!(stainfo->state &_FW_LINKED)) { + if (!(stainfo->state &_FW_LINKED)) { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); return _FAIL; } RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_aes_encrypt: stainfo!=NULL!!!\n")); - if(IS_MCAST(pattrib->ra)) + if (IS_MCAST(pattrib->ra)) prwskey=psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; else prwskey=&stainfo->dot118021x_UncstKey.skey[0]; @@ -1576,7 +1576,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) for(curfragnum=0;curfragnumnr_frags;curfragnum++){ - if((curfragnum+1)==pattrib->nr_frags){ /* 4 the last fragment */ + if ((curfragnum+1)==pattrib->nr_frags){ /* 4 the last fragment */ length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; aes_cipher(prwskey,pattrib->hdrlen,pframe, length); @@ -1656,7 +1656,7 @@ static sint aes_decipher(u8 *key, uint hdrlen, ((frtype|frsubtype) == WIFI_DATA_CFPOLL)|| ((frtype|frsubtype) == WIFI_DATA_CFACKPOLL)) { qc_exists = 1; - if(hdrlen != WLAN_HDR_A3_QOS_LEN){ + if (hdrlen != WLAN_HDR_A3_QOS_LEN){ hdrlen += 2; } }/* only for data packet . add for CONFIG_IEEE80211W, none 11w also can use */ @@ -1665,7 +1665,7 @@ static sint aes_decipher(u8 *key, uint hdrlen, (frsubtype == 0x09)|| (frsubtype == 0x0a)|| (frsubtype == 0x0b))) { - if(hdrlen != WLAN_HDR_A3_QOS_LEN){ + if (hdrlen != WLAN_HDR_A3_QOS_LEN){ hdrlen += 2; } qc_exists = 1; @@ -1720,7 +1720,7 @@ static sint aes_decipher(u8 *key, uint hdrlen, } /* start to calculate the mic */ - if((hdrlen +plen+8) <= MAX_MSG_SIZE) + if ((hdrlen +plen+8) <= MAX_MSG_SIZE) memcpy((void *)message, pframe, (hdrlen +plen+8)); /* 8 is for ext iv len */ @@ -1849,7 +1849,7 @@ static sint aes_decipher(u8 *key, uint hdrlen, /* compare the mic */ for(i=0;i<8;i++){ - if(pframe[hdrlen+8+plen-8+i] != message[hdrlen+8+plen-8+i]) + if (pframe[hdrlen+8+plen-8+i] != message[hdrlen+8+plen-8+i]) { RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("aes_decipher:mic check error mic[%d]: pframe(%x) != message(%x)\n", i,pframe[hdrlen+8+plen-8+i],message[hdrlen+8+plen-8+i])); @@ -1873,12 +1873,12 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe) ; pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; /* 4 start to encrypt each fragment */ - if((prxattrib->encrypt==_AES_)){ + if ((prxattrib->encrypt==_AES_)){ stainfo=rtw_get_stainfo(&padapter->stapriv ,&prxattrib->ta[0] ); if (stainfo!=NULL){ RT_TRACE(_module_rtl871x_security_c_,_drv_err_,("rtw_aes_decrypt: stainfo!=NULL!!!\n")); - if(IS_MCAST(prxattrib->ra)) { + if (IS_MCAST(prxattrib->ra)) { static u32 start = 0; static u32 no_gkey_bc_cnt = 0; static u32 no_gkey_mc_cnt = 0; @@ -1917,7 +1917,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe) no_gkey_mc_cnt = 0; prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey; - if(psecuritypriv->dot118021XGrpKeyid != prxattrib->key_index) { + if (psecuritypriv->dot118021XGrpKeyid != prxattrib->key_index) { DBG_871X("not match packet_index=%d, install_index=%d\n" , prxattrib->key_index, psecuritypriv->dot118021XGrpKeyid); res=_FAIL; @@ -1954,7 +1954,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe) ori_len = pattrib->pkt_len-WLAN_HDR_A3_LEN+BIP_AAD_SIZE; BIP_AAD = rtw_zmalloc(ori_len); - if(BIP_AAD == NULL) + if (BIP_AAD == NULL) { DBG_871X("BIP AAD allocate fail\n"); return _FAIL; @@ -1968,7 +1968,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe) /* find MME IE pointer */ p = rtw_get_ie(BIP_AAD+BIP_AAD_SIZE, _MME_IE_, &len, pattrib->pkt_len-WLAN_HDR_A3_LEN); /* Baron */ - if(p) + if (p) { u16 keyid=0; u64 temp_ipn=0; @@ -1976,7 +1976,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe) memcpy(&temp_ipn, p+4, 6); temp_ipn = le64_to_cpu(temp_ipn); /* BIP packet number should bigger than previous BIP packet */ - if(temp_ipn <= pmlmeext->mgnt_80211w_IPN_rx) + if (temp_ipn <= pmlmeext->mgnt_80211w_IPN_rx) { DBG_871X("replay BIP packet\n"); goto BIP_exit; @@ -1984,7 +1984,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe) /* copy key index */ memcpy(&keyid, p+2, 2); keyid = le16_to_cpu(keyid); - if(keyid != padapter->securitypriv.dot11wBIPKeyid) + if (keyid != padapter->securitypriv.dot11wBIPKeyid) { DBG_871X("BIP key index error!\n"); goto BIP_exit; @@ -2000,7 +2000,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe) /* conscruct AAD, copy address 1 to address 3 */ memcpy(BIP_AAD+2, pwlanhdr->addr1, 18); - if(omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey + if (omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey , BIP_AAD, ori_len, mic)) goto BIP_exit; @@ -2024,7 +2024,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe) } */ /* MIC field should be last 8 bytes of packet (packet without FCS) */ - if(_rtw_memcmp(mic, pframe+pattrib->pkt_len-8, 8)) + if (_rtw_memcmp(mic, pframe+pattrib->pkt_len-8, 8)) { pmlmeext->mgnt_80211w_IPN_rx = temp_ipn; res=_SUCCESS; @@ -2768,10 +2768,10 @@ void rtw_sec_restore_wep_key(struct adapter *adapter) struct security_priv* securitypriv=&(adapter->securitypriv); sint keyid; - if((_WEP40_ == securitypriv->dot11PrivacyAlgrthm) ||(_WEP104_ == securitypriv->dot11PrivacyAlgrthm)) { + if ((_WEP40_ == securitypriv->dot11PrivacyAlgrthm) ||(_WEP104_ == securitypriv->dot11PrivacyAlgrthm)) { for(keyid=0;keyid<4;keyid++){ - if(securitypriv->key_mask & BIT(keyid)){ - if(keyid == securitypriv->dot11PrivacyKeyIndex) + if (securitypriv->key_mask & BIT(keyid)){ + if (keyid == securitypriv->dot11PrivacyKeyIndex) rtw_set_key(adapter,securitypriv, keyid, 1, true); else rtw_set_key(adapter,securitypriv, keyid, 0, true); diff --git a/core/rtw_sreset.c b/core/rtw_sreset.c index eb15c6a..654bcd3 100644 --- a/core/rtw_sreset.c +++ b/core/rtw_sreset.c @@ -50,20 +50,20 @@ u8 sreset_get_wifi_status(struct adapter *padapter) u8 status = WIFI_STATUS_SUCCESS; u32 val32 = 0; unsigned long irqL; - if(psrtpriv->silent_reset_inprogress == true) + if (psrtpriv->silent_reset_inprogress == true) { return status; } val32 =rtw_read32(padapter,REG_TXDMA_STATUS); - if(val32==0xeaeaeaea){ + if (val32==0xeaeaeaea){ psrtpriv->Wifi_Error_Status = WIFI_IF_NOT_EXIST; } - else if(val32!=0){ + else if (val32!=0){ DBG_8192C("txdmastatu(%x)\n",val32); psrtpriv->Wifi_Error_Status = WIFI_MAC_TXDMA_ERROR; } - if(WIFI_STATUS_SUCCESS !=psrtpriv->Wifi_Error_Status) + if (WIFI_STATUS_SUCCESS !=psrtpriv->Wifi_Error_Status) { DBG_8192C("==>%s error_status(0x%x)\n",__FUNCTION__,psrtpriv->Wifi_Error_Status); status = (psrtpriv->Wifi_Error_Status &( ~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL))); @@ -115,7 +115,7 @@ static void sreset_restore_security_station(struct adapter *padapter) rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); } - if((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || + if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) || (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) { psta = rtw_get_stainfo(pstapriv, get_bssid(mlmepriv)); @@ -144,8 +144,8 @@ static void sreset_restore_network_station(struct adapter *padapter) u8 threshold; /* TH=1 => means that invalidate usb rx aggregation */ /* TH=0 => means that validate usb rx aggregation, use init value. */ - if(mlmepriv->htpriv.ht_option) { - if(padapter->registrypriv.wifi_spec==1) + if (mlmepriv->htpriv.ht_option) { + if (padapter->registrypriv.wifi_spec==1) threshold = 1; else threshold = 0; diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index 2bc8fd6..231fafc 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -95,7 +95,7 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv) pstapriv->pallocated_stainfo_buf = rtw_zvmalloc (sizeof(struct sta_info) * NUM_STA+ 4); - if(!pstapriv->pallocated_stainfo_buf) + if (!pstapriv->pallocated_stainfo_buf) return _FAIL; pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 - @@ -207,7 +207,7 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) struct recv_reorder_ctrl *preorder_ctrl; int index; - if(pstapriv){ + if (pstapriv){ /* delete all reordering_ctrl_timer */ spin_lock_bh(&pstapriv->sta_hash_lock); for(index = 0; index < NUM_STA; index++) @@ -233,7 +233,7 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) rtw_mfree_sta_priv_lock(pstapriv); - if(pstapriv->pallocated_stainfo_buf) { + if (pstapriv->pallocated_stainfo_buf) { rtw_vmfree(pstapriv->pallocated_stainfo_buf, sizeof(struct sta_info)*NUM_STA+4); } } @@ -278,7 +278,7 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("rtw_alloc_stainfo: index = %x", index)); - if(index >= NUM_STA){ + if (index >= NUM_STA){ RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("ERROR=> rtw_alloc_stainfo: index >= NUM_STA")); psta= NULL; goto exit; @@ -505,7 +505,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) ; - if(pstapriv->asoc_sta_count==1) + if (pstapriv->asoc_sta_count==1) goto exit; spin_lock_bh(&pstapriv->sta_hash_lock); @@ -521,7 +521,7 @@ void rtw_free_all_stainfo(struct adapter *padapter) plist = get_next(plist); - if(pbcmc_stainfo!=psta) + if (pbcmc_stainfo!=psta) rtw_free_stainfo(padapter , psta); } @@ -553,10 +553,10 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) ; - if(hwaddr==NULL) + if (hwaddr==NULL) return NULL; - if(IS_MCAST(hwaddr)) + if (IS_MCAST(hwaddr)) { addr = bc_addr; } @@ -606,7 +606,7 @@ u32 rtw_init_bcmc_stainfo(struct adapter* padapter) psta = rtw_alloc_stainfo(pstapriv, bcast_addr); - if(psta==NULL){ + if (psta==NULL){ res=_FAIL; RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("rtw_alloc_stainfo fail")); goto exit; @@ -649,9 +649,9 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) paclnode = LIST_CONTAINOR(plist, struct rtw_wlan_acl_node, list); plist = get_next(plist); - if(_rtw_memcmp(paclnode->addr, mac_addr, ETH_ALEN)) + if (_rtw_memcmp(paclnode->addr, mac_addr, ETH_ALEN)) { - if(paclnode->valid == true) + if (paclnode->valid == true) { match = true; break; @@ -661,11 +661,11 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr) spin_unlock_bh(&(pacl_node_q->lock)); - if(pacl_list->mode == 1)/* accept unless in deny list */ + if (pacl_list->mode == 1)/* accept unless in deny list */ { res = (match == true) ? false:true; } - else if(pacl_list->mode == 2)/* deny unless in accept list */ + else if (pacl_list->mode == 2)/* deny unless in accept list */ { res = (match == true) ? true:false; } diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index 207e373..4e2f80c 100644 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -139,7 +139,7 @@ u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - if(pmlmeext->cur_channel > 14) + if (pmlmeext->cur_channel > 14) { if (pmlmeinfo->HT_enable) { @@ -159,7 +159,7 @@ u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen { network_type |= WIRELESS_11B; } - else if((cckrates_included(rate, ratelen)) == true) + else if ((cckrates_included(rate, ratelen)) == true) { network_type |= WIRELESS_11BG; } @@ -364,7 +364,7 @@ void Restore_DM_Func_Flag(struct adapter *padapter) void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable) { - if(enable == true) + if (enable == true) rtw_hal_set_hwreg(padapter, HW_VAR_DM_FUNC_SET, (u8 *)(&mode)); else rtw_hal_set_hwreg(padapter, HW_VAR_DM_FUNC_CLR, (u8 *)(&mode)); @@ -470,7 +470,7 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne DBG_871X( "[%s] ch = %d, offset = %d, bwmode = %d\n", __FUNCTION__, 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)) { /* SelectChannel(padapter, channel); */ center_ch = channel; @@ -539,7 +539,7 @@ int is_client_associated_to_ap(struct adapter *padapter) struct mlme_ext_priv *pmlmeext; struct mlme_ext_info *pmlmeinfo; - if(!padapter) + if (!padapter) return _FAIL; pmlmeext = &padapter->mlmeextpriv; @@ -743,7 +743,7 @@ int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_variable_ies struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - if(pmlmepriv->qospriv.qos_option==0) + if (pmlmepriv->qospriv.qos_option==0) { pmlmeinfo->WMM_enable = 0; return _FAIL; @@ -774,7 +774,7 @@ void WMMOnAssocRsp(struct adapter *padapter) acm_mask = 0; - if( pmlmeext->cur_wireless_mode == WIRELESS_11B) + if ( pmlmeext->cur_wireless_mode == WIRELESS_11B) aSifsTime = 10; else aSifsTime = 16; @@ -823,14 +823,14 @@ void WMMOnAssocRsp(struct adapter *padapter) DBG_871X("WMM(%x): %x, %x\n", ACI, ACM, acParm); } - if(padapter->registrypriv.acm_method == 1) + if (padapter->registrypriv.acm_method == 1) rtw_hal_set_hwreg(padapter, HW_VAR_ACM_CTRL, (u8 *)(&acm_mask)); else padapter->mlmepriv.acm_mask = acm_mask; inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3; - if(pregpriv->wifi_spec==1) + if (pregpriv->wifi_spec==1) { u32 j, tmp, change_inx; @@ -840,18 +840,18 @@ void WMMOnAssocRsp(struct adapter *padapter) for(j=i+1; j<4; j++) { /* compare CW and AIFS */ - if((edca[j] & 0xFFFF) < (edca[i] & 0xFFFF)) + 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)) + if ((edca[j] >> 16) > (edca[i] >> 16)) change_inx = true; } - if(change_inx) + if (change_inx) { tmp = edca[i]; edca[i] = edca[j]; @@ -886,17 +886,17 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var struct registry_priv *pregistrypriv = &padapter->registrypriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; - if(!pIE) + if (!pIE) return; - if(phtpriv->ht_option == false) return; + if (phtpriv->ht_option == false) return; - if(pIE->Length > sizeof(struct HT_info_element)) + if (pIE->Length > sizeof(struct HT_info_element)) return; pHT_info = (struct HT_info_element *)pIE->data; - if((pHT_info->infos[0] & BIT(2)) && pregistrypriv->cbw40_enable ) + if ((pHT_info->infos[0] & BIT(2)) && pregistrypriv->cbw40_enable ) { new_bwmode = HT_CHANNEL_WIDTH_40; @@ -923,7 +923,7 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var } - 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; @@ -939,7 +939,7 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var } - if(true == pmlmeinfo->bwmode_updated) + if (true == pmlmeinfo->bwmode_updated) { struct sta_info *psta; struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); @@ -950,11 +950,11 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var /* update ap's stainfo */ psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress); - if(psta) + if (psta) { struct ht_priv *phtpriv_sta = &psta->htpriv; - if(phtpriv_sta->ht_option) + if (phtpriv_sta->ht_option) { /* bwmode */ phtpriv_sta->bwmode = pmlmeext->cur_bwmode; @@ -981,9 +981,9 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_variable_ies * struct ht_priv *phtpriv = &pmlmepriv->htpriv; struct registry_priv *pregistrypriv = &padapter->registrypriv; - if(pIE==NULL) return; + if (pIE==NULL) return; - if(phtpriv->ht_option == false) return; + if (phtpriv->ht_option == false) return; pmlmeinfo->HT_caps_enable = 1; @@ -1030,7 +1030,7 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_variable_ies * /* update the MCS rates */ for (i = 0; i < 16; i++) { - if((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) + if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; else pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i]; @@ -1044,12 +1044,12 @@ void HT_info_handler(struct adapter *padapter, struct ndis_802_11_variable_ies * struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; - if(pIE==NULL) return; + if (pIE==NULL) return; - if(phtpriv->ht_option == false) return; + if (phtpriv->ht_option == false) return; - if(pIE->Length > sizeof(struct HT_info_element)) + if (pIE->Length > sizeof(struct HT_info_element)) return; pmlmeinfo->HT_info_enable = 1; @@ -1096,7 +1096,7 @@ void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_variable_ies * 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; @@ -1197,7 +1197,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) subtype = GetFrameSubType(pframe) >> 4; - if(subtype==WIFI_BEACON) + if (subtype==WIFI_BEACON) bssid->Reserved[0] = 1; bssid->Length = sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + len; @@ -1209,7 +1209,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) /* check bw and channel offset */ /* parsing HT_CAP_IE */ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); - if(p && len>0) { + if (p && len>0) { pht_cap = (struct ieee80211_ht_cap *)(p + 2); ht_cap_info = le16_to_cpu(pht_cap->cap_info); } else { @@ -1217,7 +1217,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) } /* parsing HT_INFO_IE */ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); - if(p && len>0) { + if (p && len>0) { pht_info = (struct HT_info_element *)(p + 2); ht_info_infos_0 = pht_info->infos[0]; } else { @@ -1245,7 +1245,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) bcn_channel = *(p + 2); } else {/* In 5G, some ap do not have DSSET IE checking HT info for channel */ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); - if(pht_info) { + if (pht_info) { bcn_channel = pht_info->primary_channel; } else { /* we don't find channel IE, so don't check it */ DBG_871X("Oops: %s we don't find channel IE, so don't check it\n", __func__); @@ -1266,7 +1266,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) hidden_ssid = false; } - if((NULL != p) && (false == hidden_ssid && (*(p + 1)))) { + if ((NULL != p) && (false == hidden_ssid && (*(p + 1)))) { memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1)); bssid->Ssid.SsidLength = *(p + 1); } else { @@ -1321,7 +1321,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) if (encryp_protocol == ENCRYP_PROTOCOL_WPA || encryp_protocol == ENCRYP_PROTOCOL_WPA2) { pbuf = rtw_get_wpa_ie(&bssid->IEs[12], &wpa_ielen, bssid->IELength-12); - if(pbuf && (wpa_ielen>0)) { + if (pbuf && (wpa_ielen>0)) { if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is_8021x)) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_, ("%s pnetwork->pairwise_cipher: %d, group_cipher is %d, is_8021x is %d\n", __func__, @@ -1330,7 +1330,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) } else { pbuf = rtw_get_wpa2_ie(&bssid->IEs[12], &wpa_ielen, bssid->IELength-12); - if(pbuf && (wpa_ielen>0)) { + if (pbuf && (wpa_ielen>0)) { if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is_8021x)) { RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_, ("%s pnetwork->pairwise_cipher: %d, pnetwork->group_cipher is %d, is_802x is %d\n", @@ -1672,7 +1672,7 @@ unsigned char get_highest_rate_idx(u32 mask) for(i=27; i>=0; i--) { - if(mask & BIT(i)) + if (mask & BIT(i)) { rate_idx = i; break; @@ -1727,7 +1727,7 @@ void update_tx_basic_rate(struct adapter *padapter, u8 wirelessmode) /* Added by Albert 2011/03/22 */ /* In the P2P mode, the driver should not support the b mode. */ /* So, the Tx packet shouldn't use the CCK rate */ - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) return; #endif /* CONFIG_P2P */ memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX); @@ -1808,7 +1808,7 @@ unsigned char check_assoc_AP(u8 *pframe, uint len) else if (_rtw_memcmp(pIE->data, EPIGRAM_OUI, 3)) { epigram_vendor_flag = 1; - if(ralink_vendor_flag) { + if (ralink_vendor_flag) { DBG_871X("link to Tenda W311R AP\n"); return HT_IOT_PEER_TENDA; } else { @@ -1879,12 +1879,12 @@ void update_capinfo(struct adapter *Adapter, u16 updateCap) /* Check preamble mode, 2005.01.06, by rcnjko. */ /* Mark to update preamble value forever, 2008.03.18 by lanhsin */ - /* if( pMgntInfo->RegPreambleMode == PREAMBLE_AUTO ) */ + /* if ( pMgntInfo->RegPreambleMode == PREAMBLE_AUTO ) */ { - if(updateCap & cShortPreamble) + if (updateCap & cShortPreamble) { /* Short Preamble */ - if(pmlmeinfo->preamble_mode != PREAMBLE_SHORT) /* PREAMBLE_LONG or PREAMBLE_AUTO */ + if (pmlmeinfo->preamble_mode != PREAMBLE_SHORT) /* PREAMBLE_LONG or PREAMBLE_AUTO */ { ShortPreamble = true; pmlmeinfo->preamble_mode = PREAMBLE_SHORT; @@ -1893,7 +1893,7 @@ void update_capinfo(struct adapter *Adapter, u16 updateCap) } else { /* Long Preamble */ - if(pmlmeinfo->preamble_mode != PREAMBLE_LONG) /* PREAMBLE_SHORT or PREAMBLE_AUTO */ + if (pmlmeinfo->preamble_mode != PREAMBLE_LONG) /* PREAMBLE_SHORT or PREAMBLE_AUTO */ { ShortPreamble = false; pmlmeinfo->preamble_mode = PREAMBLE_LONG; @@ -1909,24 +1909,24 @@ void update_capinfo(struct adapter *Adapter, u16 updateCap) 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) /* && (!(pMgntInfo->pHTInfo->RT2RT_HT_Mode & RT_HT_CAP_USE_LONG_PREAMBLE)) */) + if ( (updateCap & cShortSlotTime) /* && (!(pMgntInfo->pHTInfo->RT2RT_HT_Mode & RT_HT_CAP_USE_LONG_PREAMBLE)) */) { /* Short Slot Time */ - if(pmlmeinfo->slotTime != 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) + if (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; } @@ -1957,7 +1957,7 @@ void update_wireless_mode(struct adapter *padapter) pmlmeinfo->HT_enable = 1; } - if(pmlmeext->cur_channel > 14) + if (pmlmeext->cur_channel > 14) { if (pmlmeinfo->HT_enable) { @@ -1977,7 +1977,7 @@ void update_wireless_mode(struct adapter *padapter) { network_type |= WIRELESS_11B; } - else if((cckrates_included(rate, ratelen)) == true) + else if ((cckrates_included(rate, ratelen)) == true) { network_type |= WIRELESS_11BG; } @@ -2004,7 +2004,7 @@ void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id) struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - if(pmlmeext->cur_wireless_mode & WIRELESS_11B) + if (pmlmeext->cur_wireless_mode & WIRELESS_11B) { /* Only B, B/G, and B/G/N AP could use CCK rate */ memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), rtw_basic_rate_cck, 4); @@ -2054,7 +2054,7 @@ void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr) psta = rtw_get_stainfo(pstapriv, addr); - if(psta) { + if (psta) { start_seq = le16_to_cpu(preq->BA_starting_seqctrl) >> 4; param = le16_to_cpu(preq->BA_para_set); tid = (param>>2)&0x0f; diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 06935a6..096d524 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -174,7 +174,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) pxmitbuf->ext_tag = false; /* Tx buf allocation may fail sometimes, so sleep and retry. */ - if((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf,(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ))) == _FAIL) { + if ((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf,(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ))) == _FAIL) { rtw_msleep_os(10); res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf,(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ)); if (res == _FAIL) { @@ -262,7 +262,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter) pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), 4); */ - if((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf,max_xmit_extbuf_size + XMITBUF_ALIGN_SZ)) == _FAIL) { + if ((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf,max_xmit_extbuf_size + XMITBUF_ALIGN_SZ)) == _FAIL) { res= _FAIL; goto exit; } @@ -329,7 +329,7 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv) rtw_mfree_xmit_priv_lock(pxmitpriv); - if(pxmitpriv->pxmit_frame_buf==NULL) + if (pxmitpriv->pxmit_frame_buf==NULL) goto out; for(i=0; ipallocated_buf) */ + /* if (pxmitbuf->pallocated_buf) */ /* rtw_mfree(pxmitbuf->pallocated_buf, MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ); */ pxmitbuf++; } - if(pxmitpriv->pallocated_frame_buf) { + if (pxmitpriv->pallocated_frame_buf) { rtw_vmfree(pxmitpriv->pallocated_frame_buf, NR_XMITFRAME * sizeof(struct xmit_frame) + 4); } - if(pxmitpriv->pallocated_xmitbuf) { + if (pxmitpriv->pallocated_xmitbuf) { rtw_vmfree(pxmitpriv->pallocated_xmitbuf, NR_XMITBUFF * sizeof(struct xmit_buf) + 4); } @@ -374,13 +374,13 @@ void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv) { rtw_os_xmit_resource_free(padapter, pxmitbuf,(max_xmit_extbuf_size + XMITBUF_ALIGN_SZ)); - /* if(pxmitbuf->pallocated_buf) */ + /* if (pxmitbuf->pallocated_buf) */ /* rtw_mfree(pxmitbuf->pallocated_buf, max_xmit_extbuf_size); */ pxmitbuf++; } - if(pxmitpriv->pallocated_xmit_extbuf) { + if (pxmitpriv->pallocated_xmit_extbuf) { rtw_vmfree(pxmitpriv->pallocated_xmit_extbuf, num_xmit_extbuf * sizeof(struct xmit_buf) + 4); } @@ -402,7 +402,7 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - if(pattrib->psta) + if (pattrib->psta) { psta = pattrib->psta; } @@ -412,13 +412,13 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * psta=rtw_get_stainfo(&padapter->stapriv ,&pattrib->ra[0] ); } - if(psta==NULL) + if (psta==NULL) { DBG_871X("%s, psta==NUL\n", __func__); return; } - if(!(psta->state &_FW_LINKED)) + if (!(psta->state &_FW_LINKED)) { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); return; @@ -437,17 +437,17 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * /* (2) If there are more than one frag in this MSDU, only the first frag uses protection frame. */ /* Other fragments are protected by previous fragment. */ /* So we only need to check the length of first fragment. */ - if(pmlmeext->cur_wireless_mode < WIRELESS_11_24N || padapter->registrypriv.wifi_spec) + if (pmlmeext->cur_wireless_mode < WIRELESS_11_24N || padapter->registrypriv.wifi_spec) { - if(sz > padapter->registrypriv.rts_thresh) + if (sz > padapter->registrypriv.rts_thresh) { pattrib->vcs_mode = RTS_CTS; } else { - if(psta->rtsen) + if (psta->rtsen) pattrib->vcs_mode = RTS_CTS; - else if(psta->cts2self) + else if (psta->cts2self) pattrib->vcs_mode = CTS_TO_SELF; else pattrib->vcs_mode = NONE_VCS; @@ -458,7 +458,7 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * while (true) { /* IOT action */ - if((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_ATHEROS) && (pattrib->ampdu_en==true) && + if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_ATHEROS) && (pattrib->ampdu_en==true) && (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_ )) { pattrib->vcs_mode = CTS_TO_SELF; @@ -467,21 +467,21 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * /* check ERP protection */ - if(psta->rtsen || psta->cts2self) + if (psta->rtsen || psta->cts2self) { - if(psta->rtsen) + if (psta->rtsen) pattrib->vcs_mode = RTS_CTS; - else if(psta->cts2self) + else if (psta->cts2self) pattrib->vcs_mode = CTS_TO_SELF; break; } /* check HT op mode */ - if(pattrib->ht_en) + if (pattrib->ht_en) { u8 HTOpMode = pmlmeinfo->HT_protection; - if((pmlmeext->cur_bwmode && (HTOpMode == 2 || HTOpMode == 3)) || + if ((pmlmeext->cur_bwmode && (HTOpMode == 2 || HTOpMode == 3)) || (!pmlmeext->cur_bwmode && HTOpMode == 3) ) { pattrib->vcs_mode = RTS_CTS; @@ -490,7 +490,7 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * } /* check rts */ - if(sz > padapter->registrypriv.rts_thresh) + if (sz > padapter->registrypriv.rts_thresh) { pattrib->vcs_mode = RTS_CTS; break; @@ -499,7 +499,7 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * /* to do list: check MIMO power save condition. */ /* check AMPDU aggregation for TXOP */ - if(pattrib->ampdu_en==true) + if (pattrib->ampdu_en==true) { pattrib->vcs_mode = RTS_CTS; break; @@ -513,9 +513,9 @@ static void update_attrib_vcs_info(struct adapter *padapter, struct xmit_frame * static void update_attrib_phy_info(struct pkt_attrib *pattrib, struct sta_info *psta) { - /*if(psta->rtsen) + /*if (psta->rtsen) pattrib->vcs_mode = RTS_CTS; - else if(psta->cts2self) + else if (psta->cts2self) pattrib->vcs_mode = CTS_TO_SELF; else pattrib->vcs_mode = NONE_VCS;*/ @@ -544,7 +544,7 @@ u8 qos_acm(u8 acm_mask, u8 priority) { case 0: case 3: - if(acm_mask & BIT(1)) + if (acm_mask & BIT(1)) change_priority = 1; break; case 1: @@ -552,12 +552,12 @@ u8 qos_acm(u8 acm_mask, u8 priority) break; case 4: case 5: - if(acm_mask & BIT(2)) + if (acm_mask & BIT(2)) change_priority = 0; break; case 6: case 7: - if(acm_mask & BIT(3)) + if (acm_mask & BIT(3)) change_priority = 5; break; default: @@ -684,7 +684,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p res =_FAIL; goto exit; } - else if((check_fwstate(pmlmepriv, WIFI_AP_STATE)==true)&&(!(psta->state & _FW_LINKED))) + else if ((check_fwstate(pmlmepriv, WIFI_AP_STATE)==true)&&(!(psta->state & _FW_LINKED))) { res =_FAIL; goto exit; @@ -718,16 +718,16 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p if (check_fwstate(pmlmepriv, WIFI_AP_STATE|WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) { - if(psta->qos_option) + if (psta->qos_option) set_qos(&pktfile, pattrib); } else { - if(pqospriv->qos_option) + if (pqospriv->qos_option) { set_qos(&pktfile, pattrib); - if(pmlmepriv->acm_mask != 0) + if (pmlmepriv->acm_mask != 0) { pattrib->priority = qos_acm(pmlmepriv->acm_mask, pattrib->priority); } @@ -738,7 +738,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p pattrib->encrypt = 0; - if((pattrib->ether_type != 0x888e) && (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false)) + if ((pattrib->ether_type != 0x888e) && (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false)) { RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("\npsta->ieee8021x_blocked == true, pattrib->ether_type(%.4x) != 0x888e\n",pattrib->ether_type)); #ifdef DBG_TX_DROP_FRAME @@ -760,7 +760,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p pattrib->key_idx = (u8)psecuritypriv->dot11PrivacyKeyIndex; break; case dot11AuthAlgrthm_8021X: - if(bmcast) + if (bmcast) pattrib->key_idx = (u8)psecuritypriv->dot118021XGrpKeyid; else pattrib->key_idx = 0; @@ -785,7 +785,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p pattrib->iv_len = 8; pattrib->icv_len = 4; - if(padapter->securitypriv.busetkipkey==_FAIL) + if (padapter->securitypriv.busetkipkey==_FAIL) { RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("\npadapter->securitypriv.busetkipkey(%d)==_FAIL drop packet\n", padapter->securitypriv.busetkipkey)); #ifdef DBG_TX_DROP_FRAME @@ -841,7 +841,7 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr u8 hw_hdr_offset = 0; sint bmcst = IS_MCAST(pattrib->ra); - if(pattrib->psta) + if (pattrib->psta) { stainfo = pattrib->psta; } @@ -851,13 +851,13 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr stainfo=rtw_get_stainfo(&padapter->stapriv ,&pattrib->ra[0]); } - if(stainfo==NULL) + if (stainfo==NULL) { DBG_871X("%s, psta==NUL\n", __func__); return _FAIL; } - if(!(stainfo->state &_FW_LINKED)) + if (!(stainfo->state &_FW_LINKED)) { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); return _FAIL; @@ -867,17 +867,17 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr hw_hdr_offset = TXDESC_SIZE + (pxmitframe->pkt_offset * PACKET_OFFSET_SZ);; - if(pattrib->encrypt ==_TKIP_)/* if(psecuritypriv->dot11PrivacyAlgrthm==_TKIP_PRIVACY_) */ + if (pattrib->encrypt ==_TKIP_)/* if (psecuritypriv->dot11PrivacyAlgrthm==_TKIP_PRIVACY_) */ { /* encode mic code */ - if(stainfo!= NULL){ + if (stainfo!= NULL){ u8 null_key[16]={0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}; pframe = pxmitframe->buf_addr + hw_hdr_offset; - if(bmcst) + if (bmcst) { - if(_rtw_memcmp(psecuritypriv->dot118021XGrptxmickey[psecuritypriv->dot118021XGrpKeyid].skey, null_key, 16)==true){ + if (_rtw_memcmp(psecuritypriv->dot118021XGrptxmickey[psecuritypriv->dot118021XGrpKeyid].skey, null_key, 16)==true){ /* DbgPrint("\nxmitframe_addmic:stainfo->dot11tkiptxmickey==0\n"); */ /* rtw_msleep_os(10); */ return _FAIL; @@ -887,7 +887,7 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr } else { - if(_rtw_memcmp(&stainfo->dot11tkiptxmickey.skey[0],null_key, 16)==true){ + if (_rtw_memcmp(&stainfo->dot11tkiptxmickey.skey[0],null_key, 16)==true){ /* DbgPrint("\nxmitframe_addmic:stainfo->dot11tkiptxmickey==0\n"); */ /* rtw_msleep_os(10); */ return _FAIL; @@ -896,23 +896,23 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr rtw_secmicsetkey(&micdata, &stainfo->dot11tkiptxmickey.skey[0]); } - if(pframe[1]&1){ /* ToDS==1 */ + if (pframe[1]&1){ /* ToDS==1 */ rtw_secmicappend(&micdata, &pframe[16], 6); /* DA */ - if(pframe[1]&2) /* From Ds==1 */ + if (pframe[1]&2) /* From Ds==1 */ rtw_secmicappend(&micdata, &pframe[24], 6); else rtw_secmicappend(&micdata, &pframe[10], 6); } else{ /* ToDS==0 */ rtw_secmicappend(&micdata, &pframe[4], 6); /* DA */ - if(pframe[1]&2) /* From Ds==1 */ + if (pframe[1]&2) /* From Ds==1 */ rtw_secmicappend(&micdata, &pframe[16], 6); else rtw_secmicappend(&micdata, &pframe[10], 6); } - /* if(pqospriv->qos_option==1) */ - if(pattrib->qos_en) + /* if (pqospriv->qos_option==1) */ + if (pattrib->qos_en) priority[0]=(u8)pxmitframe->attrib.priority; @@ -927,7 +927,7 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr payload=payload+pattrib->hdrlen+pattrib->iv_len; RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("curfragnum=%d pattrib->hdrlen=%d pattrib->iv_len=%d",curfragnum,pattrib->hdrlen,pattrib->iv_len)); - if((curfragnum+1)==pattrib->nr_frags){ + if ((curfragnum+1)==pattrib->nr_frags){ length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len-( (pattrib->bswenc) ? pattrib->icv_len : 0); rtw_secmicappend(&micdata, payload,length); payload=payload+length; @@ -974,8 +974,8 @@ static s32 xmitframe_swencrypt(struct adapter *padapter, struct xmit_frame *pxmi ; - /* if((psecuritypriv->sw_encrypt)||(pattrib->bswenc)) */ - if(pattrib->bswenc) + /* if ((psecuritypriv->sw_encrypt)||(pattrib->bswenc)) */ + if (pattrib->bswenc) { /* DBG_871X("start xmitframe_swencrypt\n"); */ RT_TRACE(_module_rtl871x_xmit_c_,_drv_alert_,("### xmitframe_swencrypt\n")); @@ -1025,20 +1025,20 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat psta = pattrib->psta; } else { DBG_871X("%s, call rtw_get_stainfo()\n", __func__); - if(bmcst) { + if (bmcst) { psta = rtw_get_bcmc_stainfo(padapter); } else { psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); } } - if(psta==NULL) + if (psta==NULL) { DBG_871X("%s, psta==NUL\n", __func__); return _FAIL; } - if(!(psta->state &_FW_LINKED)) + if (!(psta->state &_FW_LINKED)) { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); return _FAIL; @@ -1069,7 +1069,7 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN); memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN); - if(psta->qos_option) + if (psta->qos_option) qos_option = true; } else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) || @@ -1078,7 +1078,7 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN); - if(psta->qos_option) + if (psta->qos_option) qos_option = true; } else { @@ -1087,7 +1087,7 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat goto exit; } - if(pattrib->mdata) + if (pattrib->mdata) SetMData(fctrl); if (pattrib->encrypt) @@ -1109,7 +1109,7 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat /* Update Seq Num will be handled by f/w */ { - if(psta){ + if (psta){ psta->sta_xmitpriv.txseq_tid[pattrib->priority]++; psta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; @@ -1119,26 +1119,26 @@ s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pat SetSeqNum(hdr, pattrib->seqnum); /* check if enable ampdu */ - if(pattrib->ht_en && psta->htpriv.ampdu_enable) + if (pattrib->ht_en && psta->htpriv.ampdu_enable) { - if(psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) + if (psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) pattrib->ampdu_en = true; } /* re-check if enable ampdu by BA_starting_seqctrl */ - if(pattrib->ampdu_en == true) + if (pattrib->ampdu_en == true) { u16 tx_seq; tx_seq = psta->BA_starting_seqctrl[pattrib->priority & 0x0f]; /* check BA_starting_seqctrl */ - if(SN_LESS(pattrib->seqnum, tx_seq)) + if (SN_LESS(pattrib->seqnum, tx_seq)) { /* DBG_871X("tx ampdu seqnum(%d) < tx_seq(%d)\n", pattrib->seqnum, tx_seq); */ pattrib->ampdu_en = false;/* AGG BK */ } - else if(SN_EQUAL(pattrib->seqnum, tx_seq)) + else if (SN_EQUAL(pattrib->seqnum, tx_seq)) { psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (tx_seq+1)&0xfff; @@ -1184,7 +1184,7 @@ s32 rtw_txframes_sta_ac_pending(struct adapter *padapter, struct pkt_attrib *pat struct tx_servq *ptxservq; int priority = pattrib->priority; - if(pattrib->psta) + if (pattrib->psta) { psta = pattrib->psta; } @@ -1194,13 +1194,13 @@ s32 rtw_txframes_sta_ac_pending(struct adapter *padapter, struct pkt_attrib *pat psta=rtw_get_stainfo(&padapter->stapriv ,&pattrib->ra[0]); } - if(psta==NULL) + if (psta==NULL) { DBG_871X("%s, psta==NUL\n", __func__); return 0; } - if(!(psta->state &_FW_LINKED)) + if (!(psta->state &_FW_LINKED)) { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); return 0; @@ -1294,7 +1294,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); } - if(psta==NULL) + if (psta==NULL) { DBG_871X("%s, psta==NUL\n", __func__); @@ -1302,7 +1302,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct } - if(!(psta->state &_FW_LINKED)) + if (!(psta->state &_FW_LINKED)) { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); return _FAIL; @@ -1362,13 +1362,13 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); break; case _TKIP_: - if(bmcst) + if (bmcst) TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); else TKIP_IV(pattrib->iv, psta->dot11txpn, 0); break; case _AES_: - if(bmcst) + if (bmcst) AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); else AES_IV(pattrib->iv, psta->dot11txpn, 0); @@ -1445,7 +1445,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct xmitframe_swencrypt(padapter, pxmitframe); - if(bmcst == false) + if (bmcst == false) update_attrib_vcs_info(padapter, pxmitframe); else pattrib->vcs_mode = NONE_VCS; @@ -1490,23 +1490,23 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s tmp_buf = BIP_AAD = rtw_zmalloc(ori_len); subtype = GetFrameSubType(pframe); /* bit(7)~bit(2) */ - if(BIP_AAD == NULL) + if (BIP_AAD == NULL) return _FAIL; spin_lock_bh(&padapter->security_key_mutex); /* only support station mode */ - if(!check_fwstate(pmlmepriv, WIFI_STATION_STATE) || !check_fwstate(pmlmepriv, _FW_LINKED)) + if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE) || !check_fwstate(pmlmepriv, _FW_LINKED)) goto xmitframe_coalesce_success; /* IGTK key is not install, it may not support 802.11w */ - if(padapter->securitypriv.binstallBIPkey != true) + if (padapter->securitypriv.binstallBIPkey != true) { DBG_871X("no instll BIP key\n"); goto xmitframe_coalesce_success; } /* station mode doesn't need TX BIP, just ready the code */ - if(bmcst) + if (bmcst) { int frame_body_len; u8 mic[16]; @@ -1514,7 +1514,7 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s memset(MME, 0, 18); /* other types doesn't need the BIP */ - if(GetFrameSubType(pframe) != WIFI_DEAUTH && GetFrameSubType(pframe) != WIFI_DISASSOC) + if (GetFrameSubType(pframe) != WIFI_DEAUTH && GetFrameSubType(pframe) != WIFI_DISASSOC) goto xmitframe_coalesce_fail; MGMT_body = pframe + sizeof(struct rtw_ieee80211_hdr_3addr); @@ -1551,7 +1551,7 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s printk("\n"); }*/ /* calculate mic */ - if(omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey + if (omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey , BIP_AAD, BIP_AAD_SIZE+frame_body_len, mic)) goto xmitframe_coalesce_fail; @@ -1577,7 +1577,7 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s else /* unicast mgmt frame TX */ { /* start to encrypt mgmt frame */ - if(subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC || + if (subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC || subtype == WIFI_REASSOCREQ || subtype == WIFI_ACTION) { if (pattrib->psta) @@ -1587,14 +1587,14 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); } - if(psta==NULL) + if (psta==NULL) { DBG_871X("%s, psta==NUL\n", __func__); goto xmitframe_coalesce_fail; } - if(!(psta->state & _FW_LINKED) || pxmitframe->buf_addr==NULL) + if (!(psta->state & _FW_LINKED) || pxmitframe->buf_addr==NULL) { DBG_871X("%s, not _FW_LINKED or addr null\n", __func__); goto xmitframe_coalesce_fail; @@ -1602,7 +1602,7 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s /* DBG_871X("%s, action frame category=%d\n", __func__, pframe[WLAN_HDR_A3_LEN]); */ /* according 802.11-2012 standard, these five types are not robust types */ - if(subtype == WIFI_ACTION && + if (subtype == WIFI_ACTION && (pframe[WLAN_HDR_A3_LEN] == RTW_WLAN_CATEGORY_PUBLIC || pframe[WLAN_HDR_A3_LEN] == RTW_WLAN_CATEGORY_HT || pframe[WLAN_HDR_A3_LEN] == RTW_WLAN_CATEGORY_UNPROTECTED_WNM || @@ -1749,7 +1749,7 @@ void rtw_update_protection(struct adapter *padapter, u8 *ie, uint ie_len) case AUTO_VCS: default: perp = rtw_get_ie(ie, _ERPINFO_IE_, &erp_len, ie_len); - if(perp == NULL) + if (perp == NULL) { pxmitpriv->vcs = NONE_VCS; } @@ -1758,7 +1758,7 @@ void rtw_update_protection(struct adapter *padapter, u8 *ie, uint ie_len) protection = (*(perp + 2)) & BIT(1); if (protection) { - if(pregistrypriv->vcs_type == RTS_CTS) + if (pregistrypriv->vcs_type == RTS_CTS) pxmitpriv->vcs = RTS_CTS; else pxmitpriv->vcs = CTS_TO_SELF; @@ -1804,7 +1804,7 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv) spin_lock_irqsave(&pfree_queue->lock, flags); - if(_rtw_queue_empty(pfree_queue) == true) { + if (_rtw_queue_empty(pfree_queue) == true) { pxmitbuf = NULL; } else { @@ -1845,7 +1845,7 @@ s32 rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) struct __queue *pfree_queue = &pxmitpriv->free_xmit_extbuf_queue; unsigned long flags; - if(pxmitbuf==NULL) + if (pxmitbuf==NULL) return _FAIL; spin_lock_irqsave(&pfree_queue->lock, flags); @@ -1876,7 +1876,7 @@ struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv) spin_lock_irqsave(&pfree_xmitbuf_queue->lock, flags); - if(_rtw_queue_empty(pfree_xmitbuf_queue) == true) { + if (_rtw_queue_empty(pfree_xmitbuf_queue) == true) { pxmitbuf = NULL; } else { @@ -1921,7 +1921,7 @@ s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) struct __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue; unsigned long flags; - if(pxmitbuf==NULL) + if (pxmitbuf==NULL) return _FAIL; if (pxmitbuf->sctx) { @@ -1929,7 +1929,7 @@ s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_FREE); } - if(pxmitbuf->ext_tag) { + if (pxmitbuf->ext_tag) { rtw_free_xmitbuf_ext(pxmitpriv, pxmitbuf); } else { spin_lock_irqsave(&pfree_xmitbuf_queue->lock, flags); @@ -2110,7 +2110,7 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram if (pxmitframe->ext_tag == 0) queue = &pxmitpriv->free_xmit_queue; - else if(pxmitframe->ext_tag == 1) + else if (pxmitframe->ext_tag == 1) queue = &pxmitpriv->free_xframe_ext_queue; else {} @@ -2122,7 +2122,7 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram if (pxmitframe->ext_tag == 0) { pxmitpriv->free_xmitframe_cnt++; RT_TRACE(_module_rtl871x_xmit_c_, _drv_debug_, ("rtw_free_xmitframe():free_xmitframe_cnt=%d\n", pxmitpriv->free_xmitframe_cnt)); - } else if(pxmitframe->ext_tag == 1) { + } else if (pxmitframe->ext_tag == 1) { pxmitpriv->free_xframe_ext_cnt++; RT_TRACE(_module_rtl871x_xmit_c_, _drv_debug_, ("rtw_free_xmitframe():free_xframe_ext_cnt=%d\n", pxmitpriv->free_xframe_ext_cnt)); } else { @@ -2132,7 +2132,7 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram check_pkt_complete: - if(pndis_pkt) + if (pndis_pkt) rtw_os_pkt_complete(padapter, pndis_pkt); exit: @@ -2220,7 +2220,7 @@ struct xmit_frame* rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3; - if(pregpriv->wifi_spec==1) + if (pregpriv->wifi_spec==1) { int j, tmp, acirp_cnt[4]; for(j=0; j<4; j++) @@ -2245,11 +2245,11 @@ struct xmit_frame* rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmi pxmitframe = dequeue_one_xmitframe(pxmitpriv, phwxmit, ptxservq, pframe_queue); - if(pxmitframe) { + if (pxmitframe) { phwxmit->accnt--; /* Remove sta node when there is no pending packets. */ - if(_rtw_queue_empty(pframe_queue)) /* must be done after get_next and before break */ + if (_rtw_queue_empty(pframe_queue)) /* must be done after get_next and before break */ rtw_list_delete(&ptxservq->tx_pending); goto exit; } @@ -2342,7 +2342,7 @@ s32 rtw_xmit_classifier(struct adapter *padapter, struct xmit_frame *pxmitframe) goto exit; } - if(!(psta->state &_FW_LINKED)) + if (!(psta->state &_FW_LINKED)) { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); return _FAIL; @@ -2374,7 +2374,7 @@ void rtw_alloc_hwxmits(struct adapter *padapter) hwxmits = pxmitpriv->hwxmits; - if(pxmitpriv->hwxmit_entry == 5) + if (pxmitpriv->hwxmit_entry == 5) { /* pxmitpriv->bmc_txqueue.head = 0; */ /* hwxmits[0] .phwtxqueue = &pxmitpriv->bmc_txqueue; */ @@ -2397,7 +2397,7 @@ void rtw_alloc_hwxmits(struct adapter *padapter) hwxmits[4] .sta_queue = &pxmitpriv->be_pending; } - else if(pxmitpriv->hwxmit_entry == 4) + else if (pxmitpriv->hwxmit_entry == 4) { /* pxmitpriv->vo_txqueue.head = 0; */ @@ -2431,7 +2431,7 @@ void rtw_free_hwxmits(struct adapter *padapter) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; hwxmits = pxmitpriv->hwxmits; - if(hwxmits) + if (hwxmits) rtw_mfree((u8 *)hwxmits, (sizeof (struct hw_xmit) * pxmitpriv->hwxmit_entry)); } @@ -2454,7 +2454,7 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) { struct sk_buff *skb = *pskb; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - /* if(check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) */ + /* if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) */ { int res, is_vlan_tag=0, i, do_nat25=1; unsigned short vlan_hdr=0; @@ -2702,7 +2702,7 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt) rcu_read_unlock(); #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */ - if( br_port && check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) + if ( br_port && check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) { res = rtw_br_client_tx(padapter, ppkt); if (res == -1) @@ -2732,7 +2732,7 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt) #ifdef CONFIG_AP_MODE spin_lock_bh(&pxmitpriv->lock); - if(xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe) == true) + if (xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe) == true) { spin_unlock_bh(&pxmitpriv->lock); return 1; @@ -2760,7 +2760,7 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == false) return ret; - if(pattrib->psta) + if (pattrib->psta) { psta = pattrib->psta; } @@ -2770,25 +2770,25 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr psta=rtw_get_stainfo(pstapriv, pattrib->ra); } - if(psta==NULL) + if (psta==NULL) { DBG_871X("%s, psta==NUL\n", __func__); return false; } - if(!(psta->state &_FW_LINKED)) + if (!(psta->state &_FW_LINKED)) { DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); return false; } - if(pattrib->triggered==1) + if (pattrib->triggered==1) { /* DBG_871X("directly xmit pspoll_triggered packet\n"); */ /* pattrib->triggered=0; */ - if(bmcst) + if (bmcst) pattrib->qsel = 0x11;/* HIQ */ @@ -2796,11 +2796,11 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr } - if(bmcst) + if (bmcst) { spin_lock_bh(&psta->sleep_q.lock); - if(pstapriv->sta_dz_bitmap)/* if anyone sta is in ps mode */ + if (pstapriv->sta_dz_bitmap)/* if anyone sta is in ps mode */ { rtw_list_delete(&pxmitframe->list); @@ -2824,11 +2824,11 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr spin_lock_bh(&psta->sleep_q.lock); - if(psta->state&WIFI_SLEEP_STATE) + if (psta->state&WIFI_SLEEP_STATE) { u8 wmmps_ac=0; - if(pstapriv->sta_dz_bitmap&BIT(psta->aid)) + if (pstapriv->sta_dz_bitmap&BIT(psta->aid)) { rtw_list_delete(&pxmitframe->list); @@ -2859,16 +2859,16 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr break; } - if(wmmps_ac) + if (wmmps_ac) psta->sleepq_ac_len++; - if(((psta->has_legacy_ac) && (!wmmps_ac)) ||((!psta->has_legacy_ac)&&(wmmps_ac))) + if (((psta->has_legacy_ac) && (!wmmps_ac)) ||((!psta->has_legacy_ac)&&(wmmps_ac))) { pstapriv->tim_bitmap |= BIT(psta->aid); /* DBG_871X("enqueue, sq_len=%d, tim=%x\n", psta->sleepq_len, pstapriv->tim_bitmap); */ - if(psta->sleepq_len==1) + if (psta->sleepq_len==1) { /* DBG_871X("sleepq_len==1, update BCNTIM\n"); */ /* upate BCN for TIM IE */ @@ -2878,7 +2878,7 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr /* spin_unlock_bh(&psta->sleep_q.lock); */ - /* if(psta->sleepq_len > (NR_XMITFRAME>>3)) */ + /* if (psta->sleepq_len > (NR_XMITFRAME>>3)) */ /* */ /* wakeup_sta_to_xmit(padapter, psta); */ /* */ @@ -2916,7 +2916,7 @@ static void dequeue_xmitframes_to_sleeping_queue(struct adapter *padapter, struc ret = xmitframe_enqueue_for_sleeping_sta(padapter, pxmitframe); - if(true == ret) + if (true == ret) { pattrib = &pxmitframe->attrib; @@ -3023,15 +3023,15 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) } psta->sleepq_len--; - if(psta->sleepq_len>0) + if (psta->sleepq_len>0) pxmitframe->attrib.mdata = 1; else pxmitframe->attrib.mdata = 0; - if(wmmps_ac) + if (wmmps_ac) { psta->sleepq_ac_len--; - if(psta->sleepq_ac_len>0) + if (psta->sleepq_ac_len>0) { pxmitframe->attrib.mdata = 1; pxmitframe->attrib.eosp = 0; @@ -3047,7 +3047,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) /* spin_unlock_bh(&psta->sleep_q.lock); - if(rtw_hal_xmit(padapter, pxmitframe) == true) + if (rtw_hal_xmit(padapter, pxmitframe) == true) { rtw_os_xmit_complete(padapter, pxmitframe); } @@ -3059,10 +3059,10 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) } /* for BC/MC Frames */ - if(!psta_bmc) + if (!psta_bmc) goto _exit; - if((pstapriv->sta_dz_bitmap&0xfffe) == 0x0)/* no any sta in ps mode */ + if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0)/* no any sta in ps mode */ { xmitframe_phead = get_list_head(&psta_bmc->sleep_q); xmitframe_plist = get_next(xmitframe_phead); @@ -3076,7 +3076,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) rtw_list_delete(&pxmitframe->list); psta_bmc->sleepq_len--; - if(psta_bmc->sleepq_len>0) + if (psta_bmc->sleepq_len>0) pxmitframe->attrib.mdata = 1; else pxmitframe->attrib.mdata = 0; @@ -3085,7 +3085,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) pxmitframe->attrib.triggered = 1; /* spin_unlock_bh(&psta_bmc->sleep_q.lock); - if(rtw_hal_xmit(padapter, pxmitframe) == true) + if (rtw_hal_xmit(padapter, pxmitframe) == true) { rtw_os_xmit_complete(padapter, pxmitframe); } @@ -3096,7 +3096,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) } - if(psta_bmc->sleepq_len==0) + if (psta_bmc->sleepq_len==0) { pstapriv->tim_bitmap &= ~BIT(0); pstapriv->sta_dz_bitmap &= ~BIT(0); @@ -3109,7 +3109,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) } - if(psta->sleepq_len==0) + if (psta->sleepq_len==0) { pstapriv->tim_bitmap &= ~BIT(psta->aid); @@ -3118,10 +3118,10 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta) /* update_BCNTIM(padapter); */ update_mask = BIT(0); - if(psta->state&WIFI_SLEEP_STATE) + if (psta->state&WIFI_SLEEP_STATE) psta->state ^= WIFI_SLEEP_STATE; - if(psta->state & WIFI_STA_ALIVE_CHK_STATE) + if (psta->state & WIFI_STA_ALIVE_CHK_STATE) { psta->expire_to = pstapriv->expire_to; psta->state ^= WIFI_STA_ALIVE_CHK_STATE; @@ -3135,7 +3135,7 @@ _exit: /* spin_unlock_bh(&psta_bmc->sleep_q.lock); */ spin_unlock_bh(&pxmitpriv->lock); - if(update_mask) + if (update_mask) { /* update_BCNTIM(padapter); */ /* printk("%s => call update_beacon\n",__FUNCTION__); */ @@ -3185,7 +3185,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst break; } - if(!wmmps_ac) + if (!wmmps_ac) continue; rtw_list_delete(&pxmitframe->list); @@ -3193,7 +3193,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst psta->sleepq_len--; psta->sleepq_ac_len--; - if(psta->sleepq_ac_len>0) { + if (psta->sleepq_ac_len>0) { pxmitframe->attrib.mdata = 1; pxmitframe->attrib.eosp = 0; } else { @@ -3205,7 +3205,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst rtw_hal_xmitframe_enqueue(padapter, pxmitframe); - if((psta->sleepq_ac_len==0) && (!psta->has_legacy_ac) && (wmmps_ac)) + if ((psta->sleepq_ac_len==0) && (!psta->has_legacy_ac) && (wmmps_ac)) { pstapriv->tim_bitmap &= ~BIT(psta->aid); diff --git a/hal/Hal8188ERateAdaptive.c b/hal/Hal8188ERateAdaptive.c index ed1d36e..88c909e 100644 --- a/hal/Hal8188ERateAdaptive.c +++ b/hal/Hal8188ERateAdaptive.c @@ -113,7 +113,7 @@ odm_SetTxRPTTiming_8188E( u8 idx = 0; for(idx=0; idx<5; idx++) - if(DynamicTxRPTTiming[idx] == pRaInfo->RptTime) + if (DynamicTxRPTTiming[idx] == pRaInfo->RptTime) break; if (extend==0) /* back to default timing */ @@ -124,7 +124,7 @@ odm_SetTxRPTTiming_8188E( idx=5; } else if (extend==2) {/* decrease the timing */ - if(idx!=0) + if (idx!=0) idx-=1; } pRaInfo->RptTime=DynamicTxRPTTiming[idx]; @@ -142,7 +142,7 @@ odm_RateDown_8188E( u8 i; ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateDown_8188E()\n")); - if(NULL == pRaInfo) + if (NULL == pRaInfo) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateDown_8188E(): pRaInfo is NULL\n")); return -1; @@ -158,7 +158,7 @@ odm_RateDown_8188E( { RateID=HighestRate; } - else if(pRaInfo->RateSGI) + else if (pRaInfo->RateSGI) { pRaInfo->RateSGI=0; } @@ -186,14 +186,14 @@ RateDownFinish: pRaInfo->RAWaitingCounter+=1; pRaInfo->RAPendingCounter+=1; } - else if(pRaInfo->RAWaitingCounter==0){ + else if (pRaInfo->RAWaitingCounter==0){ } else{ pRaInfo->RAWaitingCounter=0; pRaInfo->RAPendingCounter=0; } - if(pRaInfo->RAPendingCounter>=4) + if (pRaInfo->RAPendingCounter>=4) pRaInfo->RAPendingCounter=4; pRaInfo->DecisionRate=RateID; @@ -215,7 +215,7 @@ odm_RateUp_8188E( u8 i; ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_RateUp_8188E()\n")); - if(NULL == pRaInfo) + if (NULL == pRaInfo) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("odm_RateUp_8188E(): pRaInfo is NULL\n")); return -1; @@ -247,21 +247,21 @@ odm_RateUp_8188E( } } } - else if(RateID == HighestRate) + else if (RateID == HighestRate) { if (pRaInfo->SGIEnable && (pRaInfo->RateSGI != 1)) pRaInfo->RateSGI = 1; - else if((pRaInfo->SGIEnable) !=1 ) + else if ((pRaInfo->SGIEnable) !=1 ) pRaInfo->RateSGI = 0; } - else /* if((sta_info_ra->Decision_rate) > (sta_info_ra->Highest_rate)) */ + else /* if ((sta_info_ra->Decision_rate) > (sta_info_ra->Highest_rate)) */ { RateID = HighestRate; } RateUpfinish: - /* if(pRaInfo->RAWaitingCounter==10) */ - if(pRaInfo->RAWaitingCounter==(4+PendingForRateUpFail[pRaInfo->RAPendingCounter])) + /* if (pRaInfo->RAWaitingCounter==10) */ + if (pRaInfo->RAWaitingCounter==(4+PendingForRateUpFail[pRaInfo->RAPendingCounter])) pRaInfo->RAWaitingCounter=0; else pRaInfo->RAWaitingCounter++; @@ -351,7 +351,7 @@ odm_RateDecision_8188E( else if (pRaInfo->NscUp > N_THRESHOLD_HIGH[RateID]) odm_RateUp_8188E(pDM_Odm,pRaInfo); - if(pRaInfo->DecisionRate > pRaInfo->HighestRate) + if (pRaInfo->DecisionRate > pRaInfo->HighestRate) pRaInfo->DecisionRate = pRaInfo->HighestRate; if ((pRaInfo->DecisionRate)==(pRaInfo->PreRate)) @@ -428,7 +428,7 @@ odm_ARFBRefresh_8188E( if (pRaInfo->RAUseRate){ for (i=RATESIZE;i>=0;i--) { - if((pRaInfo->RAUseRate)&BIT(i)){ + if ((pRaInfo->RAUseRate)&BIT(i)){ pRaInfo->HighestRate=i; break; } @@ -441,7 +441,7 @@ odm_ARFBRefresh_8188E( if (pRaInfo->RAUseRate){ for (i=0;iRAUseRate)&BIT(i)) + if ((pRaInfo->RAUseRate)&BIT(i)) { pRaInfo->LowestRate=i; break; @@ -455,9 +455,9 @@ odm_ARFBRefresh_8188E( #if POWER_TRAINING_ACTIVE == 1 if (pRaInfo->HighestRate >0x13) pRaInfo->PTModeSS=3; - else if(pRaInfo->HighestRate >0x0b) + else if (pRaInfo->HighestRate >0x0b) pRaInfo->PTModeSS=2; - else if(pRaInfo->HighestRate >0x0b) + else if (pRaInfo->HighestRate >0x0b) pRaInfo->PTModeSS=1; else pRaInfo->PTModeSS=0; @@ -466,7 +466,7 @@ odm_ARFBRefresh_8188E( #endif - if(pRaInfo->DecisionRate > pRaInfo->HighestRate) + if (pRaInfo->DecisionRate > pRaInfo->HighestRate) pRaInfo->DecisionRate = pRaInfo->HighestRate; ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, @@ -515,7 +515,7 @@ odm_PTTryState_8188E( { if (pRaInfo->PTStage==0) pRaInfo->PTStage=1; - else if(pRaInfo->PTStage==1) + else if (pRaInfo->PTStage==1) pRaInfo->PTStage=3; else pRaInfo->PTStage=5; @@ -554,7 +554,7 @@ odm_PTDecision_8188E( for(j=0;j<=4;j++) { numsc += pRaInfo->RTY[j] * PT_PENALTY[j]; - if(numsc>num_total) + if (numsc>num_total) break; } @@ -588,7 +588,7 @@ odm_RATxRPTTimerSetting( ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE,(" =====>odm_RATxRPTTimerSetting()\n")); - if(pDM_Odm->CurrminRptTime != minRptTime){ + if (pDM_Odm->CurrminRptTime != minRptTime){ ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, (" CurrminRptTime =0x%04x minRptTime=0x%04x\n", pDM_Odm->CurrminRptTime, minRptTime)); rtw_rpt_timer_cfg_cmd(pDM_Odm->Adapter,minRptTime); @@ -622,16 +622,16 @@ ODM_RAInfo_Init( PODM_RA_INFO_T pRaInfo = &pDM_Odm->RAInfo[MacID]; u8 WirelessMode=0xFF; /* invalid value */ u8 max_rate_idx = 0x13; /* MCS7 */ - if(pDM_Odm->pWirelessMode!=NULL){ + if (pDM_Odm->pWirelessMode!=NULL){ WirelessMode=*(pDM_Odm->pWirelessMode); } - if(WirelessMode != 0xFF ){ - if(WirelessMode & ODM_WM_N24G) + if (WirelessMode != 0xFF ){ + if (WirelessMode & ODM_WM_N24G) max_rate_idx = 0x13; - else if(WirelessMode & ODM_WM_G) + else if (WirelessMode & ODM_WM_G) max_rate_idx = 0x0b; - else if(WirelessMode & ODM_WM_B) + else if (WirelessMode & ODM_WM_B) max_rate_idx = 0x03; } @@ -702,7 +702,7 @@ ODM_RA_GetShortGI_8188E( u8 MacID ) { - if((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) + if ((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) return 0; ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("MacID=%d SGI=%d\n", MacID, pDM_Odm->RAInfo[MacID].RateSGI)); @@ -717,7 +717,7 @@ ODM_RA_GetDecisionRate_8188E( { u8 DecisionRate = 0; - if((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) + if ((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) return 0; DecisionRate = (pDM_Odm->RAInfo[MacID].DecisionRate); ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, @@ -732,7 +732,7 @@ ODM_RA_GetHwPwrStatus_8188E( ) { u8 PTStage = 5; - if((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) + if ((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) return 0; PTStage = (pDM_Odm->RAInfo[MacID].PTStage); ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, @@ -754,7 +754,7 @@ ODM_RA_UpdateRateInfo_8188E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("MacID=%d RateID=0x%x RateMask=0x%x SGIEnable=%d\n", MacID, RateID, RateMask, SGIEnable)); - if((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) + if ((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) return; pRaInfo = &(pDM_Odm->RAInfo[MacID]); @@ -775,7 +775,7 @@ ODM_RA_SetRSSI_8188E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" MacID=%d Rssi=%d\n", MacID, Rssi)); - if((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) + if ((NULL == pDM_Odm) || (MacID >= ASSOCIATE_ENTRY_NUM)) return; pRaInfo = &(pDM_Odm->RAInfo[MacID]); @@ -815,15 +815,15 @@ ODM_RA_TxRPT2Handle_8188E( do { - if(MacId >= ASSOCIATE_ENTRY_NUM) + if (MacId >= ASSOCIATE_ENTRY_NUM) valid = 0; - else if(MacId >= 32) + else if (MacId >= 32) valid = (1<<(MacId-32)) & MacIDValidEntry1; else valid = (1<RAInfo[MacId]); - if(valid) + if (valid) { pRAInfo->RTY[0] = (u16)GET_TX_REPORT_TYPE1_RERTY_0(pBuffer); @@ -839,7 +839,7 @@ ODM_RA_TxRPT2Handle_8188E( pRAInfo->RTY[3] + \ pRAInfo->RTY[4] + \ pRAInfo->DROP; - if(pRAInfo->TOTAL != 0) + if (pRAInfo->TOTAL != 0) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("macid=%d Total=%d R0=%d R1=%d R2=%d R3=%d R4=%d D0=%d valid0=%x valid1=%x\n", @@ -855,10 +855,10 @@ ODM_RA_TxRPT2Handle_8188E( MacIDValidEntry1)); #if POWER_TRAINING_ACTIVE == 1 if (pRAInfo->PTActive){ - if(pRAInfo->RAstage<5){ + if (pRAInfo->RAstage<5){ odm_RateDecision_8188E(pDM_Odm,pRAInfo); } - else if(pRAInfo->RAstage==5){ /* Power training try state */ + else if (pRAInfo->RAstage==5){ /* Power training try state */ odm_PTTryState_8188E(pRAInfo); } else {/* RAstage==6 */ @@ -895,7 +895,7 @@ ODM_RA_TxRPT2Handle_8188E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, (" TOTAL=0!!!!\n")); } - if(minRptTime > pRAInfo->RptTime) + if (minRptTime > pRAInfo->RptTime) minRptTime = pRAInfo->RptTime; pBuffer += TX_RPT2_ITEM_SIZE; diff --git a/hal/HalPhyRf.c b/hal/HalPhyRf.c index 845d0be..64817ba 100644 --- a/hal/HalPhyRf.c +++ b/hal/HalPhyRf.c @@ -63,11 +63,11 @@ u8 ODM_GetRightChnlPlaceforIQK(u8 chnl) u8 place = chnl; - if(chnl > 14) + if (chnl > 14) { for(place = 14; place= _size)\ + if (_offset >= _size)\ _offset = _size-1;\ } while(0) @@ -57,14 +57,14 @@ static void setIqkMatrix( /* printk("%s==> OFDM_index:%d\n",__FUNCTION__,OFDM_index); */ - /* if(OFDM_index> OFDM_TABLE_SIZE_92D) */ + /* if (OFDM_index> OFDM_TABLE_SIZE_92D) */ /* */ /* printk("%s==> OFDM_index> 43\n",__FUNCTION__); */ /* */ ele_D = (OFDMSwingTable[OFDM_index] & 0xFFC00000)>>22; /* new element A = element D x X */ - if((IqkResult_X != 0) && (*(pDM_Odm->pBandType) == ODM_BAND_2_4G)) + if ((IqkResult_X != 0) && (*(pDM_Odm->pBandType) == ODM_BAND_2_4G)) { if ((IqkResult_X & 0x00000200) != 0) /* consider minus */ IqkResult_X = IqkResult_X | 0xFFFFFC00; @@ -290,7 +290,7 @@ odm_TxPwrTrackSetPwr88E( } else if (Method == BBSWING) { - if(* (pDM_Odm->pChannel) < 14) + if (* (pDM_Odm->pChannel) < 14) { ODM_Write1Byte(pDM_Odm, 0xa22, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][0]); ODM_Write1Byte(pDM_Odm, 0xa23, CCKSwingTable_Ch1_Ch13[pDM_Odm->BbSwingIdxCck][1]); @@ -386,13 +386,13 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( /* 4 3. Initialize ThermalValues of RFCalibrateInfo */ - if( ! pDM_Odm->RFCalibrateInfo.ThermalValue) + if ( ! pDM_Odm->RFCalibrateInfo.ThermalValue) { pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue; pDM_Odm->RFCalibrateInfo.ThermalValue_IQK = ThermalValue; } - if(pDM_Odm->RFCalibrateInfo.bReloadtxpowerindex) + if (pDM_Odm->RFCalibrateInfo.bReloadtxpowerindex) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("reload ofdm index for band switch\n")); } @@ -401,19 +401,19 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index] = ThermalValue; pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index++; - if(pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index == AVG_THERMAL_NUM_88E) + if (pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index == AVG_THERMAL_NUM_88E) pDM_Odm->RFCalibrateInfo.ThermalValue_AVG_index = 0; for(i = 0; i < AVG_THERMAL_NUM_88E; i++) { - if(pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[i]) + if (pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[i]) { ThermalValue_AVG += pDM_Odm->RFCalibrateInfo.ThermalValue_AVG[i]; ThermalValue_AVG_count++; } } - if(ThermalValue_AVG_count) + if (ThermalValue_AVG_count) { ThermalValue = (u8)(ThermalValue_AVG / ThermalValue_AVG_count); ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("AVG Thermal Meter = 0x%x\n", ThermalValue)); @@ -427,7 +427,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( /* 4 6. If necessary, do LCK. */ - /* if((delta_LCK > pHalData->Delta_LCK) && (pHalData->Delta_LCK != 0)) */ + /* if ((delta_LCK > pHalData->Delta_LCK) && (pHalData->Delta_LCK != 0)) */ if ((delta_LCK >= 8)) /* Delta temperature is equal to or larger than 20 centigrade. */ { pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue; @@ -442,7 +442,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( /* 4 7.1 The Final Power Index = BaseIndex + PowerIndexOffset */ - if(ThermalValue > pHalData->EEPROMThermalMeter) { + if (ThermalValue > pHalData->EEPROMThermalMeter) { CALCULATE_SWINGTALBE_OFFSET(offset, POWER_INC, index_mapping_NUM_88E, delta); pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex; pDM_Odm->RFCalibrateInfo.DeltaPowerIndex = -1 * deltaSwingTableIdx[POWER_INC][offset]; @@ -473,7 +473,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( for(i = 0; i < rf; i++) { - if(pDM_Odm->RFCalibrateInfo.OFDM_index[i] > OFDM_TABLE_SIZE_92D-1) + if (pDM_Odm->RFCalibrateInfo.OFDM_index[i] > OFDM_TABLE_SIZE_92D-1) { pDM_Odm->RFCalibrateInfo.OFDM_index[i] = OFDM_TABLE_SIZE_92D-1; } @@ -483,7 +483,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( } } - if(pDM_Odm->RFCalibrateInfo.CCK_index > CCK_TABLE_SIZE-1) + if (pDM_Odm->RFCalibrateInfo.CCK_index > CCK_TABLE_SIZE-1) pDM_Odm->RFCalibrateInfo.CCK_index = CCK_TABLE_SIZE-1; } else { ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, @@ -528,7 +528,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( { ODM_RT_TRACE(pDM_Odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("Temperature(%d) lower than PG value(%d), increases the power by TxAGC\n", ThermalValue, pHalData->EEPROMThermalMeter)); odm_TxPwrTrackSetPwr88E(pDM_Odm, BBSWING, RF_PATH_A, Indexforchannel); - /* if(is2T) */ + /* if (is2T) */ /* odm_TxPwrTrackSetPwr88E(pDM_Odm, BBSWING, RF_PATH_B, Indexforchannel); */ } @@ -538,7 +538,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E( } - /* if((delta_IQK > pHalData->Delta_IQK) && (pHalData->Delta_IQK != 0)) */ + /* if ((delta_IQK > pHalData->Delta_IQK) && (pHalData->Delta_IQK != 0)) */ if ((delta_IQK >= 8)){ /* Delta temperature is equal to or larger than 20 centigrade. */ /* printk("delta_IQK(%d) >=8 do_IQK\n",delta_IQK); */ doIQK(pDM_Odm, delta_IQK, ThermalValue, 8); @@ -602,7 +602,7 @@ phy_PathA_IQK_8188E( regEA4= ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord); ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xea4 = 0x%x\n", regEA4)); - if(!(regEAC & BIT28) && + if (!(regEAC & BIT28) && (((regE94 & 0x03FF0000)>>16) != 0x142) && (((regE9C & 0x03FF0000)>>16) != 0x42) ) result |= 0x01; @@ -671,7 +671,7 @@ phy_PathA_RxIQK( regE9C= ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord); ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe9c = 0x%x\n", regE9C)); - if(!(regEAC & BIT28) && + if (!(regEAC & BIT28) && (((regE94 & 0x03FF0000)>>16) != 0x142) && (((regE9C & 0x03FF0000)>>16) != 0x42) ) { @@ -738,7 +738,7 @@ phy_PathA_RxIQK( ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); ODM_SetRFReg(pDM_Odm, RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x180 ); - if(!(regEAC & BIT27) && /* if Tx is OK, check whether Rx is OK */ + if (!(regEAC & BIT27) && /* if Tx is OK, check whether Rx is OK */ (((regEA4 & 0x03FF0000)>>16) != 0x132) && (((regEAC & 0x03FF0000)>>16) != 0x36)) result |= 0x02; @@ -781,14 +781,14 @@ phy_PathB_IQK_8188E( regECC= ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_B_2, bMaskDWord); ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xecc = 0x%x\n", regECC)); - if(!(regEAC & BIT31) && + if (!(regEAC & BIT31) && (((regEB4 & 0x03FF0000)>>16) != 0x142) && (((regEBC & 0x03FF0000)>>16) != 0x42)) result |= 0x01; else return result; - if(!(regEAC & BIT30) && + if (!(regEAC & BIT30) && (((regEC4 & 0x03FF0000)>>16) != 0x132) && (((regECC & 0x03FF0000)>>16) != 0x36)) result |= 0x02; @@ -815,10 +815,10 @@ _PHY_PathAFillIQKMatrix( PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed")); - if(final_candidate == 0xFF) + if (final_candidate == 0xFF) return; - else if(bIQKOK) + else if (bIQKOK) { Oldval_0 = (ODM_GetBBReg(pDM_Odm, rOFDM0_XATxIQImbalance, bMaskDWord) >> 22) & 0x3FF; @@ -843,7 +843,7 @@ _PHY_PathAFillIQKMatrix( ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(29), ((Y* Oldval_0>>7) & 0x1)); - if(bTxOnly) + if (bTxOnly) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("_PHY_PathAFillIQKMatrix only Tx OK\n")); return; @@ -875,10 +875,10 @@ _PHY_PathBFillIQKMatrix( PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQ Calibration %s !\n",(bIQKOK)?"Success":"Failed")); - if(final_candidate == 0xFF) + if (final_candidate == 0xFF) return; - else if(bIQKOK) + else if (bIQKOK) { Oldval_1 = (ODM_GetBBReg(pDM_Odm, rOFDM0_XBTxIQImbalance, bMaskDWord) >> 22) & 0x3FF; @@ -902,7 +902,7 @@ _PHY_PathBFillIQKMatrix( ODM_SetBBReg(pDM_Odm, rOFDM0_ECCAThreshold, BIT(25), ((Y* Oldval_1>>7) & 0x1)); - if(bTxOnly) + if (bTxOnly) return; reg = result[final_candidate][6]; @@ -1022,7 +1022,7 @@ _PHY_PathADDAOn( ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("ADDA ON.\n")); pathOn = isPathAOn ? 0x04db25a4 : 0x0b1b25a4; - if(false == is2T){ + if (false == is2T){ pathOn = 0x0bdb25a0; ODM_SetBBReg(pDM_Odm, ADDAReg[0], bMaskDWord, 0x0b1b25a0); } @@ -1106,12 +1106,12 @@ phy_SimularityCompare_8188E( bool is2T; s32 tmp1 = 0,tmp2 = 0; - if( (pDM_Odm->RFType ==ODM_2T2R )||(pDM_Odm->RFType ==ODM_2T3R )||(pDM_Odm->RFType ==ODM_2T4R )) + if ( (pDM_Odm->RFType ==ODM_2T2R )||(pDM_Odm->RFType ==ODM_2T3R )||(pDM_Odm->RFType ==ODM_2T4R )) is2T = true; else is2T = false; - if(is2T) + if (is2T) bound = 8; else bound = 4; @@ -1126,14 +1126,14 @@ phy_SimularityCompare_8188E( for( i = 0; i < bound; i++ ) { /* diff = (result[c1][i] > result[c2][i]) ? (result[c1][i] - result[c2][i]) : (result[c2][i] - result[c1][i]); */ - if((i==1) || (i==3) || (i==5) || (i==7)) + if ((i==1) || (i==3) || (i==5) || (i==7)) { - if((result[c1][i]& 0x00000200) != 0) + if ((result[c1][i]& 0x00000200) != 0) tmp1 = result[c1][i] | 0xFFFFFC00; else tmp1 = result[c1][i]; - if((result[c2][i]& 0x00000200) != 0) + if ((result[c2][i]& 0x00000200) != 0) tmp2 = result[c2][i] | 0xFFFFFC00; else tmp2 = result[c2][i]; @@ -1150,9 +1150,9 @@ phy_SimularityCompare_8188E( { ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:phy_SimularityCompare_8188E differnece overflow index %d compare1 0x%x compare2 0x%x!!!\n", i, result[c1][i], result[c2][i])); - if((i == 2 || i == 6) && !SimularityBitMap) + if ((i == 2 || i == 6) && !SimularityBitMap) { - if(result[c1][i]+result[c1][i+1] == 0) + if (result[c1][i]+result[c1][i+1] == 0) final_candidate[(i/4)] = c2; else if (result[c2][i]+result[c2][i+1] == 0) final_candidate[(i/4)] = c1; @@ -1170,7 +1170,7 @@ phy_SimularityCompare_8188E( { for( i = 0; i < (bound/4); i++ ) { - if(final_candidate[i] != 0xFF) + if (final_candidate[i] != 0xFF) { for( j = i*4; j < (i+1)*4-2; j++) result[3][j] = result[final_candidate[i]][j]; @@ -1256,7 +1256,7 @@ else /* Note: IQ calibration must be performed after loading */ /* PHY_REG.txt , and radio_a, radio_b.txt */ - if(t==0) { + if (t==0) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQ Calibration for %s for %d times\n", (is2T ? "2T2R" : "1T1R"), t)); /* Save ADDA parameters, turn Path A ADDA on */ @@ -1268,11 +1268,11 @@ else _PHY_PathADDAOn(pAdapter, ADDA_REG, true, is2T); - if(t==0) { + if (t==0) { pDM_Odm->RFCalibrateInfo.bRfPiEnable = (u8)ODM_GetBBReg(pDM_Odm, rFPGA0_XA_HSSIParameter1, BIT(8)); } - if(!pDM_Odm->RFCalibrateInfo.bRfPiEnable){ + if (!pDM_Odm->RFCalibrateInfo.bRfPiEnable){ /* Switch BB to PI mode to do IQ Calibration. */ _PHY_PIModeSwitch(pAdapter, true); } @@ -1290,7 +1290,7 @@ else ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT10, 0x00); - if(is2T) + if (is2T) { ODM_SetBBReg(pDM_Odm, rFPGA0_XA_LSSIParameter, bMaskDWord, 0x00010000); ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIParameter, bMaskDWord, 0x00010000); @@ -1303,7 +1303,7 @@ else /* AP or IQK */ ODM_SetBBReg(pDM_Odm, rConfig_AntA, bMaskDWord, 0x0f600000); - if(is2T) + if (is2T) { ODM_SetBBReg(pDM_Odm, rConfig_AntB, bMaskDWord, 0x0f600000); } @@ -1316,7 +1316,7 @@ else for(i = 0 ; i < retryCount ; i++){ PathAOK = phy_PathA_IQK_8188E(pAdapter, is2T); - if(PathAOK == 0x01){ + if (PathAOK == 0x01){ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Tx IQK Success!!\n")); result[t][0] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_A, bMaskDWord)&0x3FF0000)>>16; result[t][1] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_A, bMaskDWord)&0x3FF0000)>>16; @@ -1326,7 +1326,7 @@ else for(i = 0 ; i < retryCount ; i++){ PathAOK = phy_PathA_RxIQK(pAdapter, is2T); - if(PathAOK == 0x03){ + if (PathAOK == 0x03){ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK Success!!\n")); result[t][2] = (ODM_GetBBReg(pDM_Odm, rRx_Power_Before_IQK_A_2, bMaskDWord)&0x3FF0000)>>16; result[t][3] = (ODM_GetBBReg(pDM_Odm, rRx_Power_After_IQK_A_2, bMaskDWord)&0x3FF0000)>>16; @@ -1336,11 +1336,11 @@ else } } - if(0x00 == PathAOK){ + if (0x00 == PathAOK){ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQK failed!!\n")); } - if(is2T){ + if (is2T){ _PHY_PathAStandBy(pAdapter); /* Turn Path B ADDA on */ @@ -1348,7 +1348,7 @@ else for(i = 0 ; i < retryCount ; i++){ PathBOK = phy_PathB_IQK_8188E(pAdapter); - if(PathBOK == 0x03){ + if (PathBOK == 0x03){ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK Success!!\n")); result[t][4] = (ODM_GetBBReg(pDM_Odm, rTx_Power_Before_IQK_B, bMaskDWord)&0x3FF0000)>>16; result[t][5] = (ODM_GetBBReg(pDM_Odm, rTx_Power_After_IQK_B, bMaskDWord)&0x3FF0000)>>16; @@ -1364,7 +1364,7 @@ else } } - if(0x00 == PathBOK){ + if (0x00 == PathBOK){ ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK failed!!\n")); } } @@ -1373,8 +1373,8 @@ else ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK:Back to BB mode, load original value!\n")); ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0); - if(t!=0) { - if(!pDM_Odm->RFCalibrateInfo.bRfPiEnable){ + if (t!=0) { + if (!pDM_Odm->RFCalibrateInfo.bRfPiEnable){ /* Switch back BB to SI mode after finish IQ Calibration. */ _PHY_PIModeSwitch(pAdapter, false); } @@ -1390,7 +1390,7 @@ else /* Restore RX initial gain */ ODM_SetBBReg(pDM_Odm, rFPGA0_XA_LSSIParameter, bMaskDWord, 0x00032ed3); - if(is2T){ + if (is2T){ ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIParameter, bMaskDWord, 0x00032ed3); } @@ -1418,19 +1418,19 @@ phy_LCCalibrate_8188E( /* Check continuous TX and Packet TX */ tmpReg = ODM_Read1Byte(pDM_Odm, 0xd03); - if((tmpReg&0x70) != 0) /* Deal with contisuous TX case */ + if ((tmpReg&0x70) != 0) /* Deal with contisuous TX case */ ODM_Write1Byte(pDM_Odm, 0xd03, tmpReg&0x8F); /* disable all continuous TX */ else /* Deal with Packet TX case */ ODM_Write1Byte(pDM_Odm, REG_TXPAUSE, 0xFF); /* block all queues */ - if((tmpReg&0x70) != 0) + if ((tmpReg&0x70) != 0) { /* 1. Read original RF mode */ /* Path-A */ RF_Amode = PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_AC, bMask12Bits); /* Path-B */ - if(is2T) + if (is2T) RF_Bmode = PHY_QueryRFReg(pAdapter, RF_PATH_B, RF_AC, bMask12Bits); /* 2. Set RF mode = standby mode */ @@ -1438,7 +1438,7 @@ phy_LCCalibrate_8188E( ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_AC, bMask12Bits, (RF_Amode&0x8FFFF)|0x10000); /* Path-B */ - if(is2T) + if (is2T) ODM_SetRFReg(pDM_Odm, RF_PATH_B, RF_AC, bMask12Bits, (RF_Bmode&0x8FFFF)|0x10000); } @@ -1452,14 +1452,14 @@ phy_LCCalibrate_8188E( /* Restore original situation */ - if((tmpReg&0x70) != 0) /* Deal with contisuous TX case */ + if ((tmpReg&0x70) != 0) /* Deal with contisuous TX case */ { /* Path-A */ ODM_Write1Byte(pDM_Odm, 0xd03, tmpReg); ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_AC, bMask12Bits, RF_Amode); /* Path-B */ - if(is2T) + if (is2T) ODM_SetRFReg(pDM_Odm, RF_PATH_B, RF_AC, bMask12Bits, RF_Bmode); } else /* Deal with Packet TX case */ @@ -1586,7 +1586,7 @@ if ( *(pDM_Odm->mp_mode) == 1) ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("==>phy_APCalibrate_8188E() delta %d\n", delta)); ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("AP Calibration for %s\n", (is2T ? "2T2R" : "1T1R"))); - if(!is2T) + if (!is2T) pathbound = 1; /* 2 FOR NORMAL CHIP SETTINGS */ @@ -1616,7 +1616,7 @@ if ( *(pDM_Odm->mp_mode) == 1) /* save BB default value */ for(index = 0; index < APK_BB_REG_NUM ; index++) { - if(index == 0) /* skip */ + if (index == 0) /* skip */ continue; BB_backup[index] = ODM_GetBBReg(pDM_Odm, BB_REG[index], bMaskDWord); } @@ -1631,7 +1631,7 @@ if ( *(pDM_Odm->mp_mode) == 1) { - if(path == RF_PATH_A) + if (path == RF_PATH_A) { /* path A APK */ /* load APK setting */ @@ -1670,7 +1670,7 @@ if ( *(pDM_Odm->mp_mode) == 1) } ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); } - else if(path == RF_PATH_B) + else if (path == RF_PATH_B) { /* path B APK */ /* load APK setting */ @@ -1720,12 +1720,12 @@ if ( *(pDM_Odm->mp_mode) == 1) ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() offset 0xe70 %x\n", ODM_GetBBReg(pDM_Odm, rRx_Wait_CCA, bMaskDWord))); /* BB to AP mode */ - if(path == 0) + if (path == 0) { for(index = 0; index < APK_BB_REG_NUM ; index++) { - if(index == 0) /* skip */ + if (index == 0) /* skip */ continue; else if (index < 5) ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_AP_MODE[index]); @@ -1750,7 +1750,7 @@ if ( *(pDM_Odm->mp_mode) == 1) /* MAC settings */ _PHY_MACSettingCalibration(pAdapter, MAC_REG, MAC_backup); - if(path == RF_PATH_A) /* Path B to standby mode */ + if (path == RF_PATH_A) /* Path B to standby mode */ { ODM_SetRFReg(pDM_Odm, RF_PATH_B, RF_AC, bMaskDWord, 0x10000); } @@ -1762,7 +1762,7 @@ if ( *(pDM_Odm->mp_mode) == 1) } delta_offset = ((delta+14)/2); - if(delta_offset < 0) + if (delta_offset < 0) delta_offset = 0; else if (delta_offset > 12) delta_offset = 12; @@ -1770,15 +1770,15 @@ if ( *(pDM_Odm->mp_mode) == 1) /* AP calibration */ for(index = 0; index < APK_BB_REG_NUM; index++) { - if(index != 1) /* only DO PA11+PAD01001, AP RF setting */ + if (index != 1) /* only DO PA11+PAD01001, AP RF setting */ continue; tmpReg = APK_RF_init_value[path][index]; - if(!pDM_Odm->RFCalibrateInfo.bAPKThermalMeterIgnore) + if (!pDM_Odm->RFCalibrateInfo.bAPKThermalMeterIgnore) { BB_offset = (tmpReg & 0xF0000) >> 16; - if(!(tmpReg & BIT15)) /* sign bit 0 */ + if (!(tmpReg & BIT15)) /* sign bit 0 */ { BB_offset = -BB_offset; } @@ -1789,7 +1789,7 @@ if ( *(pDM_Odm->mp_mode) == 1) ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("phy_APCalibrate_8188E() APK index %d tmpReg 0x%x delta_V %d delta_offset %d\n", index, tmpReg, delta_V, delta_offset)); - if(BB_offset < 0) + if (BB_offset < 0) { tmpReg = tmpReg & (~BIT15); BB_offset = -BB_offset; @@ -1824,7 +1824,7 @@ if ( *(pDM_Odm->mp_mode) == 1) } ODM_SetBBReg(pDM_Odm, rFPGA0_IQK, bMaskDWord, 0x00000000); - if(path == RF_PATH_A) + if (path == RF_PATH_A) tmpReg = ODM_GetBBReg(pDM_Odm, rAPK, 0x03E00000); else tmpReg = ODM_GetBBReg(pDM_Odm, rAPK, 0xF8000000); @@ -1846,7 +1846,7 @@ if ( *(pDM_Odm->mp_mode) == 1) for(index = 0; index < APK_BB_REG_NUM ; index++) { - if(index == 0) /* skip */ + if (index == 0) /* skip */ continue; ODM_SetBBReg(pDM_Odm, BB_REG[index], bMaskDWord, BB_backup[index]); } @@ -1858,7 +1858,7 @@ if ( *(pDM_Odm->mp_mode) == 1) for(path = 0; path < pathbound; path++) { ODM_SetRFReg(pDM_Odm, path, 0xd, bMaskDWord, regD[path]); - if(path == RF_PATH_B) + if (path == RF_PATH_B) { ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_MODE1, bMaskDWord, 0x1000f); ODM_SetRFReg(pDM_Odm, RF_PATH_A, RF_MODE2, bMaskDWord, 0x20101); @@ -1877,13 +1877,13 @@ if ( *(pDM_Odm->mp_mode) == 1) { ODM_SetRFReg(pDM_Odm, path, 0x3, bMaskDWord, ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (APK_result[path][1] << 5) | APK_result[path][1])); - if(path == RF_PATH_A) + if (path == RF_PATH_A) ODM_SetRFReg(pDM_Odm, path, 0x4, bMaskDWord, ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x00 << 5) | 0x05)); else ODM_SetRFReg(pDM_Odm, path, 0x4, bMaskDWord, ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x02 << 5) | 0x05)); - if(!IS_HARDWARE_TYPE_8723A(pAdapter)) + if (!IS_HARDWARE_TYPE_8723A(pAdapter)) ODM_SetRFReg(pDM_Odm, path, RF_BS_PA_APSET_G9_G11, bMaskDWord, ((0x08 << 15) | (0x08 << 10) | (0x08 << 5) | 0x08)); } @@ -1939,7 +1939,7 @@ PHY_IQCalibrate_8188E( if (ODM_CheckPowerStatus(pAdapter) == false) return; - if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) + if (!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) { return; } @@ -1954,14 +1954,14 @@ if (*(pDM_Odm->mp_mode) == 1) #endif /* 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) */ - if(bSingleTone || bCarrierSuppression) + if (bSingleTone || bCarrierSuppression) return; #if DISABLE_BB_RF return; #endif - if(bReCovery) + if (bReCovery) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("PHY_IQCalibrate_8188E: Return due to bReCovery!\n")); _PHY_ReloadADDARegisters(pAdapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9); @@ -1973,7 +1973,7 @@ if (*(pDM_Odm->mp_mode) == 1) result[0][i] = 0; result[1][i] = 0; result[2][i] = 0; - if((i==0) ||(i==2) || (i==4) || (i==6)) + if ((i==0) ||(i==2) || (i==4) || (i==6)) result[3][i] = 0x100; else result[3][i] = 0; @@ -1992,26 +1992,26 @@ if (*(pDM_Odm->mp_mode) == 1) { phy_IQCalibrate_8188E(pAdapter, result, i, is2T); - if(i == 1) { + if (i == 1) { is12simular = phy_SimularityCompare_8188E(pAdapter, result, 0, 1); - if(is12simular) { + if (is12simular) { final_candidate = 0; ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is12simular final_candidate is %x\n",final_candidate)); break; } } - if(i == 2) + if (i == 2) { is13simular = phy_SimularityCompare_8188E(pAdapter, result, 0, 2); - if(is13simular) { + if (is13simular) { final_candidate = 0; ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is13simular final_candidate is %x\n",final_candidate)); break; } is23simular = phy_SimularityCompare_8188E(pAdapter, result, 1, 2); - if(is23simular) { + if (is23simular) { final_candidate = 1; ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is23simular final_candidate is %x\n",final_candidate)); } @@ -2021,7 +2021,7 @@ if (*(pDM_Odm->mp_mode) == 1) for(i = 0; i < 8; i++) RegTmp += result[3][i]; - if(RegTmp != 0) + if (RegTmp != 0) final_candidate = 3; else final_candidate = 0xFF; @@ -2045,7 +2045,7 @@ if (*(pDM_Odm->mp_mode) == 1) ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: RegE94=%x RegE9C=%x RegEA4=%x RegEAC=%x RegEB4=%x RegEBC=%x RegEC4=%x RegECC=%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC)); } - if(final_candidate != 0xff) + if (final_candidate != 0xff) { pDM_Odm->RFCalibrateInfo.RegE94 = RegE94 = result[final_candidate][0]; pDM_Odm->RFCalibrateInfo.RegE9C = RegE9C = result[final_candidate][1]; @@ -2065,11 +2065,11 @@ if (*(pDM_Odm->mp_mode) == 1) pDM_Odm->RFCalibrateInfo.RegE9C = pDM_Odm->RFCalibrateInfo.RegEBC = 0x0; /* Y default value */ } - if((RegE94 != 0)/*&&(RegEA4 != 0)*/) + if ((RegE94 != 0)/*&&(RegEA4 != 0)*/) _PHY_PathAFillIQKMatrix(pAdapter, bPathAOK, result, final_candidate, (RegEA4 == 0)); if (is2T) { - if((RegEB4 != 0)/*&&(RegEC4 != 0)*/) + if ((RegEB4 != 0)/*&&(RegEC4 != 0)*/) _PHY_PathBFillIQKMatrix(pAdapter, bPathBOK, result, final_candidate, (RegEC4 == 0)); } @@ -2077,7 +2077,7 @@ if (*(pDM_Odm->mp_mode) == 1) /* To Fix BSOD when final_candidate is 0xff */ /* by sherry 20120321 */ - if(final_candidate < 4) + if (final_candidate < 4) { for(i = 0; i < IQK_Matrix_REG_NUM; i++) pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].Value[0][i] = result[final_candidate][i]; @@ -2122,12 +2122,12 @@ if (*(pDM_Odm->mp_mode) == 1) return; #endif - if(!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) + if (!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) { return; } /* 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) */ - if(bSingleTone || bCarrierSuppression) + if (bSingleTone || bCarrierSuppression) return; while(*(pDM_Odm->pbScanInProcess) && timecount < timeout) @@ -2140,7 +2140,7 @@ if (*(pDM_Odm->mp_mode) == 1) /* ODM_RT_TRACE(pDM_Odm,ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK:Start!!!interface %d currentband %x delay %d ms\n", pDM_Odm->interfaceIndex, pHalData->CurrentBandType92D, timecount)); */ - if(pDM_Odm->RFType == ODM_2T2R) + if (pDM_Odm->RFType == ODM_2T2R) { phy_LCCalibrate_8188E(pAdapter, true); } @@ -2173,7 +2173,7 @@ static void phy_SetRFPathSwitch_8188E( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); PDM_ODM_T pDM_Odm = &pHalData->odmpriv; - if(pAdapter->hw_init_completed == false) + if (pAdapter->hw_init_completed == false) { u8 u1bTmp; u1bTmp = ODM_Read1Byte(pDM_Odm, REG_LEDCFG2) | BIT7; @@ -2181,9 +2181,9 @@ static void phy_SetRFPathSwitch_8188E( /* ODM_SetBBReg(pDM_Odm, REG_LEDCFG0, BIT23, 0x01); */ ODM_SetBBReg(pDM_Odm, rFPGA0_XAB_RFParameter, BIT13, 0x01); } - if(is2T) /* 92C */ + if (is2T) /* 92C */ { - if(bMain) + if (bMain) ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x1); /* 92C_Path_A */ else ODM_SetBBReg(pDM_Odm, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x2); /* BT */ @@ -2191,7 +2191,7 @@ static void phy_SetRFPathSwitch_8188E( else /* 88C */ { - if(bMain) + if (bMain) ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9, 0x2); /* Main */ else ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, BIT8|BIT9, 0x1); /* Aux */ @@ -2209,7 +2209,7 @@ void PHY_SetRFPathSwitch_8188E( return; #endif - if(pDM_Odm->RFType == ODM_2T2R) + if (pDM_Odm->RFType == ODM_2T2R) { phy_SetRFPathSwitch_8188E(pAdapter, bMain, true); } diff --git a/hal/hal_com.c b/hal/hal_com.c index dda3691..c8bc50d 100644 --- a/hal/hal_com.c +++ b/hal/hal_com.c @@ -33,34 +33,34 @@ void dump_chip_info(struct hal_version ChipVersion) int cnt = 0; u8 buf[128]; - if(IS_81XXC(ChipVersion)){ + if (IS_81XXC(ChipVersion)){ cnt += sprintf((buf+cnt), "Chip Version Info: %s_", IS_92C_SERIAL(ChipVersion)?"CHIP_8192C":"CHIP_8188C"); } - else if(IS_92D(ChipVersion)){ + else if (IS_92D(ChipVersion)){ cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8192D_"); } - else if(IS_8723_SERIES(ChipVersion)){ + else if (IS_8723_SERIES(ChipVersion)){ cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8723A_"); } - else if(IS_8188E(ChipVersion)){ + else if (IS_8188E(ChipVersion)){ cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8188E_"); } cnt += sprintf((buf+cnt), "%s_", IS_NORMAL_CHIP(ChipVersion)?"Normal_Chip":"Test_Chip"); cnt += sprintf((buf+cnt), "%s_", IS_CHIP_VENDOR_TSMC(ChipVersion)?"TSMC":"UMC"); - if(IS_A_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "A_CUT_"); - else if(IS_B_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "B_CUT_"); - else if(IS_C_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "C_CUT_"); - else if(IS_D_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "D_CUT_"); - else if(IS_E_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "E_CUT_"); - else if(IS_I_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "I_CUT_"); - else if(IS_J_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "J_CUT_"); - else if(IS_K_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "K_CUT_"); + if (IS_A_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "A_CUT_"); + else if (IS_B_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "B_CUT_"); + else if (IS_C_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "C_CUT_"); + else if (IS_D_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "D_CUT_"); + else if (IS_E_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "E_CUT_"); + else if (IS_I_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "I_CUT_"); + else if (IS_J_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "J_CUT_"); + else if (IS_K_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "K_CUT_"); else cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion); - if(IS_1T1R(ChipVersion)) cnt += sprintf((buf+cnt), "1T1R_"); - else if(IS_1T2R(ChipVersion)) cnt += sprintf((buf+cnt), "1T2R_"); - else if(IS_2T2R(ChipVersion)) cnt += sprintf((buf+cnt), "2T2R_"); + if (IS_1T1R(ChipVersion)) cnt += sprintf((buf+cnt), "1T1R_"); + else if (IS_1T2R(ChipVersion)) cnt += sprintf((buf+cnt), "1T2R_"); + else if (IS_2T2R(ChipVersion)) cnt += sprintf((buf+cnt), "2T2R_"); else cnt += sprintf((buf+cnt), "UNKNOWN_RFTYPE(%d)_", ChipVersion.RFType); cnt += sprintf((buf+cnt), "RomVer(%d)\n", ChipVersion.ROMVer); @@ -151,7 +151,7 @@ void HalSetBrateCfg( is_brate = mBratesOS[i] & IEEE80211_BASIC_RATE_MASK; brate = mBratesOS[i] & 0x7f; - if( is_brate ) + if ( is_brate ) { switch(brate) { @@ -198,7 +198,7 @@ _TwoOutPipeMapping( { struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(pAdapter); - if(bWIFICfg){ /* WMM */ + if (bWIFICfg){ /* WMM */ /* BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA */ /* 0, 1, 0, 1, 0, 0, 0, 0, 0 }; */ @@ -243,7 +243,7 @@ static void _ThreeOutPipeMapping( { struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(pAdapter); - if(bWIFICfg){/* for WMM */ + if (bWIFICfg){/* for WMM */ /* BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA */ /* 1, 2, 1, 0, 0, 0, 0, 0, 0 }; */ @@ -389,7 +389,7 @@ SetHalDefVar(struct adapter *adapter, enum HAL_DEF_VARIABLE variable, void *valu switch(variable) { case HW_DEF_FA_CNT_DUMP: - if(*((u8*)value)) + if (*((u8*)value)) pDM_Odm->DebugComponents |= (ODM_COMP_DIG |ODM_COMP_FA_CNT); else pDM_Odm->DebugComponents &= ~(ODM_COMP_DIG |ODM_COMP_FA_CNT); diff --git a/hal/hal_intf.c b/hal/hal_intf.c index 47b588d..f5f8d75 100644 --- a/hal/hal_intf.c +++ b/hal/hal_intf.c @@ -27,40 +27,40 @@ void rtw_hal_chip_configure(struct adapter *padapter) { - if(padapter->HalFunc.intf_chip_configure) + if (padapter->HalFunc.intf_chip_configure) padapter->HalFunc.intf_chip_configure(padapter); } void rtw_hal_read_chip_info(struct adapter *padapter) { - if(padapter->HalFunc.read_adapter_info) + if (padapter->HalFunc.read_adapter_info) padapter->HalFunc.read_adapter_info(padapter); } void rtw_hal_read_chip_version(struct adapter *padapter) { - if(padapter->HalFunc.read_chip_version) + if (padapter->HalFunc.read_chip_version) padapter->HalFunc.read_chip_version(padapter); } void rtw_hal_def_value_init(struct adapter *padapter) { if (is_primary_adapter(padapter)) - if(padapter->HalFunc.init_default_value) + if (padapter->HalFunc.init_default_value) padapter->HalFunc.init_default_value(padapter); } void rtw_hal_free_data(struct adapter *padapter) { if (is_primary_adapter(padapter)) - if(padapter->HalFunc.free_hal_data) + if (padapter->HalFunc.free_hal_data) padapter->HalFunc.free_hal_data(padapter); } void rtw_hal_dm_init(struct adapter *padapter) { if (is_primary_adapter(padapter)) - if(padapter->HalFunc.dm_init) + if (padapter->HalFunc.dm_init) padapter->HalFunc.dm_init(padapter); } @@ -68,32 +68,32 @@ void rtw_hal_dm_deinit(struct adapter *padapter) { /* cancel dm timer */ if (is_primary_adapter(padapter)) - if(padapter->HalFunc.dm_deinit) + if (padapter->HalFunc.dm_deinit) padapter->HalFunc.dm_deinit(padapter); } void rtw_hal_sw_led_init(struct adapter *padapter) { - if(padapter->HalFunc.InitSwLeds) + if (padapter->HalFunc.InitSwLeds) padapter->HalFunc.InitSwLeds(padapter); } void rtw_hal_sw_led_deinit(struct adapter *padapter) { - if(padapter->HalFunc.DeInitSwLeds) + if (padapter->HalFunc.DeInitSwLeds) padapter->HalFunc.DeInitSwLeds(padapter); } u32 rtw_hal_power_on(struct adapter *padapter) { - if(padapter->HalFunc.hal_power_on) + if (padapter->HalFunc.hal_power_on) return padapter->HalFunc.hal_power_on(padapter); return _FAIL; } void rtw_hal_power_off(struct adapter *padapter) { - if(padapter->HalFunc.hal_power_off) + if (padapter->HalFunc.hal_power_off) padapter->HalFunc.hal_power_off(padapter); } @@ -105,7 +105,7 @@ uint rtw_hal_init(struct adapter *padapter) status = padapter->HalFunc.hal_init(padapter); - if(status == _SUCCESS){ + if (status == _SUCCESS){ for (i = 0; iiface_nums; i++) { padapter = dvobj->padapters[i]; padapter->hw_init_completed = true; @@ -147,7 +147,7 @@ uint rtw_hal_deinit(struct adapter *padapter) status = padapter->HalFunc.hal_deinit(padapter); - if(status == _SUCCESS){ + if (status == _SUCCESS){ for (i = 0; iiface_nums; i++) { padapter = dvobj->padapters[i]; padapter->hw_init_completed = false; @@ -174,27 +174,27 @@ void rtw_hal_get_hwreg(struct adapter *padapter, u8 variable, u8 *val) u8 rtw_hal_set_def_var(struct adapter *padapter, enum HAL_DEF_VARIABLE eVariable, void * pValue) { - if(padapter->HalFunc.SetHalDefVarHandler) + if (padapter->HalFunc.SetHalDefVarHandler) return padapter->HalFunc.SetHalDefVarHandler(padapter,eVariable,pValue); return _FAIL; } u8 rtw_hal_get_def_var(struct adapter *padapter, enum HAL_DEF_VARIABLE eVariable, void * pValue) { - if(padapter->HalFunc.GetHalDefVarHandler) + if (padapter->HalFunc.GetHalDefVarHandler) return padapter->HalFunc.GetHalDefVarHandler(padapter,eVariable,pValue); return _FAIL; } void rtw_hal_set_odm_var(struct adapter *padapter, enum HAL_ODM_VARIABLE eVariable, void * pValue1,bool bSet) { - if(padapter->HalFunc.SetHalODMVarHandler) + if (padapter->HalFunc.SetHalODMVarHandler) padapter->HalFunc.SetHalODMVarHandler(padapter,eVariable,pValue1,bSet); } void rtw_hal_get_odm_var(struct adapter *padapter, enum HAL_ODM_VARIABLE eVariable, void * pValue1,bool bSet) { - if(padapter->HalFunc.GetHalODMVarHandler) + if (padapter->HalFunc.GetHalODMVarHandler) padapter->HalFunc.GetHalODMVarHandler(padapter,eVariable,pValue1,bSet); } @@ -229,7 +229,7 @@ void rtw_hal_disable_interrupt(struct adapter *padapter) u32 rtw_hal_inirp_init(struct adapter *padapter) { u32 rst = _FAIL; - if(padapter->HalFunc.inirp_init) + if (padapter->HalFunc.inirp_init) rst = padapter->HalFunc.inirp_init(padapter); else DBG_871X(" %s HalFunc.inirp_init is NULL!!!\n",__FUNCTION__); @@ -239,7 +239,7 @@ u32 rtw_hal_inirp_init(struct adapter *padapter) u32 rtw_hal_inirp_deinit(struct adapter *padapter) { - if(padapter->HalFunc.inirp_deinit) + if (padapter->HalFunc.inirp_deinit) return padapter->HalFunc.inirp_deinit(padapter); return _FAIL; @@ -248,14 +248,14 @@ u32 rtw_hal_inirp_deinit(struct adapter *padapter) u8 rtw_hal_intf_ps_func(struct adapter *padapter, enum HAL_INTF_PS_FUNC efunc_id, u8* val) { - if(padapter->HalFunc.interface_ps_func) + if (padapter->HalFunc.interface_ps_func) return padapter->HalFunc.interface_ps_func(padapter,efunc_id,val); return _FAIL; } s32 rtw_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe) { - if(padapter->HalFunc.hal_xmitframe_enqueue) + if (padapter->HalFunc.hal_xmitframe_enqueue) return padapter->HalFunc.hal_xmitframe_enqueue(padapter, pxmitframe); return false; @@ -263,7 +263,7 @@ s32 rtw_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmit s32 rtw_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe) { - if(padapter->HalFunc.hal_xmit) + if (padapter->HalFunc.hal_xmit) return padapter->HalFunc.hal_xmit(padapter, pxmitframe); return false; @@ -280,9 +280,9 @@ s32 rtw_hal_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe) memcpy(pmgntframe->attrib.ra, pwlanhdr->addr1, ETH_ALEN); #ifdef CONFIG_IEEE80211W - if(padapter->securitypriv.binstallBIPkey == true) + if (padapter->securitypriv.binstallBIPkey == true) { - if(IS_MCAST(pmgntframe->attrib.ra)) + if (IS_MCAST(pmgntframe->attrib.ra)) { pmgntframe->attrib.encrypt = _BIP_; /* pmgntframe->attrib.bswenc = true; */ @@ -296,27 +296,27 @@ s32 rtw_hal_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe) } #endif /* CONFIG_IEEE80211W */ - if(padapter->HalFunc.mgnt_xmit) + if (padapter->HalFunc.mgnt_xmit) ret = padapter->HalFunc.mgnt_xmit(padapter, pmgntframe); return ret; } s32 rtw_hal_init_xmit_priv(struct adapter *padapter) { - if(padapter->HalFunc.init_xmit_priv != NULL) + if (padapter->HalFunc.init_xmit_priv != NULL) return padapter->HalFunc.init_xmit_priv(padapter); return _FAIL; } void rtw_hal_free_xmit_priv(struct adapter *padapter) { - if(padapter->HalFunc.free_xmit_priv != NULL) + if (padapter->HalFunc.free_xmit_priv != NULL) padapter->HalFunc.free_xmit_priv(padapter); } s32 rtw_hal_init_recv_priv(struct adapter *padapter) { - if(padapter->HalFunc.init_recv_priv) + if (padapter->HalFunc.init_recv_priv) return padapter->HalFunc.init_recv_priv(padapter); return _FAIL; @@ -324,7 +324,7 @@ s32 rtw_hal_init_recv_priv(struct adapter *padapter) void rtw_hal_free_recv_priv(struct adapter *padapter) { - if(padapter->HalFunc.free_recv_priv) + if (padapter->HalFunc.free_recv_priv) padapter->HalFunc.free_recv_priv(padapter); } @@ -333,119 +333,119 @@ void rtw_hal_update_ra_mask(struct sta_info *psta, u8 rssi_level) struct adapter *padapter; struct mlme_priv *pmlmepriv; - if(!psta) + if (!psta) return; padapter = psta->padapter; pmlmepriv = &(padapter->mlmepriv); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { add_RATid(padapter, psta, rssi_level); } else { - if(padapter->HalFunc.UpdateRAMaskHandler) + if (padapter->HalFunc.UpdateRAMaskHandler) padapter->HalFunc.UpdateRAMaskHandler(padapter, psta->mac_id, rssi_level); } } void rtw_hal_add_ra_tid(struct adapter *padapter, u32 bitmap, u8 arg, u8 rssi_level) { - if(padapter->HalFunc.Add_RateATid) + if (padapter->HalFunc.Add_RateATid) padapter->HalFunc.Add_RateATid(padapter, bitmap, arg, rssi_level); } /* Start specifical interface thread */ void rtw_hal_start_thread(struct adapter *padapter) { - if(padapter->HalFunc.run_thread) + if (padapter->HalFunc.run_thread) padapter->HalFunc.run_thread(padapter); } /* Start specifical interface thread */ void rtw_hal_stop_thread(struct adapter *padapter) { - if(padapter->HalFunc.cancel_thread) + if (padapter->HalFunc.cancel_thread) padapter->HalFunc.cancel_thread(padapter); } u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask) { u32 data = 0; - if(padapter->HalFunc.read_bbreg) + if (padapter->HalFunc.read_bbreg) data = padapter->HalFunc.read_bbreg(padapter, RegAddr, BitMask); return data; } void rtw_hal_write_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask, u32 Data) { - if(padapter->HalFunc.write_bbreg) + if (padapter->HalFunc.write_bbreg) padapter->HalFunc.write_bbreg(padapter, RegAddr, BitMask, Data); } u32 rtw_hal_read_rfreg(struct adapter *padapter, u32 eRFPath, u32 RegAddr, u32 BitMask) { u32 data = 0; - if( padapter->HalFunc.read_rfreg) + if ( padapter->HalFunc.read_rfreg) data = padapter->HalFunc.read_rfreg(padapter, eRFPath, RegAddr, BitMask); return data; } void rtw_hal_write_rfreg(struct adapter *padapter, u32 eRFPath, u32 RegAddr, u32 BitMask, u32 Data) { - if(padapter->HalFunc.write_rfreg) + if (padapter->HalFunc.write_rfreg) padapter->HalFunc.write_rfreg(padapter, eRFPath, RegAddr, BitMask, Data); } s32 rtw_hal_interrupt_handler(struct adapter *padapter) { - if(padapter->HalFunc.interrupt_handler) + if (padapter->HalFunc.interrupt_handler) return padapter->HalFunc.interrupt_handler(padapter); return _FAIL; } void rtw_hal_set_bwmode(struct adapter *padapter, enum HT_CHANNEL_WIDTH Bandwidth, u8 Offset) { - if(padapter->HalFunc.set_bwmode_handler) + if (padapter->HalFunc.set_bwmode_handler) padapter->HalFunc.set_bwmode_handler(padapter, Bandwidth, Offset); } void rtw_hal_set_chan(struct adapter *padapter, u8 channel) { - if(padapter->HalFunc.set_channel_handler) + if (padapter->HalFunc.set_channel_handler) padapter->HalFunc.set_channel_handler(padapter, channel); } void rtw_hal_dm_watchdog(struct adapter *padapter) { - if(padapter->HalFunc.hal_dm_watchdog) + if (padapter->HalFunc.hal_dm_watchdog) padapter->HalFunc.hal_dm_watchdog(padapter); } void rtw_hal_bcn_related_reg_setting(struct adapter *padapter) { - if(padapter->HalFunc.SetBeaconRelatedRegistersHandler) + if (padapter->HalFunc.SetBeaconRelatedRegistersHandler) padapter->HalFunc.SetBeaconRelatedRegistersHandler(padapter); } u8 rtw_hal_antdiv_before_linked(struct adapter *padapter) { - if(padapter->HalFunc.AntDivBeforeLinkHandler) + if (padapter->HalFunc.AntDivBeforeLinkHandler) return padapter->HalFunc.AntDivBeforeLinkHandler(padapter); return false; } void rtw_hal_antdiv_rssi_compared(struct adapter *padapter, struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src) { - if(padapter->HalFunc.AntDivCompareHandler) + if (padapter->HalFunc.AntDivCompareHandler) padapter->HalFunc.AntDivCompareHandler(padapter, dst, src); } #ifdef CONFIG_HOSTAPD_MLME s32 rtw_hal_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt) { - if(padapter->HalFunc.hostap_mgnt_xmit_entry) + if (padapter->HalFunc.hostap_mgnt_xmit_entry) return padapter->HalFunc.hostap_mgnt_xmit_entry(padapter, pkt); return _FAIL; } @@ -453,20 +453,20 @@ s32 rtw_hal_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt) void rtw_hal_sreset_init(struct adapter *padapter) { - if(padapter->HalFunc.sreset_init_value) + if (padapter->HalFunc.sreset_init_value) padapter->HalFunc.sreset_init_value(padapter); } void rtw_hal_sreset_reset(struct adapter *padapter) { padapter = GET_PRIMARY_ADAPTER(padapter); - if(padapter->HalFunc.silentreset) + if (padapter->HalFunc.silentreset) padapter->HalFunc.silentreset(padapter); } void rtw_hal_sreset_reset_value(struct adapter *padapter) { - if(padapter->HalFunc.sreset_reset_value) + if (padapter->HalFunc.sreset_reset_value) padapter->HalFunc.sreset_reset_value(padapter); } @@ -475,7 +475,7 @@ void rtw_hal_sreset_xmit_status_check(struct adapter *padapter) if (!is_primary_adapter(padapter)) return; - if(padapter->HalFunc.sreset_xmit_status_check) + if (padapter->HalFunc.sreset_xmit_status_check) padapter->HalFunc.sreset_xmit_status_check(padapter); } @@ -484,14 +484,14 @@ void rtw_hal_sreset_linked_status_check(struct adapter *padapter) if (!is_primary_adapter(padapter)) return; - if(padapter->HalFunc.sreset_linked_status_check) + if (padapter->HalFunc.sreset_linked_status_check) padapter->HalFunc.sreset_linked_status_check(padapter); } u8 rtw_hal_sreset_get_wifi_status(struct adapter *padapter) { u8 status = 0; - if(padapter->HalFunc.sreset_get_wifi_status) + if (padapter->HalFunc.sreset_get_wifi_status) status = padapter->HalFunc.sreset_get_wifi_status(padapter); return status; } @@ -502,27 +502,27 @@ bool rtw_hal_sreset_inprogress(struct adapter *padapter) padapter = GET_PRIMARY_ADAPTER(padapter); - if(padapter->HalFunc.sreset_inprogress) + if (padapter->HalFunc.sreset_inprogress) inprogress = padapter->HalFunc.sreset_inprogress(padapter); return inprogress; } int rtw_hal_iol_cmd(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt) { - if(adapter->HalFunc.IOL_exec_cmds_sync) + if (adapter->HalFunc.IOL_exec_cmds_sync) return adapter->HalFunc.IOL_exec_cmds_sync(adapter, xmit_frame, max_wating_ms,bndy_cnt); return _FAIL; } void rtw_hal_notch_filter(struct adapter *adapter, bool enable) { - if(adapter->HalFunc.hal_notch_filter) + if (adapter->HalFunc.hal_notch_filter) adapter->HalFunc.hal_notch_filter(adapter,enable); } void rtw_hal_reset_security_engine(struct adapter * adapter) { - if(adapter->HalFunc.hal_reset_security_engine) + if (adapter->HalFunc.hal_reset_security_engine) adapter->HalFunc.hal_reset_security_engine(adapter); } diff --git a/hal/odm.c b/hal/odm.c index ae1a7b4..7fdef9b 100644 --- a/hal/odm.c +++ b/hal/odm.c @@ -550,11 +550,11 @@ ODM_DMInit( odm_AdaptivityInit(pDM_Odm); odm_RateAdaptiveMaskInit(pDM_Odm); - if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) { } - else if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { odm_PrimaryCCA_Init(pDM_Odm); /* Gary */ odm_DynamicBBPowerSavingInit(pDM_Odm); @@ -562,13 +562,13 @@ ODM_DMInit( odm_TXPowerTrackingInit(pDM_Odm); ODM_EdcaTurboInit(pDM_Odm); ODM_RAInfo_Init_all(pDM_Odm); - if( ( pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV ) || + if ( ( pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV ) || ( pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV ) || ( pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV )) { odm_InitHybridAntDiv(pDM_Odm); } - else if( pDM_Odm->AntDivType == CGCS_RX_SW_ANTDIV) + else if ( pDM_Odm->AntDivType == CGCS_RX_SW_ANTDIV) { odm_SwAntDivInit(pDM_Odm); } @@ -594,7 +594,7 @@ ODM_DMWatchdog( odm_RSSIMonitorCheck(pDM_Odm); /* Fix Leave LPS issue */ - if( (adapter_to_pwrctl(pDM_Odm->Adapter)->pwr_mode != PS_MODE_ACTIVE) &&/* in LPS mode */ + if ( (adapter_to_pwrctl(pDM_Odm->Adapter)->pwr_mode != PS_MODE_ACTIVE) &&/* in LPS mode */ ( (pDM_Odm->SupportICType & (ODM_RTL8723A ) )|| (pDM_Odm->SupportICType & (ODM_RTL8188E) )/* pDM_Odm->SupportInterface == ODM_ITRF_SDIO)) ) */ @@ -612,7 +612,7 @@ ODM_DMWatchdog( odm_CCKPacketDetectionThresh(pDM_Odm); - if(*(pDM_Odm->pbPowerSaving)==true) + if (*(pDM_Odm->pbPowerSaving)==true) return; odm_Adaptivity(pDM_Odm, pDM_Odm->DM_DigTable.CurIGValue); @@ -622,22 +622,22 @@ ODM_DMWatchdog( odm_DynamicBBPowerSaving(pDM_Odm); odm_DynamicPrimaryCCA(pDM_Odm); - if( ( pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV ) || + if ( ( pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV ) || ( pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV ) || ( pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV )) { odm_HwAntDiv(pDM_Odm); } - else if( pDM_Odm->AntDivType == CGCS_RX_SW_ANTDIV) + else if ( pDM_Odm->AntDivType == CGCS_RX_SW_ANTDIV) { odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_PEAK); } - if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) { } - else if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + else if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { ODM_TXPowerTrackingCheck(pDM_Odm); odm_EdcaTurboCheck(pDM_Odm); @@ -948,7 +948,7 @@ ODM_CmnInfoUpdate( case ODM_CMNINFO_RA_THRESHOLD_LOW: pDM_Odm->RateAdaptive.LowRSSIThresh = (u8)Value; break; -#if(BT_30_SUPPORT == 1) +#if (BT_30_SUPPORT == 1) /* The following is for BT HS mode and BT coexist mechanism. */ case ODM_CMNINFO_BT_DISABLED: pDM_Odm->bBtDisabled = (bool)Value; @@ -983,9 +983,9 @@ odm_CommonInfoSelfInit( { pDM_Odm->bCckHighPower = (bool) ODM_GetBBReg(pDM_Odm, 0x824, BIT9); pDM_Odm->RFPathRxEnable = (u8) ODM_GetBBReg(pDM_Odm, 0xc04, 0x0F); - if(pDM_Odm->SupportICType & (ODM_RTL8192C|ODM_RTL8192D)) + if (pDM_Odm->SupportICType & (ODM_RTL8192C|ODM_RTL8192D)) pDM_Odm->AntDivType = CG_TRX_HW_ANTDIV; - if(pDM_Odm->SupportICType & (ODM_RTL8723A)) + if (pDM_Odm->SupportICType & (ODM_RTL8723A)) pDM_Odm->AntDivType = CGCS_RX_SW_ANTDIV; ODM_InitDebugSetting(pDM_Odm); @@ -1000,20 +1000,20 @@ odm_CommonInfoSelfUpdate( u8 i; PSTA_INFO_T pEntry; - if(*(pDM_Odm->pBandWidth) == ODM_BW40M) { - if(*(pDM_Odm->pSecChOffset) == 1) + if (*(pDM_Odm->pBandWidth) == ODM_BW40M) { + if (*(pDM_Odm->pSecChOffset) == 1) pDM_Odm->ControlChannel = *(pDM_Odm->pChannel) -2; - else if(*(pDM_Odm->pSecChOffset) == 2) + else if (*(pDM_Odm->pSecChOffset) == 2) pDM_Odm->ControlChannel = *(pDM_Odm->pChannel) +2; } else pDM_Odm->ControlChannel = *(pDM_Odm->pChannel); for (i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pEntry)) + if (IS_STA_VALID(pEntry)) EntryCnt++; } - if(EntryCnt == 1) + if (EntryCnt == 1) pDM_Odm->bOneEntryOnly = true; else pDM_Odm->bOneEntryOnly = false; @@ -1060,7 +1060,7 @@ odm_CmnInfoHook_Debug( ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pbScanInProcess=%d\n",*(pDM_Odm->pbScanInProcess)) ); ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pbPowerSaving=%d\n",*(pDM_Odm->pbPowerSaving)) ); - if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) + if (pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) ODM_RT_TRACE(pDM_Odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("pOnePathCCA=%d\n",*(pDM_Odm->pOnePathCCA)) ); } @@ -1121,19 +1121,19 @@ ODM_ChangeDynamicInitGainThresh( } else if (DM_Type == DIG_TYPE_BACKOFF) { - if(DM_Value > 30) + if (DM_Value > 30) DM_Value = 30; pDM_DigTable->BackoffVal = (u8)DM_Value; } - else if(DM_Type == DIG_TYPE_RX_GAIN_MIN) + else if (DM_Type == DIG_TYPE_RX_GAIN_MIN) { - if(DM_Value == 0) + if (DM_Value == 0) DM_Value = 0x1; pDM_DigTable->rx_gain_range_min = (u8)DM_Value; } - else if(DM_Type == DIG_TYPE_RX_GAIN_MAX) + else if (DM_Type == DIG_TYPE_RX_GAIN_MAX) { - if(DM_Value > 0x50) + if (DM_Value > 0x50) DM_Value = 0x50; pDM_DigTable->rx_gain_range_max = (u8)DM_Value; } @@ -1165,27 +1165,27 @@ ODM_Write_DIG( ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("ODM_REG(IGI_A,pDM_Odm)=0x%x, ODM_BIT(IGI,pDM_Odm)=0x%x\n", ODM_REG(IGI_A,pDM_Odm),ODM_BIT(IGI,pDM_Odm))); - if(pDM_DigTable->CurIGValue != CurrentIGI)/* if(pDM_DigTable->PreIGValue != CurrentIGI) */ + if (pDM_DigTable->CurIGValue != CurrentIGI)/* if (pDM_DigTable->PreIGValue != CurrentIGI) */ { - if(pDM_Odm->SupportPlatform & (ODM_CE|ODM_MP)) { + if (pDM_Odm->SupportPlatform & (ODM_CE|ODM_MP)) { ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - if(pDM_Odm->SupportICType != ODM_RTL8188E) + if (pDM_Odm->SupportICType != ODM_RTL8188E) ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - } else if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) { + } else if (pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) { switch(*(pDM_Odm->pOnePathCCA)) { case ODM_CCA_2R: ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - if(pDM_Odm->SupportICType != ODM_RTL8188E) + if (pDM_Odm->SupportICType != ODM_RTL8188E) ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); break; case ODM_CCA_1R_A: ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); - if(pDM_Odm->SupportICType != ODM_RTL8188E) + if (pDM_Odm->SupportICType != ODM_RTL8188E) ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), getIGIForDiff(CurrentIGI)); break; case ODM_CCA_1R_B: ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_A,pDM_Odm), ODM_BIT(IGI,pDM_Odm), getIGIForDiff(CurrentIGI)); - if(pDM_Odm->SupportICType != ODM_RTL8188E) + if (pDM_Odm->SupportICType != ODM_RTL8188E) ODM_SetBBReg(pDM_Odm, ODM_REG(IGI_B,pDM_Odm), ODM_BIT(IGI,pDM_Odm), CurrentIGI); break; } @@ -1212,7 +1212,7 @@ odm_DIGbyRSSI_LPS( u8 bFwCurrentInPSMode = false; u8 CurrentIGI=pDM_Odm->RSSI_Min; - if(! (pDM_Odm->SupportICType & (ODM_RTL8723A |ODM_RTL8188E))) + if (! (pDM_Odm->SupportICType & (ODM_RTL8723A |ODM_RTL8188E))) return; CurrentIGI=CurrentIGI+RSSI_OFFSET_DIG; @@ -1221,15 +1221,15 @@ odm_DIGbyRSSI_LPS( ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("==>pDM_Odm->RSSI_Min=%d ()\n",pDM_Odm->RSSI_Min)); /* Using FW PS mode to make IGI */ - if(bFwCurrentInPSMode) + if (bFwCurrentInPSMode) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("---Neil---odm_DIG is in LPS mode\n")); /* Adjust by FA in LPS MODE */ - if(pFalseAlmCnt->Cnt_all> DM_DIG_FA_TH2_LPS) + if (pFalseAlmCnt->Cnt_all> DM_DIG_FA_TH2_LPS) CurrentIGI = CurrentIGI+2; else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1_LPS) CurrentIGI = CurrentIGI+1; - else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0_LPS) + else if (pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0_LPS) CurrentIGI = CurrentIGI-1; } else @@ -1240,15 +1240,15 @@ odm_DIGbyRSSI_LPS( /* Lower bound checking */ /* RSSI Lower bound check */ - if((pDM_Odm->RSSI_Min-10) > DM_DIG_MIN_NIC) + if ((pDM_Odm->RSSI_Min-10) > DM_DIG_MIN_NIC) RSSI_Lower =(pDM_Odm->RSSI_Min-10); else RSSI_Lower =DM_DIG_MIN_NIC; /* Upper and Lower Bound checking */ - if(CurrentIGI > DM_DIG_MAX_NIC) + if (CurrentIGI > DM_DIG_MAX_NIC) CurrentIGI=DM_DIG_MAX_NIC; - else if(CurrentIGI < RSSI_Lower) + else if (CurrentIGI < RSSI_Lower) CurrentIGI =RSSI_Lower; ODM_Write_DIG(pDM_Odm, CurrentIGI);/* ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); */ @@ -1260,11 +1260,11 @@ odm_AdaptivityInit( PDM_ODM_T pDM_Odm ) { - if(pDM_Odm->SupportICType == ODM_RTL8723B) + if (pDM_Odm->SupportICType == ODM_RTL8723B) { pDM_Odm->TH_L2H_ini = 0xf8; /* -8 */ } - if((pDM_Odm->SupportICType == ODM_RTL8192E)&&(pDM_Odm->SupportInterface == ODM_ITRF_PCIE)) + if ((pDM_Odm->SupportICType == ODM_RTL8192E)&&(pDM_Odm->SupportInterface == ODM_ITRF_PCIE)) { pDM_Odm->TH_L2H_ini = 0xf0; /* -16 */ } @@ -1292,7 +1292,7 @@ odm_Adaptivity( u32 value32; bool EDCCA_State = 0; - if(!(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY)) { + if (!(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY)) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("Go to odm_DynamicEDCCA()\n")); return; } @@ -1301,12 +1301,12 @@ odm_Adaptivity( ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("ForceEDCCA=%d, IGI_Base=0x%x, TH_L2H_ini = %d, TH_EDCCA_HL_diff = %d, AdapEn_RSSI = %d\n", pDM_Odm->ForceEDCCA, pDM_Odm->IGI_Base, pDM_Odm->TH_L2H_ini, pDM_Odm->TH_EDCCA_HL_diff, pDM_Odm->AdapEn_RSSI)); - if(pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) + if (pDM_Odm->SupportICType & ODM_IC_11AC_SERIES) ODM_SetBBReg(pDM_Odm, 0x800, BIT10, 0); /* ADC_mask enable */ - if((!pDM_Odm->bLinked)||(*pDM_Odm->pChannel > 149)) /* Band4 doesn't need adaptivity */ + if ((!pDM_Odm->bLinked)||(*pDM_Odm->pChannel > 149)) /* Band4 doesn't need adaptivity */ { - if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte0, 0x7f); ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte2, 0x7f); @@ -1315,21 +1315,21 @@ odm_Adaptivity( ODM_SetBBReg(pDM_Odm, rFPGA0_XB_LSSIReadBack, 0xFFFF, (0x7f<<8) | 0x7f); return; } - if(!pDM_Odm->ForceEDCCA) { - if(pDM_Odm->RSSI_Min > pDM_Odm->AdapEn_RSSI) + if (!pDM_Odm->ForceEDCCA) { + if (pDM_Odm->RSSI_Min > pDM_Odm->AdapEn_RSSI) EDCCA_State = 1; - else if(pDM_Odm->RSSI_Min < (pDM_Odm->AdapEn_RSSI - 5)) + else if (pDM_Odm->RSSI_Min < (pDM_Odm->AdapEn_RSSI - 5)) EDCCA_State = 0; } else EDCCA_State = 1; { - if(*pDM_Odm->pBandWidth == ODM_BW20M) /* CHANNEL_WIDTH_20 */ + if (*pDM_Odm->pBandWidth == ODM_BW20M) /* CHANNEL_WIDTH_20 */ IGI_target = pDM_Odm->IGI_Base; - else if(*pDM_Odm->pBandWidth == ODM_BW40M) + else if (*pDM_Odm->pBandWidth == ODM_BW40M) IGI_target = pDM_Odm->IGI_Base + 2; - else if(*pDM_Odm->pBandWidth == ODM_BW80M) + else if (*pDM_Odm->pBandWidth == ODM_BW80M) IGI_target = pDM_Odm->IGI_Base + 6; else IGI_target = pDM_Odm->IGI_Base; @@ -1340,11 +1340,11 @@ odm_Adaptivity( ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("BandWidth=%s, IGI_target=0x%x, EDCCA_State=%d\n", (*pDM_Odm->pBandWidth==ODM_BW80M)?"80M":((*pDM_Odm->pBandWidth==ODM_BW40M)?"40M":"20M"), IGI_target, EDCCA_State)); - if(EDCCA_State == 1) + if (EDCCA_State == 1) { Diff = IGI_target -(s8)IGI; TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff; - if(TH_L2H_dmc > 10) TH_L2H_dmc = 10; + if (TH_L2H_dmc > 10) TH_L2H_dmc = 10; TH_H2L_dmc = TH_L2H_dmc - pDM_Odm->TH_EDCCA_HL_diff; } else @@ -1355,7 +1355,7 @@ odm_Adaptivity( ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("IGI=0x%x, TH_L2H_dmc = %d, TH_H2L_dmc = %d\n", IGI, TH_L2H_dmc, TH_H2L_dmc)); - if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) + if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte0, (u8)TH_L2H_dmc); ODM_SetBBReg(pDM_Odm,rOFDM0_ECCAThreshold, bMaskByte2, (u8)TH_H2L_dmc); @@ -1381,7 +1381,7 @@ odm_DIGInit( pDM_DigTable->RssiHighThresh = DM_DIG_THRESH_HIGH; pDM_DigTable->FALowThresh = DMfalseALARM_THRESH_LOW; pDM_DigTable->FAHighThresh = DMfalseALARM_THRESH_HIGH; - if(pDM_Odm->BoardType & (ODM_BOARD_EXT_PA|ODM_BOARD_EXT_LNA)) + if (pDM_Odm->BoardType & (ODM_BOARD_EXT_PA|ODM_BOARD_EXT_LNA)) { pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC; @@ -1435,33 +1435,33 @@ odm_DIG( u8 Adap_IGI_Upper = pDM_Odm->IGI_target + 30 + (u8) pDM_Odm->TH_L2H_ini -(u8) pDM_Odm->TH_EDCCA_HL_diff; ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG()==>\n")); - if((!(pDM_Odm->SupportAbility&ODM_BB_DIG)) ||(!(pDM_Odm->SupportAbility&ODM_BB_FA_CNT))) + if ((!(pDM_Odm->SupportAbility&ODM_BB_DIG)) ||(!(pDM_Odm->SupportAbility&ODM_BB_FA_CNT))) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: SupportAbility ODM_BB_DIG or ODM_BB_FA_CNT is disabled\n")); return; } - if(*(pDM_Odm->pbScanInProcess)) + if (*(pDM_Odm->pbScanInProcess)) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: In Scan Progress\n")); return; } /* add by Neil Chen to avoid PSD is processing */ - if(pDM_Odm->SupportICType==ODM_RTL8723A) + if (pDM_Odm->SupportICType==ODM_RTL8723A) { - if(pDM_Odm->bDMInitialGainEnable == false) + if (pDM_Odm->bDMInitialGainEnable == false) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG() Return: PSD is Processing\n")); return; } } - if(pDM_Odm->SupportICType == ODM_RTL8192D) + if (pDM_Odm->SupportICType == ODM_RTL8192D) { - if(*(pDM_Odm->pMacPhyMode) == ODM_DMSP) + if (*(pDM_Odm->pMacPhyMode) == ODM_DMSP) { - if(*(pDM_Odm->pbMasterOfDMSP)) + if (*(pDM_Odm->pbMasterOfDMSP)) { DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == false); @@ -1476,7 +1476,7 @@ odm_DIG( } else { - if(*(pDM_Odm->pBandType) == ODM_BAND_5G) + if (*(pDM_Odm->pBandType) == ODM_BAND_5G) { DIG_Dynamic_MIN = pDM_DigTable->DIG_Dynamic_MIN_0; FirstConnect = (pDM_Odm->bLinked) && (pDM_DigTable->bMediaConnect_0 == false); @@ -1498,9 +1498,9 @@ odm_DIG( } /* 1 Boundary Decision */ - if(pDM_Odm->SupportICType & (ODM_RTL8192C) &&(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA))) + if (pDM_Odm->SupportICType & (ODM_RTL8192C) &&(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA))) { - if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) + if (pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) { dm_dig_max = DM_DIG_MAX_AP_HP; @@ -1515,7 +1515,7 @@ odm_DIG( } else { - if(pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) + if (pDM_Odm->SupportPlatform & (ODM_AP|ODM_ADSL)) { dm_dig_max = DM_DIG_MAX_AP; dm_dig_min = DM_DIG_MIN_AP; @@ -1523,12 +1523,12 @@ odm_DIG( } else { - if((pDM_Odm->SupportICType >= ODM_RTL8188E) && (pDM_Odm->SupportPlatform & (ODM_MP|ODM_CE))) + if ((pDM_Odm->SupportICType >= ODM_RTL8188E) && (pDM_Odm->SupportPlatform & (ODM_MP|ODM_CE))) dm_dig_max = 0x5A; else dm_dig_max = DM_DIG_MAX_NIC; - if(pDM_Odm->SupportICType != ODM_RTL8821) + if (pDM_Odm->SupportICType != ODM_RTL8821) dm_dig_min = DM_DIG_MIN_NIC; else dm_dig_min = 0x1C; @@ -1538,27 +1538,27 @@ odm_DIG( } - if(pDM_Odm->bLinked) + if (pDM_Odm->bLinked) { - if(pDM_Odm->SupportICType&(ODM_RTL8723A/*|ODM_RTL8821*/)) + if (pDM_Odm->SupportICType&(ODM_RTL8723A/*|ODM_RTL8821*/)) { /* 2 Upper Bound */ - if(( pDM_Odm->RSSI_Min + 10) > DM_DIG_MAX_NIC ) + if (( pDM_Odm->RSSI_Min + 10) > DM_DIG_MAX_NIC ) pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; - else if(( pDM_Odm->RSSI_Min + 10) < DM_DIG_MIN_NIC ) + else if (( pDM_Odm->RSSI_Min + 10) < DM_DIG_MIN_NIC ) pDM_DigTable->rx_gain_range_max = DM_DIG_MIN_NIC; else pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 10; /* BT is Concurrent */ - if(pDM_Odm->bBtLimitedDig) + if (pDM_Odm->bBtLimitedDig) { - if(pDM_Odm->RSSI_Min>10) + if (pDM_Odm->RSSI_Min>10) { - if((pDM_Odm->RSSI_Min - 10) > DM_DIG_MAX_NIC) + if ((pDM_Odm->RSSI_Min - 10) > DM_DIG_MAX_NIC) DIG_Dynamic_MIN = DM_DIG_MAX_NIC; - else if((pDM_Odm->RSSI_Min - 10) < DM_DIG_MIN_NIC) + else if ((pDM_Odm->RSSI_Min - 10) < DM_DIG_MIN_NIC) DIG_Dynamic_MIN = DM_DIG_MIN_NIC; else DIG_Dynamic_MIN = pDM_Odm->RSSI_Min - 10; @@ -1568,9 +1568,9 @@ odm_DIG( } else { - if((pDM_Odm->RSSI_Min + 20) > dm_dig_max ) + if ((pDM_Odm->RSSI_Min + 20) > dm_dig_max ) pDM_DigTable->rx_gain_range_max = dm_dig_max; - else if((pDM_Odm->RSSI_Min + 20) < dm_dig_min ) + else if ((pDM_Odm->RSSI_Min + 20) < dm_dig_min ) pDM_DigTable->rx_gain_range_max = dm_dig_min; else pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 20; @@ -1579,11 +1579,11 @@ odm_DIG( } else { - if((pDM_Odm->SupportICType & (ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8812|ODM_RTL8821)) && (pDM_Odm->bBtLimitedDig==1)){ + if ((pDM_Odm->SupportICType & (ODM_RTL8192E|ODM_RTL8723B|ODM_RTL8812|ODM_RTL8821)) && (pDM_Odm->bBtLimitedDig==1)){ /* 2 Modify DIG upper bound for 92E, 8723B, 8821 & 8812 BT */ - if((pDM_Odm->RSSI_Min + 10) > dm_dig_max ) + if ((pDM_Odm->RSSI_Min + 10) > dm_dig_max ) pDM_DigTable->rx_gain_range_max = dm_dig_max; - else if((pDM_Odm->RSSI_Min + 10) < dm_dig_min ) + else if ((pDM_Odm->RSSI_Min + 10) < dm_dig_min ) pDM_DigTable->rx_gain_range_max = dm_dig_min; else pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + 10; @@ -1592,14 +1592,14 @@ odm_DIG( /* 2 Modify DIG upper bound */ /* 2013.03.19 Luke: Modified upper bound for Netgear rental house test */ - if(pDM_Odm->SupportICType != ODM_RTL8821) + if (pDM_Odm->SupportICType != ODM_RTL8821) offset = 20; else offset = 10; - if((pDM_Odm->RSSI_Min + offset) > dm_dig_max ) + if ((pDM_Odm->RSSI_Min + offset) > dm_dig_max ) pDM_DigTable->rx_gain_range_max = dm_dig_max; - else if((pDM_Odm->RSSI_Min + offset) < dm_dig_min ) + else if ((pDM_Odm->RSSI_Min + offset) < dm_dig_min ) pDM_DigTable->rx_gain_range_max = dm_dig_min; else pDM_DigTable->rx_gain_range_max = pDM_Odm->RSSI_Min + offset; @@ -1607,9 +1607,9 @@ odm_DIG( } /* 1 Lower Bound for 88E AntDiv */ - if((pDM_Odm->SupportICType == ODM_RTL8188E)&&(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) + if ((pDM_Odm->SupportICType == ODM_RTL8188E)&&(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) { - if((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) ||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)) + if ((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) ||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)) { DIG_Dynamic_MIN = (u8) pDM_DigTable->AntDiv_RSSI_max; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_DIG(): pDM_DigTable->AntDiv_RSSI_max=%d\n",pDM_DigTable->AntDiv_RSSI_max)); @@ -1617,12 +1617,12 @@ odm_DIG( } else { - if(pDM_Odm->SupportICType != ODM_RTL8723B) + if (pDM_Odm->SupportICType != ODM_RTL8723B) offset = 0; else offset = 12; - if(pDM_Odm->RSSI_Min - offset < dm_dig_min) + if (pDM_Odm->RSSI_Min - offset < dm_dig_min) DIG_Dynamic_MIN = dm_dig_min; else if (pDM_Odm->RSSI_Min - offset > DIG_MaxOfMin) DIG_Dynamic_MIN = DIG_MaxOfMin; @@ -1644,21 +1644,21 @@ odm_DIG( } /* 1 Modify DIG lower bound, deal with abnorally large false alarm */ - if(pFalseAlmCnt->Cnt_all > 10000) + if (pFalseAlmCnt->Cnt_all > 10000) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("dm_DIG(): Abnornally false alarm case.\n")); - if(pDM_DigTable->LargeFAHit != 3) + if (pDM_DigTable->LargeFAHit != 3) pDM_DigTable->LargeFAHit++; - if(pDM_DigTable->ForbiddenIGI < CurrentIGI)/* if(pDM_DigTable->ForbiddenIGI < pDM_DigTable->CurIGValue) */ + if (pDM_DigTable->ForbiddenIGI < CurrentIGI)/* if (pDM_DigTable->ForbiddenIGI < pDM_DigTable->CurIGValue) */ { pDM_DigTable->ForbiddenIGI = (u8)CurrentIGI;/* pDM_DigTable->ForbiddenIGI = pDM_DigTable->CurIGValue; */ pDM_DigTable->LargeFAHit = 1; } - if(pDM_DigTable->LargeFAHit >= 3) + if (pDM_DigTable->LargeFAHit >= 3) { - if((pDM_DigTable->ForbiddenIGI+1) >pDM_DigTable->rx_gain_range_max) + if ((pDM_DigTable->ForbiddenIGI+1) >pDM_DigTable->rx_gain_range_max) pDM_DigTable->rx_gain_range_min = pDM_DigTable->rx_gain_range_max; else pDM_DigTable->rx_gain_range_min = (pDM_DigTable->ForbiddenIGI + 1); @@ -1669,13 +1669,13 @@ odm_DIG( else { /* Recovery mechanism for IGI lower bound */ - if(pDM_DigTable->Recover_cnt != 0) + if (pDM_DigTable->Recover_cnt != 0) pDM_DigTable->Recover_cnt --; else { - if(pDM_DigTable->LargeFAHit < 3) + if (pDM_DigTable->LargeFAHit < 3) { - if((pDM_DigTable->ForbiddenIGI -1) < DIG_Dynamic_MIN) /* DM_DIG_MIN) */ + if ((pDM_DigTable->ForbiddenIGI -1) < DIG_Dynamic_MIN) /* DM_DIG_MIN) */ { pDM_DigTable->ForbiddenIGI = DIG_Dynamic_MIN; /* DM_DIG_MIN; */ pDM_DigTable->rx_gain_range_min = DIG_Dynamic_MIN; /* DM_DIG_MIN; */ @@ -1696,19 +1696,19 @@ odm_DIG( } ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): pDM_DigTable->LargeFAHit=%d\n",pDM_DigTable->LargeFAHit)); - if((pDM_Odm->SupportPlatform&(ODM_MP|ODM_CE))&&(pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 10) && (pDM_Odm->bsta_state)) + if ((pDM_Odm->SupportPlatform&(ODM_MP|ODM_CE))&&(pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 10) && (pDM_Odm->bsta_state)) pDM_DigTable->rx_gain_range_min = dm_dig_min; - if(pDM_DigTable->rx_gain_range_min > pDM_DigTable->rx_gain_range_max) + if (pDM_DigTable->rx_gain_range_min > pDM_DigTable->rx_gain_range_max) pDM_DigTable->rx_gain_range_min = pDM_DigTable->rx_gain_range_max; /* 1 Adjust initial gain by false alarm */ - if(pDM_Odm->bLinked) + if (pDM_Odm->bLinked) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG AfterLink\n")); - if(FirstConnect) + if (FirstConnect) { - if(pDM_Odm->RSSI_Min <= DIG_MaxOfMin) + if (pDM_Odm->RSSI_Min <= DIG_MaxOfMin) CurrentIGI = pDM_Odm->RSSI_Min; else CurrentIGI = DIG_MaxOfMin; @@ -1718,50 +1718,50 @@ odm_DIG( } else { - if(pDM_Odm->SupportICType == ODM_RTL8192D) + if (pDM_Odm->SupportICType == ODM_RTL8192D) { - if(pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH2_92D) + if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH2_92D) CurrentIGI = CurrentIGI + 4;/* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+2; */ else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1_92D) CurrentIGI = CurrentIGI + 2; /* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; */ - else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0_92D) + else if (pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0_92D) CurrentIGI = CurrentIGI - 2;/* pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; */ } else { /* FA for Combo IC--NeilChen--2012--09--28 */ - if(pDM_Odm->SupportICType == ODM_RTL8723A) + if (pDM_Odm->SupportICType == ODM_RTL8723A) { /* WLAN and BT ConCurrent */ - if(pDM_Odm->bBtLimitedDig) + if (pDM_Odm->bBtLimitedDig) { - if(pFalseAlmCnt->Cnt_all > 0x300) + if (pFalseAlmCnt->Cnt_all > 0x300) CurrentIGI = CurrentIGI + 4; else if (pFalseAlmCnt->Cnt_all > 0x250) CurrentIGI = CurrentIGI + 2; - else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) + else if (pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) CurrentIGI = CurrentIGI -2; } else /* Not Concurrent */ { - if(pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH2) + if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH2) CurrentIGI = CurrentIGI + 4;/* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+2; */ else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1) CurrentIGI = CurrentIGI + 2;/* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; */ - else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) + else if (pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) CurrentIGI = CurrentIGI - 2;/* pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; */ } } else { - if(pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH2) + if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH2) CurrentIGI = CurrentIGI + 4;/* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+2; */ else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1) CurrentIGI = CurrentIGI + 2;/* pDM_DigTable->CurIGValue = pDM_DigTable->PreIGValue+1; */ - else if(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) + else if (pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH0) CurrentIGI = CurrentIGI - 2;/* pDM_DigTable->CurIGValue =pDM_DigTable->PreIGValue-1; */ - if((pDM_Odm->SupportPlatform&(ODM_MP|ODM_CE))&&(pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 10) + if ((pDM_Odm->SupportPlatform&(ODM_MP|ODM_CE))&&(pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 10) &&(pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH1) && (pDM_Odm->bsta_state)) { CurrentIGI = pDM_DigTable->rx_gain_range_min; @@ -1772,7 +1772,7 @@ odm_DIG( } } else { ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG BeforeLink\n")); - if(FirstDisConnect) + if (FirstDisConnect) { CurrentIGI = pDM_DigTable->rx_gain_range_min; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): First DisConnect\n")); @@ -1780,11 +1780,11 @@ odm_DIG( else { /* 2012.03.30 LukeLee: enable DIG before link but with very high thresholds */ - if(pFalseAlmCnt->Cnt_all > 10000) + if (pFalseAlmCnt->Cnt_all > 10000) CurrentIGI = CurrentIGI + 4; else if (pFalseAlmCnt->Cnt_all > 8000) CurrentIGI = CurrentIGI + 2; - else if(pFalseAlmCnt->Cnt_all < 500) + else if (pFalseAlmCnt->Cnt_all < 500) CurrentIGI = CurrentIGI - 2; ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): England DIG\n")); } @@ -1792,17 +1792,17 @@ odm_DIG( ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DIG End Adjust IGI\n")); /* 1 Check initial gain by upper/lower bound */ - if(CurrentIGI > pDM_DigTable->rx_gain_range_max) + if (CurrentIGI > pDM_DigTable->rx_gain_range_max) CurrentIGI = pDM_DigTable->rx_gain_range_max; - if(CurrentIGI < pDM_DigTable->rx_gain_range_min) + if (CurrentIGI < pDM_DigTable->rx_gain_range_min) CurrentIGI = pDM_DigTable->rx_gain_range_min; - if(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY) + if (pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY) { - if(CurrentIGI > Adap_IGI_Upper) + if (CurrentIGI > Adap_IGI_Upper) CurrentIGI = Adap_IGI_Upper; - if(CurrentIGI > (pDM_Odm->IGI_target + 4)) + if (CurrentIGI > (pDM_Odm->IGI_target + 4)) CurrentIGI = (u8)pDM_Odm->IGI_target + 4; } @@ -1814,12 +1814,12 @@ odm_DIG( /* 2 High power RSSI threshold */ { - #if(BT_30_SUPPORT == 1) - if(pDM_Odm->bBtHsOperation) + #if (BT_30_SUPPORT == 1) + if (pDM_Odm->bBtHsOperation) { - if(pDM_Odm->bLinked) + if (pDM_Odm->bLinked) { - if(pDM_DigTable->BT30_CurIGI > (CurrentIGI)) + if (pDM_DigTable->BT30_CurIGI > (CurrentIGI)) { ODM_Write_DIG(pDM_Odm, CurrentIGI); @@ -1833,11 +1833,11 @@ odm_DIG( } else { - if(pDM_Odm->bLinkInProcess) + if (pDM_Odm->bLinkInProcess) { ODM_Write_DIG(pDM_Odm, 0x1c); } - else if(pDM_Odm->bBtConnectProcess) + else if (pDM_Odm->bBtConnectProcess) { ODM_Write_DIG(pDM_Odm, 0x28); } @@ -1878,10 +1878,10 @@ odm_FalseAlarmCounterStatistics( u32 ret_value; Pfalse_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); - if(!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) + if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) return; - if(pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { + if (pDM_Odm->SupportICType & ODM_IC_11N_SERIES) { /* hold ofdm counter */ ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_HOLDC_11N, BIT31, 1); /* hold page C counter */ ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTD_11N, BIT31, 1); /* hold page D counter */ @@ -1902,7 +1902,7 @@ odm_FalseAlarmCounterStatistics( FalseAlmCnt->Cnt_Crc8_fail + FalseAlmCnt->Cnt_Mcs_fail + FalseAlmCnt->Cnt_Fast_Fsync + FalseAlmCnt->Cnt_SB_Search_fail; - if(pDM_Odm->SupportICType == ODM_RTL8188E) + if (pDM_Odm->SupportICType == ODM_RTL8188E) { ret_value = ODM_GetBBReg(pDM_Odm, ODM_REG_SC_CNT_11N, bMaskDWord); FalseAlmCnt->Cnt_BW_LSC = (ret_value&0xffff); @@ -1931,7 +1931,7 @@ odm_FalseAlarmCounterStatistics( FalseAlmCnt->Cnt_CCA_all = FalseAlmCnt->Cnt_OFDM_CCA + FalseAlmCnt->Cnt_CCK_CCA; - if(pDM_Odm->SupportICType >=ODM_RTL8723A) + if (pDM_Odm->SupportICType >=ODM_RTL8723A) { /* reset false alarm counter registers */ ODM_SetBBReg(pDM_Odm, ODM_REG_OFDM_FA_RSTC_11N, BIT31, 1); @@ -1991,21 +1991,21 @@ odm_CCKPacketDetectionThresh( u8 CurCCK_CCAThres; Pfalse_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); - if(!(pDM_Odm->SupportAbility & (ODM_BB_CCK_PD|ODM_BB_FA_CNT))) + if (!(pDM_Odm->SupportAbility & (ODM_BB_CCK_PD|ODM_BB_FA_CNT))) return; - if(pDM_Odm->ExtLNA) + if (pDM_Odm->ExtLNA) return; - if(pDM_Odm->bLinked) + if (pDM_Odm->bLinked) { - if(pDM_Odm->RSSI_Min > 25) + if (pDM_Odm->RSSI_Min > 25) CurCCK_CCAThres = 0xcd; - else if((pDM_Odm->RSSI_Min <= 25) && (pDM_Odm->RSSI_Min > 10)) + else if ((pDM_Odm->RSSI_Min <= 25) && (pDM_Odm->RSSI_Min > 10)) CurCCK_CCAThres = 0x83; else { - if(FalseAlmCnt->Cnt_Cck_fail > 1000) + if (FalseAlmCnt->Cnt_Cck_fail > 1000) CurCCK_CCAThres = 0x83; else CurCCK_CCAThres = 0x40; @@ -2013,7 +2013,7 @@ odm_CCKPacketDetectionThresh( } else { - if(FalseAlmCnt->Cnt_Cck_fail > 1000) + if (FalseAlmCnt->Cnt_Cck_fail > 1000) CurCCK_CCAThres = 0x83; else CurCCK_CCAThres = 0x40; @@ -2030,7 +2030,7 @@ ODM_Write_CCK_CCA_Thres( { pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - if(pDM_DigTable->CurCCK_CCAThres!=CurCCK_CCAThres) /* modify by Guo.Mingzhi 2012-01-03 */ + if (pDM_DigTable->CurCCK_CCAThres!=CurCCK_CCAThres) /* modify by Guo.Mingzhi 2012-01-03 */ { ODM_Write1Byte(pDM_Odm, ODM_REG(CCK_CCA,pDM_Odm), CurCCK_CCAThres); } @@ -2065,13 +2065,13 @@ odm_DynamicBBPowerSaving( { if ((pDM_Odm->SupportICType != ODM_RTL8192C) && (pDM_Odm->SupportICType != ODM_RTL8723A)) return; - if(!(pDM_Odm->SupportAbility & ODM_BB_PWR_SAVE)) + if (!(pDM_Odm->SupportAbility & ODM_BB_PWR_SAVE)) return; - if(!(pDM_Odm->SupportPlatform & (ODM_MP|ODM_CE))) + if (!(pDM_Odm->SupportPlatform & (ODM_MP|ODM_CE))) return; /* 1 2.Power Saving for 92C */ - if((pDM_Odm->SupportICType == ODM_RTL8192C) &&(pDM_Odm->RFType == ODM_2T2R)) + if ((pDM_Odm->SupportICType == ODM_RTL8192C) &&(pDM_Odm->RFType == ODM_2T2R)) { odm_1R_CCA(pDM_Odm); } @@ -2092,19 +2092,19 @@ odm_1R_CCA( { pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; - if(pDM_Odm->RSSI_Min!= 0xFF) + if (pDM_Odm->RSSI_Min!= 0xFF) { - if(pDM_PSTable->PreCCAState == CCA_2R) + if (pDM_PSTable->PreCCAState == CCA_2R) { - if(pDM_Odm->RSSI_Min >= 35) + if (pDM_Odm->RSSI_Min >= 35) pDM_PSTable->CurCCAState = CCA_1R; else pDM_PSTable->CurCCAState = CCA_2R; } else{ - if(pDM_Odm->RSSI_Min <= 30) + if (pDM_Odm->RSSI_Min <= 30) pDM_PSTable->CurCCAState = CCA_2R; else pDM_PSTable->CurCCAState = CCA_1R; @@ -2113,9 +2113,9 @@ odm_1R_CCA( pDM_PSTable->CurCCAState=CCA_MAX; } - if(pDM_PSTable->PreCCAState != pDM_PSTable->CurCCAState) { - if(pDM_PSTable->CurCCAState == CCA_1R) { - if( pDM_Odm->RFType ==ODM_2T2R ) + if (pDM_PSTable->PreCCAState != pDM_PSTable->CurCCAState) { + if (pDM_PSTable->CurCCAState == CCA_1R) { + if ( pDM_Odm->RFType ==ODM_2T2R ) ODM_SetBBReg(pDM_Odm, 0xc04 , bMaskByte0, 0x13); else ODM_SetBBReg(pDM_Odm, 0xc04 , bMaskByte0, 0x23); @@ -2136,12 +2136,12 @@ ODM_RF_Saving( pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; u8 Rssi_Up_bound = 30 ; u8 Rssi_Low_bound = 25; - if(pDM_Odm->PatchID == 40 ) /* RT_CID_819x_FUNAI_TV */ + if (pDM_Odm->PatchID == 40 ) /* RT_CID_819x_FUNAI_TV */ { Rssi_Up_bound = 50 ; Rssi_Low_bound = 45; } - if(pDM_PSTable->initialize == 0){ + if (pDM_PSTable->initialize == 0){ pDM_PSTable->Reg874 = (ODM_GetBBReg(pDM_Odm, 0x874, bMaskDWord)&0x1CC000)>>14; pDM_PSTable->RegC70 = (ODM_GetBBReg(pDM_Odm, 0xc70, bMaskDWord)&BIT3)>>3; @@ -2151,19 +2151,19 @@ ODM_RF_Saving( pDM_PSTable->initialize = 1; } - if(!bForceInNormal) + if (!bForceInNormal) { - if(pDM_Odm->RSSI_Min != 0xFF) + if (pDM_Odm->RSSI_Min != 0xFF) { - if(pDM_PSTable->PreRFState == RF_Normal) + if (pDM_PSTable->PreRFState == RF_Normal) { - if(pDM_Odm->RSSI_Min >= Rssi_Up_bound) + if (pDM_Odm->RSSI_Min >= Rssi_Up_bound) pDM_PSTable->CurRFState = RF_Save; else pDM_PSTable->CurRFState = RF_Normal; } else{ - if(pDM_Odm->RSSI_Min <= Rssi_Low_bound) + if (pDM_Odm->RSSI_Min <= Rssi_Low_bound) pDM_PSTable->CurRFState = RF_Normal; else pDM_PSTable->CurRFState = RF_Save; @@ -2177,13 +2177,13 @@ ODM_RF_Saving( pDM_PSTable->CurRFState = RF_Normal; } - if(pDM_PSTable->PreRFState != pDM_PSTable->CurRFState) + if (pDM_PSTable->PreRFState != pDM_PSTable->CurRFState) { - if(pDM_PSTable->CurRFState == RF_Save) + if (pDM_PSTable->CurRFState == RF_Save) { /* 8723 RSSI report will be wrong. Set 0x874[5]=1 when enter BB power saving mode. */ /* Suggested by SD3 Yu-Nan. 2011.01.20. */ - if(pDM_Odm->SupportICType == ODM_RTL8723A) + if (pDM_Odm->SupportICType == ODM_RTL8723A) { ODM_SetBBReg(pDM_Odm, 0x874 , BIT5, 0x1); /* Reg874[5]=1b'1 */ } @@ -2204,7 +2204,7 @@ ODM_RF_Saving( ODM_SetBBReg(pDM_Odm, 0xa74, 0xF000, pDM_PSTable->RegA74); ODM_SetBBReg(pDM_Odm,0x818, BIT28, 0x0); - if(pDM_Odm->SupportICType == ODM_RTL8723A) + if (pDM_Odm->SupportICType == ODM_RTL8723A) { ODM_SetBBReg(pDM_Odm,0x874 , BIT5, 0x0); /* Reg874[5]=1b'0 */ } @@ -2252,7 +2252,7 @@ u32 ODM_Get_Rate_Bitmap( pEntry = pDM_Odm->pODM_StaInfo[macid]; - if(!IS_STA_VALID(pEntry)) + if (!IS_STA_VALID(pEntry)) return ra_mask; WirelessMode = pEntry->wireless_mode; @@ -2260,23 +2260,23 @@ u32 ODM_Get_Rate_Bitmap( switch(WirelessMode) { case ODM_WM_B: - if(ra_mask & 0x0000000c) /* 11M or 5.5M enable */ + if (ra_mask & 0x0000000c) /* 11M or 5.5M enable */ rate_bitmap = 0x0000000d; else rate_bitmap = 0x0000000f; break; case (ODM_WM_A|ODM_WM_G): - if(rssi_level == DM_RATR_STA_HIGH) + if (rssi_level == DM_RATR_STA_HIGH) rate_bitmap = 0x00000f00; else rate_bitmap = 0x00000ff0; break; case (ODM_WM_B|ODM_WM_G): - if(rssi_level == DM_RATR_STA_HIGH) + if (rssi_level == DM_RATR_STA_HIGH) rate_bitmap = 0x00000f00; - else if(rssi_level == DM_RATR_STA_MIDDLE) + else if (rssi_level == DM_RATR_STA_MIDDLE) rate_bitmap = 0x00000ff0; else rate_bitmap = 0x00000ff5; @@ -2288,11 +2288,11 @@ u32 ODM_Get_Rate_Bitmap( { if ( pDM_Odm->RFType == ODM_1T2R ||pDM_Odm->RFType == ODM_1T1R) { - if(rssi_level == DM_RATR_STA_HIGH) + if (rssi_level == DM_RATR_STA_HIGH) { rate_bitmap = 0x000f0000; } - else if(rssi_level == DM_RATR_STA_MIDDLE) + else if (rssi_level == DM_RATR_STA_MIDDLE) { rate_bitmap = 0x000ff000; } @@ -2305,11 +2305,11 @@ u32 ODM_Get_Rate_Bitmap( } else { - if(rssi_level == DM_RATR_STA_HIGH) + if (rssi_level == DM_RATR_STA_HIGH) { rate_bitmap = 0x0f8f0000; } - else if(rssi_level == DM_RATR_STA_MIDDLE) + else if (rssi_level == DM_RATR_STA_MIDDLE) { rate_bitmap = 0x0f8ff000; } @@ -2326,7 +2326,7 @@ u32 ODM_Get_Rate_Bitmap( default: /* case WIRELESS_11_24N: */ /* case WIRELESS_11_5N: */ - if(pDM_Odm->RFType == RF_1T2R) + if (pDM_Odm->RFType == RF_1T2R) rate_bitmap = 0x000fffff; else rate_bitmap = 0x0fffffff; @@ -2402,22 +2402,22 @@ odm_RefreshRateAdaptiveMaskCE( u8 i; struct adapter *pAdapter = pDM_Odm->Adapter; - if(pAdapter->bDriverStopped) + if (pAdapter->bDriverStopped) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("<---- odm_RefreshRateAdaptiveMask(): driver is going to unload\n")); return; } - if(!pDM_Odm->bUseRAMask) { + if (!pDM_Odm->bUseRAMask) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("<---- odm_RefreshRateAdaptiveMask(): driver does not control rate adaptive mask\n")); return; } for(i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pstat) ) { - if(IS_MCAST( pstat->hwaddr)) /* if(psta->mac_id ==1) */ + if (IS_STA_VALID(pstat) ) { + if (IS_MCAST( pstat->hwaddr)) /* if (psta->mac_id ==1) */ continue; - if( true == ODM_RAStateCheck(pDM_Odm, pstat->rssi_stat.UndecoratedSmoothedPWDB, false , &pstat->rssi_level) ) + if ( true == ODM_RAStateCheck(pDM_Odm, pstat->rssi_stat.UndecoratedSmoothedPWDB, false , &pstat->rssi_level) ) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi_stat.UndecoratedSmoothedPWDB, pstat->rssi_level)); /* printk("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi_stat.UndecoratedSmoothedPWDB, pstat->rssi_level); */ @@ -2475,15 +2475,15 @@ ODM_RAStateCheck( } /* Decide RATRState by RSSI. */ - if(RSSI > HighRSSIThreshForRA) + if (RSSI > HighRSSIThreshForRA) RATRState = DM_RATR_STA_HIGH; - else if(RSSI > LowRSSIThreshForRA) + else if (RSSI > LowRSSIThreshForRA) RATRState = DM_RATR_STA_MIDDLE; else RATRState = DM_RATR_STA_LOW; /* printk("==>%s,RATRState:0x%02x ,RSSI:%d\n",__FUNCTION__,RATRState,RSSI); */ - if( *pRATRState!=RATRState || bForceUpdate) + if ( *pRATRState!=RATRState || bForceUpdate) { ODM_RT_TRACE( pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI Level %d -> %d\n", *pRATRState, RATRState) ); *pRATRState = RATRState; @@ -2612,11 +2612,11 @@ odm_DynamicTxPowerNIC( if (!(pDM_Odm->SupportAbility & ODM_BB_DYNAMIC_TXPWR)) return; - if(pDM_Odm->SupportICType == ODM_RTL8192C) + if (pDM_Odm->SupportICType == ODM_RTL8192C) { odm_DynamicTxPower_92C(pDM_Odm); } - else if(pDM_Odm->SupportICType == ODM_RTL8192D) + else if (pDM_Odm->SupportICType == ODM_RTL8192D) { odm_DynamicTxPower_92D(pDM_Odm); } @@ -2735,7 +2735,7 @@ struct adapter *pAdapter /* 1 1.Determine the minimum RSSI */ - if((pDM_Odm->bLinked != true) && + if ((pDM_Odm->bLinked != true) && (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) pdmpriv->MinUndecoratedPWDBForDM = 0; else @@ -2755,7 +2755,7 @@ odm_RSSIMonitorCheckCE( u8 sta_cnt=0; u32 PWDB_rssi[NUM_STA]={0};/* 0~15]:MACID, [16~31]:PWDB_rssi */ - if(pDM_Odm->bLinked != true) + if (pDM_Odm->bLinked != true) return; { @@ -2763,16 +2763,16 @@ odm_RSSIMonitorCheckCE( for(i=0; ipODM_StaInfo[i])) { - if(IS_MCAST( psta->hwaddr)) /* if(psta->mac_id ==1) */ + if (IS_MCAST( psta->hwaddr)) /* if (psta->mac_id ==1) */ continue; - if(psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) + if (psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) tmpEntryMinPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; - if(psta->rssi_stat.UndecoratedSmoothedPWDB > tmpEntryMaxPWDB) + if (psta->rssi_stat.UndecoratedSmoothedPWDB > tmpEntryMaxPWDB) tmpEntryMaxPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; - if(psta->rssi_stat.UndecoratedSmoothedPWDB != (-1)) { + if (psta->rssi_stat.UndecoratedSmoothedPWDB != (-1)) { PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16) ); } } @@ -2780,12 +2780,12 @@ odm_RSSIMonitorCheckCE( for(i=0; i< sta_cnt; i++) { - if(PWDB_rssi[i] != (0)){ - if(pHalData->fw_ractrl == true)/* Report every sta's RSSI to FW */ + if (PWDB_rssi[i] != (0)){ + if (pHalData->fw_ractrl == true)/* Report every sta's RSSI to FW */ { } else{ - #if(RATE_ADAPTIVE_SUPPORT == 1) + #if (RATE_ADAPTIVE_SUPPORT == 1) ODM_RA_SetRSSI_8188E( &(pHalData->odmpriv), (PWDB_rssi[i]&0xFF), (u8)((PWDB_rssi[i]>>16) & 0xFF)); #endif @@ -2794,7 +2794,7 @@ odm_RSSIMonitorCheckCE( } } - if(tmpEntryMaxPWDB != 0) /* If associated entry is found */ + if (tmpEntryMaxPWDB != 0) /* If associated entry is found */ { pdmpriv->EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB; } @@ -2803,7 +2803,7 @@ odm_RSSIMonitorCheckCE( pdmpriv->EntryMaxUndecoratedSmoothedPWDB = 0; } - if(tmpEntryMinPWDB != 0xff) /* If associated entry is found */ + if (tmpEntryMinPWDB != 0xff) /* If associated entry is found */ { pdmpriv->EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB; } @@ -2945,12 +2945,12 @@ odm_TXPowerTrackingCheckCE( { struct adapter *Adapter = pDM_Odm->Adapter; - if(!(pDM_Odm->SupportAbility & ODM_RF_TX_PWR_TRACK)) + if (!(pDM_Odm->SupportAbility & ODM_RF_TX_PWR_TRACK)) { return; } - if(!pDM_Odm->RFCalibrateInfo.TM_Trigger) /* at least delay 1 sec */ + if (!pDM_Odm->RFCalibrateInfo.TM_Trigger) /* at least delay 1 sec */ { PHY_SetRFReg(Adapter, RF_PATH_A, RF_T_METER_88E, BIT17 | BIT16, 0x03); pDM_Odm->RFCalibrateInfo.TM_Trigger = 1; @@ -3018,7 +3018,7 @@ odm_InitHybridAntDiv_88C_92D( ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_InitHybridAntDiv==============>\n")); /* whether to do antenna diversity or not */ - if((pDM_Odm->SupportICType != ODM_RTL8192C) && (pDM_Odm->SupportICType != ODM_RTL8192D)) + if ((pDM_Odm->SupportICType != ODM_RTL8192C) && (pDM_Odm->SupportICType != ODM_RTL8192D)) return; bTxPathSel=(pDM_Odm->RFType==ODM_1T1R)?false:true; @@ -3029,7 +3029,7 @@ odm_InitHybridAntDiv_88C_92D( ODM_SetBBReg(pDM_Odm,ODM_REG_ANTSEL_CTRL_11N, BIT8|BIT9, 0x01); /* 0x01: left antenna, 0x02: right antenna */ /* only AP support different path selection temperarly */ - if(!bTxPathSel){ /* PATH-A */ + if (!bTxPathSel){ /* PATH-A */ ODM_SetBBReg(pDM_Odm,ODM_REG_PIN_CTRL_11N, BIT8|BIT9, 0 ); /* ANTSEL as HW control */ ODM_SetBBReg(pDM_Odm,ODM_REG_ANTSEL_PATH_11N, BIT13, 1); /* select TX ANTESEL from path A */ } @@ -3051,7 +3051,7 @@ odm_InitHybridAntDiv_88C_92D( /* Enable HW Antenna Diversity */ - if(!bTxPathSel) /* PATH-A */ + if (!bTxPathSel) /* PATH-A */ ODM_SetBBReg(pDM_Odm,ODM_REG_IGI_A_11N, BIT7,1); /* Enable Hardware antenna switch */ else ODM_SetBBReg(pDM_Odm,ODM_REG_IGI_B_11N, BIT7,1); /* Enable Hardware antenna switch */ @@ -3077,16 +3077,16 @@ odm_InitHybridAntDiv( PDM_ODM_T pDM_Odm ) { - if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) + if (!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("Return: Not Support HW AntDiv\n")); return; } - if(pDM_Odm->SupportICType & (ODM_RTL8192C | ODM_RTL8192D)) + if (pDM_Odm->SupportICType & (ODM_RTL8192C | ODM_RTL8192D)) { } - else if(pDM_Odm->SupportICType == ODM_RTL8188E) + else if (pDM_Odm->SupportICType == ODM_RTL8188E) { ODM_AntennaDiversityInit_88E(pDM_Odm); } @@ -3111,26 +3111,26 @@ odm_StaDefAntSel( ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("CCK_Ant1_Cnt:%d, CCK_Ant2_Cnt:%d\n",CCK_Ant1_Cnt,CCK_Ant2_Cnt)); - if(((OFDM_Ant1_Cnt+OFDM_Ant2_Cnt)==0)&&((CCK_Ant1_Cnt + CCK_Ant2_Cnt) <10)){ + if (((OFDM_Ant1_Cnt+OFDM_Ant2_Cnt)==0)&&((CCK_Ant1_Cnt + CCK_Ant2_Cnt) <10)){ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_StaDefAntSelect Fail: No enough packet info!\n")); return false; } - if(OFDM_Ant1_Cnt || OFDM_Ant2_Cnt ) { + if (OFDM_Ant1_Cnt || OFDM_Ant2_Cnt ) { /* if RX OFDM packet number larger than 0 */ - if(OFDM_Ant1_Cnt > OFDM_Ant2_Cnt) + if (OFDM_Ant1_Cnt > OFDM_Ant2_Cnt) (*pDefAnt)=1; else (*pDefAnt)=0; } /* else if RX CCK packet number larger than 10 */ - else if((CCK_Ant1_Cnt + CCK_Ant2_Cnt) >=10 ) + else if ((CCK_Ant1_Cnt + CCK_Ant2_Cnt) >=10 ) { - if(CCK_Ant1_Cnt > (5*CCK_Ant2_Cnt)) + if (CCK_Ant1_Cnt > (5*CCK_Ant2_Cnt)) (*pDefAnt)=1; - else if(CCK_Ant2_Cnt > (5*CCK_Ant1_Cnt)) + else if (CCK_Ant2_Cnt > (5*CCK_Ant1_Cnt)) (*pDefAnt)=0; - else if(CCK_Ant1_Cnt > CCK_Ant2_Cnt) + else if (CCK_Ant1_Cnt > CCK_Ant2_Cnt) (*pDefAnt)=0; else (*pDefAnt)=1; @@ -3153,16 +3153,16 @@ odm_SetRxIdleAnt( { SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - if(Ant != pDM_SWAT_Table->RxIdleAnt) { + if (Ant != pDM_SWAT_Table->RxIdleAnt) { /* for path-A */ - if(Ant==1) + if (Ant==1) ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF, 0x65a9); /* right-side antenna */ else ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF, 0x569a); /* left-side antenna */ /* for path-B */ - if(bDualPath){ - if(Ant==0) + if (bDualPath){ + if (Ant==0) ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF0000, 0x65a9); /* right-side antenna */ else ODM_SetBBReg(pDM_Odm,ODM_REG_RX_DEFUALT_A_11N, 0xFFFF0000, 0x569a); /* left-side antenna */ @@ -3182,9 +3182,9 @@ ODM_AntselStatistics_88C( { SWAT_T *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; - if(pDM_SWAT_Table->antsel == 1) + if (pDM_SWAT_Table->antsel == 1) { - if(isCCKrate) + if (isCCKrate) pDM_SWAT_Table->CCK_Ant1_Cnt[MacId]++; else { @@ -3194,7 +3194,7 @@ ODM_AntselStatistics_88C( } else { - if(isCCKrate) + if (isCCKrate) pDM_SWAT_Table->CCK_Ant2_Cnt[MacId]++; else { @@ -3226,18 +3226,18 @@ odm_HwAntDiv_92C_92D( ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_HwAntDiv==============>\n")); - if(!(pDM_Odm->SupportAbility&ODM_BB_ANT_DIV)) /* if don't support antenna diveristy */ + if (!(pDM_Odm->SupportAbility&ODM_BB_ANT_DIV)) /* if don't support antenna diveristy */ { ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("odm_HwAntDiv: Not supported!\n")); return; } - if((pDM_Odm->SupportICType != ODM_RTL8192C) && (pDM_Odm->SupportICType != ODM_RTL8192D)) { + if ((pDM_Odm->SupportICType != ODM_RTL8192C) && (pDM_Odm->SupportICType != ODM_RTL8192D)) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("Return: IC Type is not 92C or 92D\n")); return; } - if(!pDM_Odm->bLinked) { + if (!pDM_Odm->bLinked) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("Return: bLinked is false\n")); return; } @@ -3245,7 +3245,7 @@ odm_HwAntDiv_92C_92D( for (i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pEntry)) + if (IS_STA_VALID(pEntry)) { RSSI_Ant1 = (pDM_SWAT_Table->OFDM_Ant1_Cnt[i] == 0)?0:(pDM_SWAT_Table->RSSI_Ant1_Sum[i]/pDM_SWAT_Table->OFDM_Ant1_Cnt[i]); @@ -3253,10 +3253,10 @@ odm_HwAntDiv_92C_92D( ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("RSSI_Ant1=%d, RSSI_Ant2=%d\n", RSSI_Ant1, RSSI_Ant2)); - if(RSSI_Ant1 ||RSSI_Ant2) + if (RSSI_Ant1 ||RSSI_Ant2) { RSSI = (RSSI_Ant1 < RSSI_Ant2) ? RSSI_Ant1 : RSSI_Ant2; - if((!RSSI) || ( RSSI < RSSI_Min) ) { + if ((!RSSI) || ( RSSI < RSSI_Min) ) { pDM_SWAT_Table->TargetSTA = i; RSSI_Min = RSSI; } @@ -3270,7 +3270,7 @@ odm_HwAntDiv_92C_92D( &pDM_SWAT_Table->TxAnt[i]); /* if Tx antenna selection: successful */ - if(bRet){ + if (bRet){ pDM_SWAT_Table->RSSI_Ant1_Sum[i] = 0; pDM_SWAT_Table->RSSI_Ant2_Sum[i] = 0; pDM_SWAT_Table->OFDM_Ant1_Cnt[i] = 0; @@ -3293,16 +3293,16 @@ odm_HwAntDiv( PDM_ODM_T pDM_Odm ) { - if(!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) + if (!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV)) { ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("Return: Not Support HW AntDiv\n")); return; } - if(pDM_Odm->SupportICType & (ODM_RTL8192C | ODM_RTL8192D)) + if (pDM_Odm->SupportICType & (ODM_RTL8192C | ODM_RTL8192D)) { } - else if(pDM_Odm->SupportICType == ODM_RTL8188E) + else if (pDM_Odm->SupportICType == ODM_RTL8188E) { ODM_AntennaDiversity_88E(pDM_Odm); } @@ -3345,7 +3345,7 @@ odm_EdcaTurboCheck( /* */ ODM_RT_TRACE(pDM_Odm,ODM_COMP_EDCA_TURBO,ODM_DBG_LOUD,("odm_EdcaTurboCheck========================>\n")); - if(!(pDM_Odm->SupportAbility& ODM_MAC_EDCA_TURBO )) + if (!(pDM_Odm->SupportAbility& ODM_MAC_EDCA_TURBO )) return; switch (pDM_Odm->SupportPlatform) { @@ -3401,13 +3401,13 @@ odm_EdcaTurboCheckCE( #endif /* Check if the status needs to be changed. */ - if((bbtchange) || (!precvpriv->bIsAnyNonBEPkts) ) + if ((bbtchange) || (!precvpriv->bIsAnyNonBEPkts) ) { cur_tx_bytes = pxmitpriv->tx_bytes - pxmitpriv->last_tx_bytes; cur_rx_bytes = precvpriv->rx_bytes - precvpriv->last_rx_bytes; /* traffic, TX or RX */ - if((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK)||(pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_ATHEROS)) + if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK)||(pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_ATHEROS)) { if (cur_tx_bytes > (cur_rx_bytes << 2)) { /* Uplink TP is present. */ @@ -3432,7 +3432,7 @@ odm_EdcaTurboCheckCE( if ((pDM_Odm->DM_EDCA_Table.prv_traffic_idx != trafficIndex) || (!pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA)) { - if((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_CISCO) && (pmlmeext->cur_wireless_mode & WIRELESS_11_24N)) + if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_CISCO) && (pmlmeext->cur_wireless_mode & WIRELESS_11_24N)) { edca_param = EDCAParam[pmlmeinfo->assoc_AP_vendor][trafficIndex]; } @@ -3440,7 +3440,7 @@ odm_EdcaTurboCheckCE( { edca_param = EDCAParam[HT_IOT_PEER_UNKNOWN][trafficIndex]; } - if(IS_92C_SERIAL(pHalData->VersionID)) + if (IS_92C_SERIAL(pHalData->VersionID)) edca_param = 0x60a42b; else edca_param = 0x6ea42b; @@ -3455,7 +3455,7 @@ odm_EdcaTurboCheckCE( /* Turn Off EDCA turbo here. */ /* Restore original EDCA according to the declaration of AP. */ /* */ - if(pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA) + if (pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA) { rtw_write32(Adapter, REG_EDCA_BE_PARAM, pHalData->AcParam_BE); pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = false; @@ -3625,13 +3625,13 @@ ODM_SingleDualAntennaDetection( rSleep, rPMPD_ANAEN, rFPGA0_XCD_SwitchControl, rBlue_Tooth}; - if(!(pDM_Odm->SupportICType & (ODM_RTL8723A|ODM_RTL8192C))) + if (!(pDM_Odm->SupportICType & (ODM_RTL8723A|ODM_RTL8192C))) return bResult; - if(!(pDM_Odm->SupportAbility&ODM_BB_ANT_DIV)) + if (!(pDM_Odm->SupportAbility&ODM_BB_ANT_DIV)) return bResult; - if(pDM_Odm->SupportICType == ODM_RTL8192C) + if (pDM_Odm->SupportICType == ODM_RTL8192C) { /* Which path in ADC/DAC is turnned on for PSD: both I/Q */ ODM_SetBBReg(pDM_Odm, 0x808, BIT10|BIT11, 0x3); @@ -3716,7 +3716,7 @@ ODM_SingleDualAntennaDetection( for (n=0;n<2;n++) { PSD_report_tmp = GetPSDData(pDM_Odm, 14, initial_gain); - if(PSD_report_tmp >AntA_report) + if (PSD_report_tmp >AntA_report) AntA_report=PSD_report_tmp; } @@ -3729,7 +3729,7 @@ ODM_SingleDualAntennaDetection( for (n=0;n<2;n++) { PSD_report_tmp = GetPSDData(pDM_Odm, 14, initial_gain); - if(PSD_report_tmp > AntB_report) + if (PSD_report_tmp > AntB_report) AntB_report=PSD_report_tmp; } @@ -3740,7 +3740,7 @@ ODM_SingleDualAntennaDetection( for (n=0;n<2;n++) { PSD_report_tmp = GetPSDData(pDM_Odm, 14, initial_gain); - if(PSD_report_tmp > AntO_report) + if (PSD_report_tmp > AntO_report) AntO_report=PSD_report_tmp; } @@ -3766,12 +3766,12 @@ ODM_SingleDualAntennaDetection( ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("psd_report_O[%d]= %d\n", 2416, AntO_report)); - if(pDM_Odm->SupportICType == ODM_RTL8723A) + if (pDM_Odm->SupportICType == ODM_RTL8723A) { /* 2 Test Ant B based on Ant A is ON */ - if(mode==ANTTESTB) { - if(AntA_report >= 100) { - if(AntB_report > (AntA_report+1)) { + if (mode==ANTTESTB) { + if (AntA_report >= 100) { + if (AntB_report > (AntA_report+1)) { pDM_SWAT_Table->ANTB_ON=false; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Single Antenna A\n")); } else { @@ -3785,9 +3785,9 @@ ODM_SingleDualAntennaDetection( } } /* 2 Test Ant A and B based on DPDT Open */ - else if(mode==ANTTESTALL) { - if((AntO_report >=100)&(AntO_report <118)) { - if(AntA_report > (AntO_report+1)) { + else if (mode==ANTTESTALL) { + if ((AntO_report >=100)&(AntO_report <118)) { + if (AntA_report > (AntO_report+1)) { pDM_SWAT_Table->ANTA_ON=false; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant A is OFF")); } else { @@ -3795,7 +3795,7 @@ ODM_SingleDualAntennaDetection( ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant A is ON")); } - if(AntB_report > (AntO_report+2)) { + if (AntB_report > (AntO_report+2)) { pDM_SWAT_Table->ANTB_ON=false; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("Ant B is OFF")); } else { @@ -3805,18 +3805,18 @@ ODM_SingleDualAntennaDetection( } } } - else if(pDM_Odm->SupportICType == ODM_RTL8192C) + else if (pDM_Odm->SupportICType == ODM_RTL8192C) { - if(AntA_report >= 100) + if (AntA_report >= 100) { - if(AntB_report > (AntA_report+2)) + if (AntB_report > (AntA_report+2)) { pDM_SWAT_Table->ANTA_ON=false; pDM_SWAT_Table->ANTB_ON=true; ODM_SetBBReg(pDM_Odm, rFPGA0_XA_RFInterfaceOE, 0x300, Antenna_B); ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_SingleDualAntennaDetection(): Single Antenna B\n")); } - else if(AntA_report > (AntB_report+2)) + else if (AntA_report > (AntB_report+2)) { pDM_SWAT_Table->ANTA_ON=true; pDM_SWAT_Table->ANTB_ON=false; diff --git a/hal/odm_HWConfig.c b/hal/odm_HWConfig.c index c57b2d2..bd920f2 100644 --- a/hal/odm_HWConfig.c +++ b/hal/odm_HWConfig.c @@ -82,42 +82,42 @@ odm_SignalScaleMapping_92CSeries( { s32 RetSig; #if (DEV_BUS_TYPE == RT_PCI_INTERFACE) - if(pDM_Odm->SupportInterface == ODM_ITRF_PCIE) + if (pDM_Odm->SupportInterface == ODM_ITRF_PCIE) { /* Step 1. Scale mapping. */ - if(CurrSig >= 61 && CurrSig <= 100) + if (CurrSig >= 61 && CurrSig <= 100) { RetSig = 90 + ((CurrSig - 60) / 4); } - else if(CurrSig >= 41 && CurrSig <= 60) + else if (CurrSig >= 41 && CurrSig <= 60) { RetSig = 78 + ((CurrSig - 40) / 2); } - else if(CurrSig >= 31 && CurrSig <= 40) + else if (CurrSig >= 31 && CurrSig <= 40) { RetSig = 66 + (CurrSig - 30); } - else if(CurrSig >= 21 && CurrSig <= 30) + else if (CurrSig >= 21 && CurrSig <= 30) { RetSig = 54 + (CurrSig - 20); } - else if(CurrSig >= 5 && CurrSig <= 20) + else if (CurrSig >= 5 && CurrSig <= 20) { RetSig = 42 + (((CurrSig - 5) * 2) / 3); } - else if(CurrSig == 4) + else if (CurrSig == 4) { RetSig = 36; } - else if(CurrSig == 3) + else if (CurrSig == 3) { RetSig = 27; } - else if(CurrSig == 2) + else if (CurrSig == 2) { RetSig = 18; } - else if(CurrSig == 1) + else if (CurrSig == 1) { RetSig = 9; } @@ -129,33 +129,33 @@ odm_SignalScaleMapping_92CSeries( #endif #if ((DEV_BUS_TYPE == RT_USB_INTERFACE) ||(DEV_BUS_TYPE == RT_SDIO_INTERFACE)) - if((pDM_Odm->SupportInterface == ODM_ITRF_USB) || (pDM_Odm->SupportInterface == ODM_ITRF_SDIO) ) + if ((pDM_Odm->SupportInterface == ODM_ITRF_USB) || (pDM_Odm->SupportInterface == ODM_ITRF_SDIO) ) { - if(CurrSig >= 51 && CurrSig <= 100) + if (CurrSig >= 51 && CurrSig <= 100) { RetSig = 100; } - else if(CurrSig >= 41 && CurrSig <= 50) + else if (CurrSig >= 41 && CurrSig <= 50) { RetSig = 80 + ((CurrSig - 40)*2); } - else if(CurrSig >= 31 && CurrSig <= 40) + else if (CurrSig >= 31 && CurrSig <= 40) { RetSig = 66 + (CurrSig - 30); } - else if(CurrSig >= 21 && CurrSig <= 30) + else if (CurrSig >= 21 && CurrSig <= 30) { RetSig = 54 + (CurrSig - 20); } - else if(CurrSig >= 10 && CurrSig <= 20) + else if (CurrSig >= 10 && CurrSig <= 20) { RetSig = 42 + (((CurrSig - 10) * 2) / 3); } - else if(CurrSig >= 5 && CurrSig <= 9) + else if (CurrSig >= 5 && CurrSig <= 9) { RetSig = 22 + (((CurrSig - 5) * 3) / 2); } - else if(CurrSig >= 1 && CurrSig <= 4) + else if (CurrSig >= 1 && CurrSig <= 4) { RetSig = 6 + (((CurrSig - 1) * 3) / 2); } @@ -173,13 +173,13 @@ odm_SignalScaleMapping( s32 CurrSig ) { - if( (pDM_Odm->SupportPlatform == ODM_MP) && + if ( (pDM_Odm->SupportPlatform == ODM_MP) && (pDM_Odm->SupportInterface != ODM_ITRF_PCIE) && /* USB & SDIO */ (pDM_Odm->PatchID==10))/* pMgntInfo->CustomerID == RT_CID_819x_Netcore */ { return odm_SignalScaleMapping_92CSeries_patch_RT_CID_819x_Netcore(pDM_Odm,CurrSig); } - else if( (pDM_Odm->SupportPlatform == ODM_MP) && + else if ( (pDM_Odm->SupportPlatform == ODM_MP) && (pDM_Odm->SupportInterface == ODM_ITRF_PCIE) && (pDM_Odm->PatchID==19))/* pMgntInfo->CustomerID == RT_CID_819x_Lenovo) */ { @@ -219,15 +219,15 @@ odm_EVMdbToPercentage( /* ODM_RTPRINT(FRX, RX_PHY_SQ, ("EVMdbToPercentage92C Value=%d / %x\n", ret_val, ret_val)); */ - if(ret_val >= 0) + if (ret_val >= 0) ret_val = 0; - if(ret_val <= -33) + if (ret_val <= -33) ret_val = -33; ret_val = 0 - ret_val; ret_val*=3; - if(ret_val == 99) + if (ret_val == 99) ret_val = 100; return(ret_val); @@ -261,7 +261,7 @@ odm_RxPhyStatus92CSeries_Parsing( pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1; - if(isCCKrate) { + if (isCCKrate) { u8 report; u8 cck_agc_rpt; @@ -276,12 +276,12 @@ odm_RxPhyStatus92CSeries_Parsing( /* 2011.11.28 LukeLee: 88E use different LNA & VGA gain table */ /* The RSSI formula should be modified according to the gain table */ /* In 88E, cck_highpwr is always set to 1 */ - if(pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8812)) { + if (pDM_Odm->SupportICType & (ODM_RTL8188E|ODM_RTL8812)) { LNA_idx = ((cck_agc_rpt & 0xE0) >>5); VGA_idx = (cck_agc_rpt & 0x1F); switch(LNA_idx) { case 7: - if(VGA_idx <= 27) + if (VGA_idx <= 27) rx_pwr_all = -100 + 2*(27-VGA_idx); /* VGA_idx = 27~2 */ else rx_pwr_all = -100; @@ -299,7 +299,7 @@ odm_RxPhyStatus92CSeries_Parsing( rx_pwr_all = -24 + 2*(7-VGA_idx); /* VGA_idx = 7~0 */ break; case 2: - if(cck_highpwr) + if (cck_highpwr) rx_pwr_all = -12 + 2*(5-VGA_idx); /* VGA_idx = 5~0 */ else rx_pwr_all = -6+ 2*(5-VGA_idx); @@ -315,19 +315,19 @@ odm_RxPhyStatus92CSeries_Parsing( } rx_pwr_all += 6; PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); - if(cck_highpwr == false) + if (cck_highpwr == false) { - if(PWDB_ALL >= 80) + if (PWDB_ALL >= 80) PWDB_ALL = ((PWDB_ALL-80)<<1)+((PWDB_ALL-80)>>1)+80; - else if((PWDB_ALL <= 78) && (PWDB_ALL >= 20)) + else if ((PWDB_ALL <= 78) && (PWDB_ALL >= 20)) PWDB_ALL += 3; - if(PWDB_ALL>100) + if (PWDB_ALL>100) PWDB_ALL = 100; } } else { - if(!cck_highpwr) + if (!cck_highpwr) { report =( cck_agc_rpt & 0xc0 )>>6; switch(report) @@ -375,30 +375,30 @@ odm_RxPhyStatus92CSeries_Parsing( PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); /* Modification for ext-LNA board */ - if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)) + if (pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)) { - if((cck_agc_rpt>>7) == 0){ + if ((cck_agc_rpt>>7) == 0){ PWDB_ALL = (PWDB_ALL>94)?100:(PWDB_ALL +6); } else { - if(PWDB_ALL > 38) + if (PWDB_ALL > 38) PWDB_ALL -= 16; else PWDB_ALL = (PWDB_ALL<=16)?(PWDB_ALL>>2):(PWDB_ALL -12); } /* CCK modification */ - if(PWDB_ALL > 25 && PWDB_ALL <= 60) + if (PWDB_ALL > 25 && PWDB_ALL <= 60) PWDB_ALL += 6; /* else if (PWDB_ALL <= 25) */ /* PWDB_ALL += 8; */ } else/* Modification for int-LNA board */ { - if(PWDB_ALL > 99) + if (PWDB_ALL > 99) PWDB_ALL -= 8; - else if(PWDB_ALL > 50 && PWDB_ALL <= 68) + else if (PWDB_ALL > 50 && PWDB_ALL <= 68) PWDB_ALL += 4; } } @@ -409,20 +409,20 @@ odm_RxPhyStatus92CSeries_Parsing( /* */ /* (3) Get Signal Quality (EVM) */ /* */ - if(pPktinfo->bPacketMatchBSSID) + if (pPktinfo->bPacketMatchBSSID) { u8 SQ,SQ_rpt; - if((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)){/* pMgntInfo->CustomerID == RT_CID_819x_Lenovo */ + if ((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)){/* pMgntInfo->CustomerID == RT_CID_819x_Lenovo */ SQ = odm_SQ_process_patch_RT_CID_819x_Lenovo(pDM_Odm,isCCKrate,PWDB_ALL,0,0); } - else if(pPhyInfo->RxPWDBAll > 40 && !pDM_Odm->bInHctTest){ + else if (pPhyInfo->RxPWDBAll > 40 && !pDM_Odm->bInHctTest){ SQ = 100; } else{ SQ_rpt = pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all; - if(SQ_rpt > 64) + if (SQ_rpt > 64) SQ = 0; else if (SQ_rpt < 20) SQ = 100; @@ -460,14 +460,14 @@ odm_RxPhyStatus92CSeries_Parsing( /* RTPRINT(FRX, RX_PHY_SS, ("RF-%d RXPWR=%x RSSI=%d\n", i, rx_pwr[i], RSSI)); */ /* Modification for ext-LNA board */ - if(pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)) + if (pDM_Odm->BoardType & (ODM_BOARD_EXT_LNA | ODM_BOARD_EXT_PA)) { - if((pPhyStaRpt->path_agc[i].trsw) == 1) + if ((pPhyStaRpt->path_agc[i].trsw) == 1) RSSI = (RSSI>94)?100:(RSSI +6); else RSSI = (RSSI<=16)?(RSSI>>3):(RSSI -16); - if((RSSI <= 34) && (RSSI >=4)) + if ((RSSI <= 34) && (RSSI >=4)) RSSI -= 4; } @@ -477,11 +477,11 @@ odm_RxPhyStatus92CSeries_Parsing( pPhyInfo->RxSNR[i] = pDM_Odm->PhyDbgInfo.RxSNRdB[i] = (s32)(pPhyStaRpt->path_rxsnr[i]/2); /* Record Signal Strength for next packet */ - if(pPktinfo->bPacketMatchBSSID) + if (pPktinfo->bPacketMatchBSSID) { - if((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)) + if ((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)) { - if(i==ODM_RF_PATH_A) + if (i==ODM_RF_PATH_A) pPhyInfo->SignalQuality = odm_SQ_process_patch_RT_CID_819x_Lenovo(pDM_Odm,isCCKrate,PWDB_ALL,i,RSSI); } @@ -502,13 +502,13 @@ odm_RxPhyStatus92CSeries_Parsing( pPhyInfo->RxPower = rx_pwr_all; pPhyInfo->RecvSignalPower = rx_pwr_all; - if((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)){ + if ((pDM_Odm->SupportPlatform == ODM_MP) &&(pDM_Odm->PatchID==19)){ /* do nothing */ } else{/* pMgntInfo->CustomerID != RT_CID_819x_Lenovo */ /* */ /* (3)EVM of HT rate */ /* */ - if(pPktinfo->Rate >=DESC92C_RATEMCS8 && pPktinfo->Rate <=DESC92C_RATEMCS15) + if (pPktinfo->Rate >=DESC92C_RATEMCS8 && pPktinfo->Rate <=DESC92C_RATEMCS15) Max_spatial_stream = 2; /* both spatial stream make sense */ else Max_spatial_stream = 1; /* only spatial stream 1 makes sense */ @@ -522,9 +522,9 @@ odm_RxPhyStatus92CSeries_Parsing( /* RTPRINT(FRX, RX_PHY_SQ, ("RXRATE=%x RXEVM=%x EVM=%s%d\n", */ /* GET_RX_STATUS_DESC_RX_MCS(pDesc), pDrvInfo->rxevm[i], "%", EVM)); */ - if(pPktinfo->bPacketMatchBSSID) + if (pPktinfo->bPacketMatchBSSID) { - if(i==ODM_RF_PATH_A) /* Fill value in RFD, Get the first spatial stream only */ + if (i==ODM_RF_PATH_A) /* Fill value in RFD, Get the first spatial stream only */ { pPhyInfo->SignalQuality = (u8)(EVM & 0xff); } @@ -536,7 +536,7 @@ odm_RxPhyStatus92CSeries_Parsing( } /* UI BSS List signal strength(in percentage), make it good looking, from 0~100. */ /* It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). */ - if(isCCKrate) + if (isCCKrate) { pPhyInfo->SignalStrength = (u8)(odm_SignalScaleMapping(pDM_Odm, PWDB_ALL));/* PWDB_ALL; */ } @@ -580,7 +580,7 @@ odm_Process_RSSIForDM( PSTA_INFO_T pEntry; - if(pPktinfo->StationID == 0xFF) + if (pPktinfo->StationID == 0xFF) return; /* 2011/11/17 MH Need to debug */ @@ -590,35 +590,35 @@ odm_Process_RSSIForDM( } pEntry = pDM_Odm->pODM_StaInfo[pPktinfo->StationID]; - if(!IS_STA_VALID(pEntry)) + if (!IS_STA_VALID(pEntry)) return; - if((!pPktinfo->bPacketMatchBSSID) ) + if ((!pPktinfo->bPacketMatchBSSID) ) return; isCCKrate = (pPktinfo->Rate <= DESC92C_RATE11M) ? true : false; - if(pPktinfo->bPacketBeacon) + if (pPktinfo->bPacketBeacon) pDM_Odm->PhyDbgInfo.NumQryBeaconPkt++; pDM_Odm->RxRate = pPktinfo->Rate; /* Smart Antenna Debug Message------------------ */ - if(pDM_Odm->SupportICType == ODM_RTL8188E) + if (pDM_Odm->SupportICType == ODM_RTL8188E) { u8 antsel_tr_mux; pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV) + if (pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV) { - if(pDM_FatTable->FAT_State == FAT_TRAINING_STATE) + if (pDM_FatTable->FAT_State == FAT_TRAINING_STATE) { - if(pPktinfo->bPacketToSelf) /* pPktinfo->bPacketMatchBSSID && (!pPktinfo->bPacketBeacon)) */ + if (pPktinfo->bPacketToSelf) /* pPktinfo->bPacketMatchBSSID && (!pPktinfo->bPacketBeacon)) */ { antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |(pDM_FatTable->antsel_rx_keep_1 <<1) |pDM_FatTable->antsel_rx_keep_0; pDM_FatTable->antSumRSSI[antsel_tr_mux] += pPhyInfo->RxPWDBAll; pDM_FatTable->antRSSIcnt[antsel_tr_mux]++; } } - } else if((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)) { - if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) { + } else if ((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)) { + if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) { antsel_tr_mux = (pDM_FatTable->antsel_rx_keep_2<<2) |(pDM_FatTable->antsel_rx_keep_1 <<1) |pDM_FatTable->antsel_rx_keep_0; ODM_AntselStatistics_88E(pDM_Odm, antsel_tr_mux, pPktinfo->StationID, pPhyInfo->RxPWDBAll); } @@ -631,12 +631,12 @@ odm_Process_RSSIForDM( UndecoratedSmoothedOFDM = pEntry->rssi_stat.UndecoratedSmoothedOFDM; UndecoratedSmoothedPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB; - if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) + if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) { - if(!isCCKrate)/* ofdm rate */ + if (!isCCKrate)/* ofdm rate */ { - if(pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B] == 0){ + if (pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B] == 0){ RSSI_Ave = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; pDM_Odm->RSSI_B = 0; @@ -648,7 +648,7 @@ odm_Process_RSSIForDM( pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; pDM_Odm->RSSI_B = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; - if(pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A] > pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]) + if (pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A] > pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]) { RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; @@ -658,24 +658,24 @@ odm_Process_RSSIForDM( RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; } - if((RSSI_max -RSSI_min) < 3) + if ((RSSI_max -RSSI_min) < 3) RSSI_Ave = RSSI_max; - else if((RSSI_max -RSSI_min) < 6) + else if ((RSSI_max -RSSI_min) < 6) RSSI_Ave = RSSI_max - 1; - else if((RSSI_max -RSSI_min) < 10) + else if ((RSSI_max -RSSI_min) < 10) RSSI_Ave = RSSI_max - 2; else RSSI_Ave = RSSI_max - 3; } /* 1 Process OFDM RSSI */ - if(UndecoratedSmoothedOFDM <= 0) /* initialize */ + if (UndecoratedSmoothedOFDM <= 0) /* initialize */ { UndecoratedSmoothedOFDM = pPhyInfo->RxPWDBAll; } else { - if(pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedOFDM) + if (pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedOFDM) { UndecoratedSmoothedOFDM = ( ((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) + @@ -700,13 +700,13 @@ odm_Process_RSSIForDM( pDM_Odm->RSSI_B = 0xFF; /* 1 Process CCK RSSI */ - if(UndecoratedSmoothedCCK <= 0) /* initialize */ + if (UndecoratedSmoothedCCK <= 0) /* initialize */ { UndecoratedSmoothedCCK = pPhyInfo->RxPWDBAll; } else { - if(pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedCCK) + if (pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedCCK) { UndecoratedSmoothedCCK = ( ((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) + @@ -723,10 +723,10 @@ odm_Process_RSSIForDM( pEntry->rssi_stat.PacketMap = pEntry->rssi_stat.PacketMap<<1; } - /* if(pEntry) */ + /* if (pEntry) */ { /* 2011.07.28 LukeLee: modified to prevent unstable CCK RSSI */ - if(pEntry->rssi_stat.ValidBit >= 64) + if (pEntry->rssi_stat.ValidBit >= 64) pEntry->rssi_stat.ValidBit = 64; else pEntry->rssi_stat.ValidBit++; @@ -734,14 +734,14 @@ odm_Process_RSSIForDM( for(i=0; irssi_stat.ValidBit; i++) OFDM_pkt += (u8)(pEntry->rssi_stat.PacketMap>>i)&BIT0; - if(pEntry->rssi_stat.ValidBit == 64) + if (pEntry->rssi_stat.ValidBit == 64) { Weighting = ((OFDM_pkt<<4) > 64)?64:(OFDM_pkt<<4); UndecoratedSmoothedPWDB = (Weighting*UndecoratedSmoothedOFDM+(64-Weighting)*UndecoratedSmoothedCCK)>>6; } else { - if(pEntry->rssi_stat.ValidBit != 0) + if (pEntry->rssi_stat.ValidBit != 0) UndecoratedSmoothedPWDB = (OFDM_pkt*UndecoratedSmoothedOFDM+(pEntry->rssi_stat.ValidBit-OFDM_pkt)*UndecoratedSmoothedCCK)/pEntry->rssi_stat.ValidBit; else UndecoratedSmoothedPWDB = 0; @@ -778,9 +778,9 @@ ODM_PhyStatusQuery_92CSeries( pPhyStatus, pPktinfo); - if( pDM_Odm->RSSI_test == true) { + if ( pDM_Odm->RSSI_test == true) { /* Select the packets to do RSSI checking for antenna switching. */ - if(pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon ) + if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon ) ODM_SwAntDivChkPerPktRssi(pDM_Odm,pPktinfo->StationID,pPhyInfo); } else { odm_Process_RSSIForDM(pDM_Odm,pPhyInfo,pPktinfo); @@ -842,7 +842,7 @@ ODM_ConfigRFWithHeaderFile( ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===>ODM_ConfigRFWithHeaderFile\n")); if (pDM_Odm->SupportICType == ODM_RTL8188E) { - if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) + if (IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) READ_AND_CONFIG(8188E,_RadioA_1T_ICUT_); else READ_AND_CONFIG(8188E,_RadioA_1T_); @@ -863,18 +863,18 @@ ODM_ConfigBBWithHeaderFile( ODM_BB_Config_Type ConfigType ) { - if(pDM_Odm->SupportICType == ODM_RTL8188E) { - if(ConfigType == CONFIG_BB_PHY_REG) { - if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) + if (pDM_Odm->SupportICType == ODM_RTL8188E) { + if (ConfigType == CONFIG_BB_PHY_REG) { + if (IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) READ_AND_CONFIG(8188E,_PHY_REG_1T_ICUT_); else READ_AND_CONFIG(8188E,_PHY_REG_1T_); - } else if(ConfigType == CONFIG_BB_AGC_TAB) { - if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) + } else if (ConfigType == CONFIG_BB_AGC_TAB) { + if (IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) READ_AND_CONFIG(8188E,_AGC_TAB_1T_ICUT_); else READ_AND_CONFIG(8188E,_AGC_TAB_1T_); - } else if(ConfigType == CONFIG_BB_PHY_REG_PG) { + } else if (ConfigType == CONFIG_BB_PHY_REG_PG) { READ_AND_CONFIG(8188E,_PHY_REG_PG_); ODM_RT_TRACE(pDM_Odm,ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8188EPHY_REG_PGArray\n")); } @@ -889,7 +889,7 @@ ODM_ConfigMACWithHeaderFile( { u8 result = HAL_STATUS_SUCCESS; if (pDM_Odm->SupportICType == ODM_RTL8188E) { - if(IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) + if (IS_VENDOR_8188E_I_CUT_SERIES(pDM_Odm->Adapter)) READ_AND_CONFIG(8188E,_MAC_REG_ICUT_); else result =READ_AND_CONFIG(8188E,_MAC_REG_); diff --git a/hal/odm_RTL8188E.c b/hal/odm_RTL8188E.c index b8ca690..8280e7c 100644 --- a/hal/odm_RTL8188E.c +++ b/hal/odm_RTL8188E.c @@ -31,7 +31,7 @@ ODM_DIG_LowerBound_88E( { pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) { pDM_DigTable->rx_gain_range_min = (u8) pDM_DigTable->AntDiv_RSSI_max; ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_DIG_LowerBound_88E(): pDM_DigTable->AntDiv_RSSI_max=%d\n",pDM_DigTable->AntDiv_RSSI_max)); @@ -119,7 +119,7 @@ odm_TRX_HWAntDivInit( ODM_UpdateRxIdleAnt_88E(pDM_Odm, MAIN_ANT); /* antenna mapping table */ - if(!pDM_Odm->bIsMPChip) /* testchip */ + if (!pDM_Odm->bIsMPChip) /* testchip */ { ODM_SetBBReg(pDM_Odm, ODM_REG_RX_DEFUALT_A_11N , BIT10|BIT9|BIT8, 1); /* Reg858[10:8]=3'b001 */ ODM_SetBBReg(pDM_Odm, ODM_REG_RX_DEFUALT_A_11N , BIT13|BIT12|BIT11, 2); /* Reg858[13:11]=3'b010 */ @@ -179,9 +179,9 @@ odm_FastAntTrainingInit( ODM_SetBBReg(pDM_Odm, 0xca4 , bMaskDWord, 0x000000a0); /* antenna mapping table */ - if(AntCombination == 2) + if (AntCombination == 2) { - if(!pDM_Odm->bIsMPChip) /* testchip */ + if (!pDM_Odm->bIsMPChip) /* testchip */ { ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 1); /* Reg858[10:8]=3'b001 */ ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 2); /* Reg858[13:11]=3'b010 */ @@ -192,9 +192,9 @@ odm_FastAntTrainingInit( ODM_SetBBReg(pDM_Odm, 0x914 , bMaskByte1, 2); } } - else if(AntCombination == 7) + else if (AntCombination == 7) { - if(!pDM_Odm->bIsMPChip) /* testchip */ + if (!pDM_Odm->bIsMPChip) /* testchip */ { ODM_SetBBReg(pDM_Odm, 0x858 , BIT10|BIT9|BIT8, 0); /* Reg858[10:8]=3'b000 */ ODM_SetBBReg(pDM_Odm, 0x858 , BIT13|BIT12|BIT11, 1); /* Reg858[13:11]=3'b001 */ @@ -242,7 +242,7 @@ ODM_AntennaDiversityInit_88E( PDM_ODM_T pDM_Odm ) { - if(pDM_Odm->SupportICType != ODM_RTL8188E) + if (pDM_Odm->SupportICType != ODM_RTL8188E) return; /* ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->AntDivType=%d, pHalData->AntDivCfg=%d\n", */ @@ -250,11 +250,11 @@ ODM_AntennaDiversityInit_88E( ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->AntDivType=%d\n",pDM_Odm->AntDivType)); ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pDM_Odm->bIsMPChip=%s\n",(pDM_Odm->bIsMPChip?"true":"false"))); - if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) + if (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) odm_RX_HWAntDivInit(pDM_Odm); - else if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + else if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) odm_TRX_HWAntDivInit(pDM_Odm); - else if(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV) + else if (pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV) odm_FastAntTrainingInit(pDM_Odm); } @@ -265,10 +265,10 @@ ODM_UpdateRxIdleAnt_88E(PDM_ODM_T pDM_Odm, u8 Ant) pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; u32 DefaultAnt, OptionalAnt; - if(pDM_FatTable->RxIdleAnt != Ant) + if (pDM_FatTable->RxIdleAnt != Ant) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Update Rx Idle Ant\n")); - if(Ant == MAIN_ANT) + if (Ant == MAIN_ANT) { DefaultAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?MAIN_ANT_CG_TRX:MAIN_ANT_CGCS_RX; OptionalAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?AUX_ANT_CG_TRX:AUX_ANT_CGCS_RX; @@ -279,7 +279,7 @@ ODM_UpdateRxIdleAnt_88E(PDM_ODM_T pDM_Odm, u8 Ant) OptionalAnt = (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)?MAIN_ANT_CG_TRX:MAIN_ANT_CGCS_RX; } - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) { ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, DefaultAnt); /* Default RX */ ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT8|BIT7|BIT6, OptionalAnt); /* Optional RX */ @@ -287,7 +287,7 @@ ODM_UpdateRxIdleAnt_88E(PDM_ODM_T pDM_Odm, u8 Ant) ODM_SetMACReg(pDM_Odm, ODM_REG_RESP_TX_11N , BIT6|BIT7, DefaultAnt); /* Resp Tx */ } - else if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) + else if (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) { ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT5|BIT4|BIT3, DefaultAnt); /* Default RX */ ODM_SetBBReg(pDM_Odm, ODM_REG_RX_ANT_CTRL_11N , BIT8|BIT7|BIT6, OptionalAnt); /* Optional RX */ @@ -305,7 +305,7 @@ odm_UpdateTxAnt_88E(PDM_ODM_T pDM_Odm, u8 Ant, u32 MacId) pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; u8 TargetAnt; - if(Ant == MAIN_ANT) + if (Ant == MAIN_ANT) TargetAnt = MAIN_ANT_CG_TRX; else TargetAnt = AUX_ANT_CG_TRX; @@ -329,7 +329,7 @@ ODM_SetTxAntByTxInfo_88E( { pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - if((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)) + if ((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV)) { SET_TX_DESC_ANTSEL_A_88E(pDesc, pDM_FatTable->antsel_a[macId]); SET_TX_DESC_ANTSEL_B_88E(pDesc, pDM_FatTable->antsel_b[macId]); @@ -348,9 +348,9 @@ ODM_AntselStatistics_88E( ) { pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) { - if(antsel_tr_mux == MAIN_ANT_CG_TRX) + if (antsel_tr_mux == MAIN_ANT_CG_TRX) { pDM_FatTable->MainAnt_Sum[MacId]+=RxPWDBAll; @@ -363,9 +363,9 @@ ODM_AntselStatistics_88E( } } - else if(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) + else if (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) { - if(antsel_tr_mux == MAIN_ANT_CGCS_RX) + if (antsel_tr_mux == MAIN_ANT_CGCS_RX) { pDM_FatTable->MainAnt_Sum[MacId]+=RxPWDBAll; @@ -398,7 +398,7 @@ odm_HWAntDiv( for (i=0; ipODM_StaInfo[i]; - if(IS_STA_VALID(pEntry)) + if (IS_STA_VALID(pEntry)) { /* 2 Caculate RSSI per Antenna */ Main_RSSI = (pDM_FatTable->MainAnt_Cnt[i]!=0)?(pDM_FatTable->MainAnt_Sum[i]/pDM_FatTable->MainAnt_Cnt[i]):0; @@ -410,19 +410,19 @@ odm_HWAntDiv( /* 2 Select MaxRSSI for DIG */ LocalMaxRSSI = (Main_RSSI>Aux_RSSI)?Main_RSSI:Aux_RSSI; - if((LocalMaxRSSI > AntDivMaxRSSI) && (LocalMaxRSSI < 40)) + if ((LocalMaxRSSI > AntDivMaxRSSI) && (LocalMaxRSSI < 40)) AntDivMaxRSSI = LocalMaxRSSI; - if(LocalMaxRSSI > MaxRSSI) + if (LocalMaxRSSI > MaxRSSI) MaxRSSI = LocalMaxRSSI; /* 2 Select RX Idle Antenna */ - if((pDM_FatTable->RxIdleAnt == MAIN_ANT) && (Main_RSSI == 0)) + if ((pDM_FatTable->RxIdleAnt == MAIN_ANT) && (Main_RSSI == 0)) Main_RSSI = Aux_RSSI; - else if((pDM_FatTable->RxIdleAnt == AUX_ANT) && (Aux_RSSI == 0)) + else if ((pDM_FatTable->RxIdleAnt == AUX_ANT) && (Aux_RSSI == 0)) Aux_RSSI = Main_RSSI; LocalMinRSSI = (Main_RSSI>Aux_RSSI)?Aux_RSSI:Main_RSSI; - if(LocalMinRSSI < MinRSSI) + if (LocalMinRSSI < MinRSSI) { MinRSSI = LocalMinRSSI; RxIdleAnt = TargetAnt; @@ -431,7 +431,7 @@ odm_HWAntDiv( #else /* 2 Select TRX Antenna */ - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) odm_UpdateTxAnt_88E(pDM_Odm, TargetAnt, i); #endif } @@ -454,32 +454,32 @@ ODM_AntennaDiversity_88E( ) { pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; - if((pDM_Odm->SupportICType != ODM_RTL8188E) || (!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))) + if ((pDM_Odm->SupportICType != ODM_RTL8188E) || (!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))) { /* ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_AntennaDiversity_88E: Not Support 88E AntDiv\n")); */ return; } - if(!pDM_Odm->bLinked) + if (!pDM_Odm->bLinked) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("ODM_AntennaDiversity_88E(): No Link.\n")); - if(pDM_FatTable->bBecomeLinked == true) + if (pDM_FatTable->bBecomeLinked == true) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Turn off HW AntDiv\n")); ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 0); /* RegC50[7]=1'b1 enable HW AntDiv */ ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA1_11N , BIT15, 0); /* Enable CCK AntDiv */ - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) + if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 0); /* Reg80c[21]=1'b0 from TX Reg */ pDM_FatTable->bBecomeLinked = pDM_Odm->bLinked; } return; } else { - if(pDM_FatTable->bBecomeLinked ==false) { + if (pDM_FatTable->bBecomeLinked ==false) { ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Need to Turn on HW AntDiv\n")); /* Because HW AntDiv is disabled before Link, we enable HW AntDiv after link */ ODM_SetBBReg(pDM_Odm, ODM_REG_IGI_A_11N , BIT7, 1); /* RegC50[7]=1'b1 enable HW AntDiv */ ODM_SetBBReg(pDM_Odm, ODM_REG_CCK_ANTDIV_PARA1_11N , BIT15, 1); /* Enable CCK AntDiv */ - if(pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) { + if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) { #if TX_BY_REG ODM_SetBBReg(pDM_Odm, ODM_REG_TX_ANT_CTRL_11N , BIT21, 0); /* Reg80c[21]=1'b0 from Reg */ #else @@ -492,7 +492,7 @@ ODM_AntennaDiversity_88E( - if((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)) + if ((pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV)||(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV)) odm_HWAntDiv(pDM_Odm); } diff --git a/hal/odm_RegConfig8188E.c b/hal/odm_RegConfig8188E.c index 3563267..9715d4f 100644 --- a/hal/odm_RegConfig8188E.c +++ b/hal/odm_RegConfig8188E.c @@ -29,7 +29,7 @@ odm_ConfigRFReg_8188E( u32 RegAddr ) { - if(Addr == 0xffe) + if (Addr == 0xffe) { ODM_sleep_ms(50); } diff --git a/hal/odm_debug.h b/hal/odm_debug.h index 03901c8..aef1e26 100644 --- a/hal/odm_debug.h +++ b/hal/odm_debug.h @@ -104,31 +104,31 @@ #if DBG #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \ - if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \ + if (((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \ { \ - if(pDM_Odm->SupportICType == ODM_RTL8192C) \ + if (pDM_Odm->SupportICType == ODM_RTL8192C) \ DbgPrint("[ODM-92C] "); \ - else if(pDM_Odm->SupportICType == ODM_RTL8192D) \ + else if (pDM_Odm->SupportICType == ODM_RTL8192D) \ DbgPrint("[ODM-92D] "); \ - else if(pDM_Odm->SupportICType == ODM_RTL8723A) \ + else if (pDM_Odm->SupportICType == ODM_RTL8723A) \ DbgPrint("[ODM-8723A] "); \ - else if(pDM_Odm->SupportICType == ODM_RTL8188E) \ + else if (pDM_Odm->SupportICType == ODM_RTL8188E) \ DbgPrint("[ODM-8188E] "); \ - else if(pDM_Odm->SupportICType == ODM_RTL8812) \ + else if (pDM_Odm->SupportICType == ODM_RTL8812) \ DbgPrint("[ODM-8812] "); \ - else if(pDM_Odm->SupportICType == ODM_RTL8821) \ + else if (pDM_Odm->SupportICType == ODM_RTL8821) \ DbgPrint("[ODM-8821] "); \ RT_PRINTK fmt; \ } #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) \ - if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \ + if (((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \ { \ RT_PRINTK fmt; \ } #define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \ - if(!(expr)) { \ + if (!(expr)) { \ DbgPrint( "Assertion failed! %s at ......\n", #expr); \ DbgPrint( " ......%s,%s,line=%d\n",__FILE__,__FUNCTION__,__LINE__); \ RT_PRINTK fmt; \ @@ -139,7 +139,7 @@ #define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __FUNCTION__, str); } #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \ - if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \ + if (((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \ { \ int __i; \ u8 * __ptr = (u8 *)ptr; \ diff --git a/hal/rtl8188e_cmd.c b/hal/rtl8188e_cmd.c index 3fefce9..a01e03f 100644 --- a/hal/rtl8188e_cmd.c +++ b/hal/rtl8188e_cmd.c @@ -50,7 +50,7 @@ static u8 _is_fw_read_cmd_down(struct adapter* padapter, u8 msgbox_num) do{ valid = rtw_read8(padapter,REG_HMETFR) & BIT(msgbox_num); - if(0 == valid ){ + if (0 == valid ){ read_down = true; } }while( (!read_down) && (retry_cnts--)); @@ -88,7 +88,7 @@ static s32 FillH2CCmd_88E(struct adapter *padapter, u8 ElementID, u32 CmdLen, u8 padapter = GET_PRIMARY_ADAPTER(padapter); pHalData = GET_HAL_DATA(padapter); - if(padapter->bFWReady == false) + if (padapter->bFWReady == false) { DBG_8192C("FillH2CCmd_88E(): return H2C cmd because fw is not ready\n"); return ret; @@ -109,14 +109,14 @@ static s32 FillH2CCmd_88E(struct adapter *padapter, u8 ElementID, u32 CmdLen, u8 do{ h2c_box_num = pHalData->LastHMEBoxNum; - if(!_is_fw_read_cmd_down(padapter, h2c_box_num)){ + if (!_is_fw_read_cmd_down(padapter, h2c_box_num)){ DBG_8192C(" fw read cmd failed...\n"); goto exit; } *(u8*)(&h2c_cmd) = ElementID; - if(CmdLen<=3) + if (CmdLen<=3) { memcpy((u8*)(&h2c_cmd)+1, pCmdBuffer, CmdLen ); } @@ -169,7 +169,7 @@ u8 rtl8188e_set_rssi_cmd(struct adapter*padapter, u8 *param) HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); ; - if(pHalData->fw_ractrl == true){ + if (pHalData->fw_ractrl == true){ }else{ DBG_8192C("==>%s fw dont support RA\n",__FUNCTION__); res=_FAIL; @@ -183,7 +183,7 @@ u8 rtl8188e_set_raid_cmd(struct adapter*padapter, u32 mask) u8 res=_SUCCESS; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); ; - if(pHalData->fw_ractrl == true){ + if (pHalData->fw_ractrl == true){ __le32 lmask; memset(buf, 0, 3); @@ -212,7 +212,7 @@ void rtl8188e_Add_RateATid(struct adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi raid = (bitmap>>28) & 0x0f; bitmap &=0x0fffffff; - if(rssi_level != DM_RATR_STA_INIT) + if (rssi_level != DM_RATR_STA_INIT) bitmap = ODM_Get_Rate_Bitmap(&pHalData->odmpriv, macid, bitmap, rssi_level); bitmap |= ((raid<<28)&0xf0000000); @@ -232,7 +232,7 @@ void rtl8188e_Add_RateATid(struct adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi __FUNCTION__,macid ,raid ,bitmap, shortGIrate); -#if(RATE_ADAPTIVE_SUPPORT == 1) +#if (RATE_ADAPTIVE_SUPPORT == 1) ODM_RA_UpdateRateInfo_8188E( &(pHalData->odmpriv), macid, @@ -286,7 +286,7 @@ void rtl8188e_set_FwPwrMode_cmd(struct adapter *padapter, u8 Mode) H2CSetPwrMode.bAllQueueUAPSD = padapter->registrypriv.uapsd_enable; - if(Mode > 0) + if (Mode > 0) { H2CSetPwrMode.PwrState = 0x00;/* AllON(0x0C), RFON(0x04), RFOFF(0x00) */ #ifdef CONFIG_EXT_CLK @@ -312,13 +312,13 @@ void rtl8188e_set_FwMediaStatus_cmd(struct adapter *padapter, __le16 mstatus_rpt DBG_871X("### %s: MStatus=%x MACID=%d\n", __FUNCTION__,opmode,macid); FillH2CCmd_88E(padapter, H2C_COM_MEDIA_STATUS_RPT, sizeof(mst_rpt), (u8 *)&mst_rpt); - if(macid > 31){ + if (macid > 31){ macid = macid-32; reg_macid_no_link = REG_MACID_NO_LINK_1; } /* Delete select macid (MACID 0~63) from queue list. */ - if(opmode == 1)/* 1:connect */ + if (opmode == 1)/* 1:connect */ { rtw_write32(padapter,reg_macid_no_link, (rtw_read32(padapter,reg_macid_no_link) & (~BIT(macid)))); } @@ -376,7 +376,7 @@ static void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength) pframe += 2; pktlen += 2; - if( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) + if ( (pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { /* DBG_871X("ie len=%d\n", cur_network->IELength); */ pktlen += cur_network->IELength - sizeof(struct ndis_802_11_fixed_ies); @@ -397,7 +397,7 @@ static void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength) /* DS parameter set */ pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pktlen); - if( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) + if ( (pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) { u32 ATIMWindow; /* IBSS Parameter Set... */ @@ -561,7 +561,7 @@ CheckFwRsvdPageContent( HAL_DATA_TYPE* pHalData = GET_HAL_DATA(Adapter); u32 MaxBcnPageNum; - if(pHalData->FwRsvdPageStartOffset != 0) + if (pHalData->FwRsvdPageStartOffset != 0) { /*MaxBcnPageNum = PageNum_128(pMgntInfo->MaxBeaconSize); RT_ASSERT((MaxBcnPageNum <= pHalData->FwRsvdPageStartOffset), @@ -708,7 +708,7 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *padapter, u8 mstatus) DBG_871X("%s mstatus(%x)\n", __FUNCTION__,mstatus); - if(mstatus == 1) { + if (mstatus == 1) { /* We should set AID, correct TSF, HW seq enable before set JoinBssReport to Fw in 88/92C. */ /* Suggested by filen. Added by tynli. */ rtw_write16(padapter, REG_BCN_PSR_RPT, (0xC000|pmlmeinfo->aid)); @@ -730,7 +730,7 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *padapter, u8 mstatus) rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)&(~BIT(3))); rtw_write8(padapter, REG_BCN_CTRL, rtw_read8(padapter, REG_BCN_CTRL)|BIT(4)); - if(pHalData->RegFwHwTxQCtrl&BIT6) + if (pHalData->RegFwHwTxQCtrl&BIT6) { DBG_871X("HalDownloadRSVDPage(): There is an Adapter is sending beacon.\n"); bSendBeacon = true; @@ -761,10 +761,10 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *padapter, u8 mstatus) }while(!bcn_valid && DLBcnCount<=100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); /* RT_ASSERT(bcn_valid, ("HalDownloadRSVDPage88ES(): 1 Download RSVD page failed!\n")); */ - if(padapter->bSurpriseRemoved || padapter->bDriverStopped) + if (padapter->bSurpriseRemoved || padapter->bDriverStopped) { } - else if(!bcn_valid) + else if (!bcn_valid) DBG_871X("%s: 1 Download RSVD page failed! DLBcnCount:%u, poll:%u\n", __FUNCTION__ ,DLBcnCount, poll); else DBG_871X("%s: 1 Download RSVD success! DLBcnCount:%u, poll:%u\n", __FUNCTION__, DLBcnCount, poll); @@ -774,10 +774,10 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *padapter, u8 mstatus) /* At run time, we cannot get the Tx Desc until it is released in TxHandleInterrupt() so we will return */ /* the beacon TCB in the following code. 2011.11.23. by tynli. */ /* */ - /* if(bcn_valid && padapter->bEnterPnpSleep) */ - if(0) + /* if (bcn_valid && padapter->bEnterPnpSleep) */ + if (0) { - if(bSendBeacon) + if (bSendBeacon) { rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL); DLBcnCount = 0; @@ -798,10 +798,10 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *padapter, u8 mstatus) }while(!bcn_valid && DLBcnCount<=100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); /* RT_ASSERT(bcn_valid, ("HalDownloadRSVDPage(): 2 Download RSVD page failed!\n")); */ - if(padapter->bSurpriseRemoved || padapter->bDriverStopped) + if (padapter->bSurpriseRemoved || padapter->bDriverStopped) { } - else if(!bcn_valid) + else if (!bcn_valid) DBG_871X("%s: 2 Download RSVD page failed! DLBcnCount:%u, poll:%u\n", __FUNCTION__ ,DLBcnCount, poll); else DBG_871X("%s: 2 Download RSVD success! DLBcnCount:%u, poll:%u\n", __FUNCTION__, DLBcnCount, poll); @@ -819,7 +819,7 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *padapter, u8 mstatus) /* prevent from setting 0x422[6] to 0 after download reserved page, or it will cause */ /* the beacon cannot be sent by HW. */ /* 2010.06.23. Added by tynli. */ - if(bSendBeacon) + if (bSendBeacon) { rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, (pHalData->RegFwHwTxQCtrl|BIT6)); pHalData->RegFwHwTxQCtrl |= BIT6; @@ -828,7 +828,7 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *padapter, u8 mstatus) /* */ /* Update RSVD page location H2C to Fw. */ /* */ - if(bcn_valid) + if (bcn_valid) { rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL); DBG_871X("Set RSVD page location to Fw.\n"); @@ -836,7 +836,7 @@ void rtl8188e_set_FwJoinBssReport_cmd(struct adapter *padapter, u8 mstatus) } /* Do not enable HW DMA BCN or it will cause Pcie interface hang by timing issue. 2011.11.24. by tynli. */ - /* if(!padapter->bEnterPnpSleep) */ + /* if (!padapter->bEnterPnpSleep) */ { /* Clear CR[8] or beacon packet will not be send to TxBuf anymore. */ pHalData->RegCR_1 &= (~BIT0); @@ -863,7 +863,7 @@ void rtl8188e_set_p2p_ps_offload_cmd(struct adapter* padapter, u8 p2p_ps_state) case P2P_PS_ENABLE: DBG_8192C("P2P_PS_ENABLE\n"); /* update CTWindow value. */ - if( pwdinfo->ctwindow > 0 ) + if ( pwdinfo->ctwindow > 0 ) { p2p_ps_offload->CTWindow_En = 1; rtw_write8(padapter, REG_P2P_CTWIN, pwdinfo->ctwindow); @@ -874,7 +874,7 @@ void rtl8188e_set_p2p_ps_offload_cmd(struct adapter* padapter, u8 p2p_ps_state) { /* To control the register setting for which NOA */ rtw_write8(padapter, REG_NOA_DESC_SEL, (i << 4)); - if(i == 0) + if (i == 0) p2p_ps_offload->NoA0_En = 1; else p2p_ps_offload->NoA1_En = 1; @@ -893,14 +893,14 @@ void rtl8188e_set_p2p_ps_offload_cmd(struct adapter* padapter, u8 p2p_ps_state) rtw_write8(padapter, REG_NOA_DESC_COUNT, pwdinfo->noa_count[i]); } - if( (pwdinfo->opp_ps == 1) || (pwdinfo->noa_num > 0) ) + if ( (pwdinfo->opp_ps == 1) || (pwdinfo->noa_num > 0) ) { /* rst p2p circuit */ rtw_write8(padapter, REG_DUAL_TSF_RST, BIT(4)); p2p_ps_offload->Offload_En = 1; - if(pwdinfo->role == P2P_ROLE_GO) + if (pwdinfo->role == P2P_ROLE_GO) { p2p_ps_offload->role= 1; p2p_ps_offload->AllStaSleep = 0; diff --git a/hal/rtl8188e_dm.c b/hal/rtl8188e_dm.c index 3f4beab..b743ea5 100644 --- a/hal/rtl8188e_dm.c +++ b/hal/rtl8188e_dm.c @@ -59,7 +59,7 @@ static void dm_CheckPbcGPIO(struct adapter *padapter) u8 tmp1byte; u8 bPbcPressed = false; - if(!padapter->registrypriv.hw_wps_pbc) + if (!padapter->registrypriv.hw_wps_pbc) return; tmp1byte = rtw_read8(padapter, GPIO_IO_SEL); @@ -82,7 +82,7 @@ static void dm_CheckPbcGPIO(struct adapter *padapter) { bPbcPressed = true; } - if( true == bPbcPressed) + if ( true == bPbcPressed) { /* Here we only set bPbcPressed to true */ /* After trigger PBC, the variable will be set to false */ @@ -141,7 +141,7 @@ static void Init_ODM_ComInfo_88E(struct adapter *Adapter) ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_PLATFORM,ODM_CE); - if(Adapter->interface_type == RTW_GSPI ) + if (Adapter->interface_type == RTW_GSPI ) ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_INTERFACE,ODM_ITRF_SDIO); else ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_INTERFACE,Adapter->interface_type);/* RTL871X_HCI_TYPE */ @@ -161,13 +161,13 @@ static void Init_ODM_ComInfo_88E(struct adapter *Adapter) ODM_CmnInfoInit(pDM_Odm,ODM_CMNINFO_BWIFI_TEST,Adapter->registrypriv.wifi_spec); - if(pHalData->rf_type == RF_1T1R){ + if (pHalData->rf_type == RF_1T1R){ ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_1T1R); } - else if(pHalData->rf_type == RF_2T2R){ + else if (pHalData->rf_type == RF_2T2R){ ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_2T2R); } - else if(pHalData->rf_type == RF_1T2R){ + else if (pHalData->rf_type == RF_1T2R){ ODM_CmnInfoUpdate(pDM_Odm,ODM_CMNINFO_RF_TYPE,ODM_1T2R); } @@ -204,7 +204,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter) pdmpriv->InitODMFlag |= ODM_MAC_EDCA_TURBO; } - if(pHalData->AntDivCfg) + if (pHalData->AntDivCfg) pdmpriv->InitODMFlag |= ODM_BB_ANT_DIV; #if (MP_DRIVER==1) @@ -288,11 +288,11 @@ rtl8188e_HalDmWatchDog( #ifdef CONFIG_P2P /* Fw is under p2p powersaving mode, driver should stop dynamic mechanism. */ /* modifed by thomas. 2011.06.11. */ - if(Adapter->wdinfo.p2p_ps_mode) + if (Adapter->wdinfo.p2p_ps_mode) bFwPSAwake = false; #endif /* CONFIG_P2P */ - if( (hw_init_completed == true) + if ( (hw_init_completed == true) && ((!bFwCurrentInPSMode) && bFwPSAwake)) { /* */ @@ -308,7 +308,7 @@ rtl8188e_HalDmWatchDog( u8 bLinked=false; u8 bsta_state = false; - if(rtw_linked_check(Adapter)) + if (rtw_linked_check(Adapter)) bLinked = true; ODM_CmnInfoUpdate(&pHalData->odmpriv ,ODM_CMNINFO_LINK, bLinked); @@ -355,12 +355,12 @@ void AntDivCompare8188E(struct adapter *Adapter, struct wlan_bssid_ex *dst, stru /* struct adapter *Adapter = pDM_Odm->Adapter ; */ HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - if(0 != pHalData->AntDivCfg ) + if (0 != pHalData->AntDivCfg ) { /* DBG_8192C("update_network=> orgRSSI(%d)(%d),newRSSI(%d)(%d)\n",dst->Rssi,query_rx_pwr_percentage(dst->Rssi), */ /* src->Rssi,query_rx_pwr_percentage(src->Rssi)); */ /* select optimum_antenna for before linked =>For antenna diversity */ - if(dst->Rssi >= src->Rssi )/* keep org parameter */ + if (dst->Rssi >= src->Rssi )/* keep org parameter */ { src->Rssi = dst->Rssi; src->PhyInfo.Optimum_antenna = dst->PhyInfo.Optimum_antenna; @@ -378,19 +378,19 @@ u8 AntDivBeforeLink8188E(struct adapter *Adapter ) struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); /* Condition that does not need to use antenna diversity. */ - if(pHalData->AntDivCfg==0) + if (pHalData->AntDivCfg==0) { /* DBG_8192C("odm_AntDivBeforeLink8192C(): No AntDiv Mechanism.\n"); */ return false; } - if(check_fwstate(pmlmepriv, _FW_LINKED) == true) + if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { return false; } - if(pDM_SWAT_Table->SWAS_NoLink_State == 0){ + if (pDM_SWAT_Table->SWAS_NoLink_State == 0){ /* switch channel */ pDM_SWAT_Table->SWAS_NoLink_State = 1; pDM_SWAT_Table->CurAntenna = (pDM_SWAT_Table->CurAntenna==Antenna_A)?Antenna_B:Antenna_A; diff --git a/hal/rtl8188e_hal_init.c b/hal/rtl8188e_hal_init.c index 07f554c..5d6fa3d 100644 --- a/hal/rtl8188e_hal_init.c +++ b/hal/rtl8188e_hal_init.c @@ -33,14 +33,14 @@ static void iol_mode_enable(struct adapter *padapter, u8 enable) { u8 reg_0xf0 = 0; - if(enable) + if (enable) { /* Enable initial offload */ reg_0xf0 = rtw_read8(padapter, REG_SYS_CFG); /* DBG_871X("%s reg_0xf0:0x%02x, write 0x%02x\n", __FUNCTION__, reg_0xf0, reg_0xf0|SW_OFFLOAD_EN); */ rtw_write8(padapter, REG_SYS_CFG, reg_0xf0|SW_OFFLOAD_EN); - if(padapter->bFWReady == false) + if (padapter->bFWReady == false) { printk("bFWReady == false call reset 8051...\n"); _8051Reset88E(padapter); @@ -80,7 +80,7 @@ static s32 iol_execute(struct adapter *padapter, u8 control) reg_0x88 = rtw_read8(padapter, REG_HMEBOX_E0); status = (reg_0x88 & control)?_FAIL:_SUCCESS; - if(reg_0x88 & control<<4) + if (reg_0x88 & control<<4) status = _FAIL; t2= rtw_get_current_time(); /* printk("==> step iol_execute : %5u reg-0x1c0= 0x%02x\n",rtw_get_time_interval_ms(t1,t2),rtw_read8(padapter, 0x1c0)); */ @@ -118,14 +118,14 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) efuseTbl = (u8*)rtw_zmalloc(EFUSE_MAP_LEN_88E); - if(efuseTbl == NULL) + if (efuseTbl == NULL) { DBG_871X("%s: alloc efuseTbl fail!\n", __FUNCTION__); goto exit; } eFuseWord= (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); - if(eFuseWord == NULL) + if (eFuseWord == NULL) { DBG_871X("%s: alloc eFuseWord fail!\n", __FUNCTION__); goto exit; @@ -141,7 +141,7 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) /* */ /* */ rtemp8 = *(phymap+eFuse_Addr); - if(rtemp8 != 0xFF) + if (rtemp8 != 0xFF) { efuse_utilized++; /* printk("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8); */ @@ -162,7 +162,7 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr-1, *rtemp8)); */ /* Check PG header for section num. */ - if((rtemp8 & 0x1F ) == 0x0F) /* extended header */ + if ((rtemp8 & 0x1F ) == 0x0F) /* extended header */ { u1temp =( (rtemp8 & 0xE0) >> 5); /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header u1temp=%x *rtemp&0xE0 0x%x\n", u1temp, *rtemp8 & 0xE0)); */ @@ -173,12 +173,12 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8)); */ - if((rtemp8 & 0x0F) == 0x0F) + if ((rtemp8 & 0x0F) == 0x0F) { eFuse_Addr++; rtemp8 = *(phymap+eFuse_Addr); - if(rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) + if (rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) { eFuse_Addr++; } @@ -197,7 +197,7 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) wren = (rtemp8 & 0x0f); } - if(offset < EFUSE_MAX_SECTION_88E) + if (offset < EFUSE_MAX_SECTION_88E) { /* Get word enable value from PG header */ /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Offset-%d Worden=%x\n", offset, wren)); */ @@ -205,7 +205,7 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) for(i=0; i= EFUSE_REAL_CONTENT_LEN_88E) + if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) break; /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d", eFuse_Addr)); */ @@ -226,7 +226,7 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) efuse_utilized++; eFuseWord[offset][i] |= (((u16)rtemp8 << 8) & 0xff00); - if(eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) + if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) break; } @@ -239,7 +239,7 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) rtemp8 = *(phymap+eFuse_Addr); /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d rtemp 0x%x\n", eFuse_Addr, *rtemp8)); */ - if(rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) + if (rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) { efuse_utilized++; eFuse_Addr++; @@ -274,10 +274,10 @@ efuse_phymap_to_logical(u8 * phymap, u16 _offset, u16 _size_byte, u8 *pbuf) /* Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_utilized); */ exit: - if(efuseTbl) + if (efuseTbl) rtw_mfree(efuseTbl, EFUSE_MAP_LEN_88E); - if(eFuseWord) + if (eFuseWord) rtw_mfree2d((void *)eFuseWord, EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); } @@ -299,7 +299,7 @@ static void efuse_read_phymap_from_txpktbuf( u8 *pos = content; - if(bcnhead<0) /* if not valid */ + if (bcnhead<0) /* if not valid */ bcnhead = rtw_read8(adapter, REG_TDECTRL+1); DBG_871X("%s bcnhead:%d\n", __FUNCTION__, bcnhead); @@ -353,13 +353,13 @@ static void efuse_read_phymap_from_txpktbuf( pos=content+count; } - if(limit>count && len-2>count) { + if (limit>count && len-2>count) { memcpy(pos, (u8*)&hi32, (limit>=count+4)?4:limit-count); count+=(limit>=count+4)?4:limit-count; pos=content+count; } - if(limit<=count || len-2<=count) + if (limit<=count || len-2<=count) break; i++; } @@ -395,7 +395,7 @@ static s32 iol_read_efuse( status = iol_execute(padapter, CMD_READ_EFUSE_MAP); - if(status == _SUCCESS) + if (status == _SUCCESS) efuse_read_phymap_from_txpktbuf(padapter, txpktbuf_bndy, physical_map, &size); efuse_phymap_to_logical(physical_map, offset, size_byte, logical_map); @@ -408,10 +408,10 @@ s32 rtl8188e_iol_efuse_patch(struct adapter *padapter) s32 result = _SUCCESS; printk("==> %s\n",__FUNCTION__); - if(rtw_IOL_applied(padapter)){ + if (rtw_IOL_applied(padapter)){ iol_mode_enable(padapter, 1); result = iol_execute(padapter, CMD_READ_EFUSE_MAP); - if(result == _SUCCESS) + if (result == _SUCCESS) result = iol_execute(padapter, CMD_EFUSE_PATCH); iol_mode_enable(padapter, 0); @@ -447,7 +447,7 @@ static int rtl8188e_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_fram goto exit; { struct pkt_attrib *pattrib = &xmit_frame->attrib; - if(rtw_usb_bulk_size_boundary(adapter,TXDESC_SIZE+pattrib->last_txcmdsz)) + if (rtw_usb_bulk_size_boundary(adapter,TXDESC_SIZE+pattrib->last_txcmdsz)) { if (rtw_IOL_append_END_cmd(xmit_frame) != _SUCCESS) goto exit; @@ -462,7 +462,7 @@ static int rtl8188e_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_fram u8 page_no = 0; page_no = i*2 ; /* printk(" i = %d, page_no = %d\n",i,page_no); */ - if( (ret = iol_ioconfig(adapter, page_no)) != _SUCCESS) + if ( (ret = iol_ioconfig(adapter, page_no)) != _SUCCESS) { break; } @@ -486,7 +486,7 @@ void rtw_IOL_cmd_tx_pkt_buf_dump(struct adapter *Adapter,int data_len) printk("###### %s ######\n",__FUNCTION__); rtw_write8(Adapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT); - if(pbuf){ + if (pbuf){ for(addr=0;addr< data_cnts;addr++){ /* printk("==> addr:0x%02x\n",addr); */ rtw_write32(Adapter,0x140,addr); @@ -495,7 +495,7 @@ void rtw_IOL_cmd_tx_pkt_buf_dump(struct adapter *Adapter,int data_len) do{ rstatus=(reg_140=rtw_read32(Adapter,REG_PKTBUF_DBG_CTRL)&BIT24); /* printk("rstatus = %02x, reg_140:0x%08x\n",rstatus,reg_140); */ - if(rstatus){ + if (rstatus){ fifo_data = rtw_read32(Adapter,REG_PKTBUF_DBG_DATA_L); /* printk("fifo_data_144:0x%08x\n",fifo_data); */ memcpy(pbuf+(addr*8),&fifo_data , 4); @@ -523,7 +523,7 @@ _FWDownloadEnable( { u8 tmp; - if(enable) + if (enable) { /* MCU firmware download enable. */ tmp = rtw_read8(padapter, REG_MCUFWDL); @@ -576,7 +576,7 @@ _BlockWrite( for (i = 0; i < blockCount_p1; i++) { ret = rtw_writeN(padapter, (FW_8188E_START_ADDRESS + i * blockSize_p1), blockSize_p1, (bufferPtr + i * blockSize_p1)); - if(ret == _FAIL) + if (ret == _FAIL) goto exit; } @@ -597,7 +597,7 @@ _BlockWrite( for (i = 0; i < blockCount_p2; i++) { ret = rtw_writeN(padapter, (FW_8188E_START_ADDRESS + offset + i*blockSize_p2), blockSize_p2, (bufferPtr + offset + i*blockSize_p2)); - if(ret == _FAIL) + if (ret == _FAIL) goto exit; } } @@ -616,7 +616,7 @@ _BlockWrite( for(i = 0 ; i < blockCount_p3 ; i++){ ret =rtw_write8(padapter, (FW_8188E_START_ADDRESS + offset + i), *(bufferPtr + offset + i)); - if(ret == _FAIL) + if (ret == _FAIL) goto exit; } } @@ -683,7 +683,7 @@ _WriteFW( offset = page * MAX_PAGE_SIZE; ret = _PageWrite(padapter, page, bufferPtr+offset, MAX_PAGE_SIZE); - if(ret == _FAIL) + if (ret == _FAIL) goto exit; } if (remainSize) { @@ -691,7 +691,7 @@ _WriteFW( page = pageNums; ret = _PageWrite(padapter, page, bufferPtr+offset, remainSize); - if(ret == _FAIL) + if (ret == _FAIL) goto exit; } @@ -705,7 +705,7 @@ static void _MCUIO_Reset88E(struct adapter *padapter,u8 bReset) { u8 u1bTmp; - if(bReset==true){ + if (bReset==true){ /* Reset MCU IO Wrapper- sugggest by SD1-Gimmy */ u1bTmp = rtw_read8(padapter, REG_RSV_CTRL+1); rtw_write8(padapter,REG_RSV_CTRL+1, (u1bTmp&(~BIT3))); @@ -907,7 +907,7 @@ void rtl8188e_InitializeFirmwareVars(struct adapter *padapter) static void rtl8188e_free_hal_data(struct adapter *padapter) { - if(padapter->HalData) { + if (padapter->HalData) { rtw_mfree(padapter->HalData, sizeof(HAL_DATA_TYPE)); padapter->HalData = NULL; } @@ -956,25 +956,25 @@ hal_EfusePowerSwitch_RTL8188E( /* 1.2V Power: From VDDON with Power Cut(0x0000h[15]), defualt valid */ tmpV16 = rtw_read16(pAdapter,REG_SYS_ISO_CTRL); - if( ! (tmpV16 & PWC_EV12V ) ){ + if ( ! (tmpV16 & PWC_EV12V ) ){ tmpV16 |= PWC_EV12V ; rtw_write16(pAdapter,REG_SYS_ISO_CTRL,tmpV16); } /* Reset: 0x0000h[28], default valid */ tmpV16 = rtw_read16(pAdapter,REG_SYS_FUNC_EN); - if( !(tmpV16 & FEN_ELDR) ){ + if ( !(tmpV16 & FEN_ELDR) ){ tmpV16 |= FEN_ELDR ; rtw_write16(pAdapter,REG_SYS_FUNC_EN,tmpV16); } /* Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) clock from ANA, default valid */ tmpV16 = rtw_read16(pAdapter,REG_SYS_CLKR); - if( (!(tmpV16 & LOADER_CLK_EN) ) ||(!(tmpV16 & ANA8M) ) ){ + if ( (!(tmpV16 & LOADER_CLK_EN) ) ||(!(tmpV16 & ANA8M) ) ){ tmpV16 |= (LOADER_CLK_EN |ANA8M ) ; rtw_write16(pAdapter,REG_SYS_CLKR,tmpV16); } - if(bWrite == true) + if (bWrite == true) { /* Enable LDO 2.5V before read/write action */ tempval = rtw_read8(pAdapter, EFUSE_TEST+3); @@ -987,7 +987,7 @@ hal_EfusePowerSwitch_RTL8188E( { rtw_write8(pAdapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_OFF); - if(bWrite == true){ + if (bWrite == true){ /* Disable LDO 2.5V after read/write action */ tempval = rtw_read8(pAdapter, EFUSE_TEST+3); rtw_write8(pAdapter, EFUSE_TEST+3, (tempval & 0x7F)); @@ -1029,7 +1029,7 @@ static bool efuse_read_phymap( while(addr < limit) { ReadEFuseByte(Adapter, addr, pos, false); - if(*pos != 0xFF) + if (*pos != 0xFF) { pos++; addr++; @@ -1071,21 +1071,21 @@ Hal_EfuseReadEFuse88E( /* */ /* Do NOT excess total size of EFuse table. Added by Roger, 2008.11.10. */ /* */ - if((_offset + _size_byte)>EFUSE_MAP_LEN_88E) + if ((_offset + _size_byte)>EFUSE_MAP_LEN_88E) {/* total E-Fuse table is 512bytes */ DBG_8192C("Hal_EfuseReadEFuse88E(): Invalid offset(%#x) with read bytes(%#x)!!\n",_offset, _size_byte); goto exit; } efuseTbl = (u8*)rtw_zmalloc(EFUSE_MAP_LEN_88E); - if(efuseTbl == NULL) + if (efuseTbl == NULL) { DBG_871X("%s: alloc efuseTbl fail!\n", __FUNCTION__); goto exit; } eFuseWord= (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); - if(eFuseWord == NULL) + if (eFuseWord == NULL) { DBG_871X("%s: alloc eFuseWord fail!\n", __FUNCTION__); goto exit; @@ -1101,7 +1101,7 @@ Hal_EfuseReadEFuse88E( /* */ /* */ ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); - if(*rtemp8 != 0xFF) + if (*rtemp8 != 0xFF) { efuse_utilized++; /* DBG_8192C("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8); */ @@ -1122,7 +1122,7 @@ Hal_EfuseReadEFuse88E( /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("efuse_Addr-%d efuse_data=%x\n", eFuse_Addr-1, *rtemp8)); */ /* Check PG header for section num. */ - if((*rtemp8 & 0x1F ) == 0x0F) /* extended header */ + if ((*rtemp8 & 0x1F ) == 0x0F) /* extended header */ { u1temp =( (*rtemp8 & 0xE0) >> 5); /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header u1temp=%x *rtemp&0xE0 0x%x\n", u1temp, *rtemp8 & 0xE0)); */ @@ -1133,12 +1133,12 @@ Hal_EfuseReadEFuse88E( /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("extended header efuse_Addr-%d efuse_data=%x\n", eFuse_Addr, *rtemp8)); */ - if((*rtemp8 & 0x0F) == 0x0F) + if ((*rtemp8 & 0x0F) == 0x0F) { eFuse_Addr++; ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); - if(*rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) + if (*rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) { eFuse_Addr++; } @@ -1157,7 +1157,7 @@ Hal_EfuseReadEFuse88E( wren = (*rtemp8 & 0x0f); } - if(offset < EFUSE_MAX_SECTION_88E) + if (offset < EFUSE_MAX_SECTION_88E) { /* Get word enable value from PG header */ /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Offset-%d Worden=%x\n", offset, wren)); */ @@ -1165,7 +1165,7 @@ Hal_EfuseReadEFuse88E( for(i=0; i= EFUSE_REAL_CONTENT_LEN_88E) + if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) break; /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d", eFuse_Addr)); */ @@ -1186,7 +1186,7 @@ Hal_EfuseReadEFuse88E( efuse_utilized++; eFuseWord[offset][i] |= (((u16)*rtemp8 << 8) & 0xff00); - if(eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) + if (eFuse_Addr >= EFUSE_REAL_CONTENT_LEN_88E) break; } @@ -1199,7 +1199,7 @@ Hal_EfuseReadEFuse88E( ReadEFuseByte(Adapter, eFuse_Addr, rtemp8, bPseudoTest); /* RTPRINT(FEEPROM, EFUSE_READ_ALL, ("Addr=%d rtemp 0x%x\n", eFuse_Addr, *rtemp8)); */ - if(*rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) + if (*rtemp8 != 0xFF && (eFuse_Addr < EFUSE_REAL_CONTENT_LEN_88E)) { efuse_utilized++; eFuse_Addr++; @@ -1234,10 +1234,10 @@ Hal_EfuseReadEFuse88E( rtw_hal_set_hwreg(Adapter, HW_VAR_EFUSE_BYTES, (u8 *)&eFuse_Addr); exit: - if(efuseTbl) + if (efuseTbl) rtw_mfree(efuseTbl, EFUSE_MAP_LEN_88E); - if(eFuseWord) + if (eFuseWord) rtw_mfree2d((void *)eFuseWord, EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); } @@ -1253,14 +1253,14 @@ Hal_EfuseSwitchToBank( u32 value32=0; /* RTPRINT(FEEPROM, EFUSE_PG, ("Efuse switch bank to %d\n", bank)); */ - if(bPseudoTest) + if (bPseudoTest) { fakeEfuseBank = bank; bRet = true; } else { - if(IS_HARDWARE_TYPE_8723A(pAdapter) && + if (IS_HARDWARE_TYPE_8723A(pAdapter) && INCLUDE_MULTI_FUNC_BT(pAdapter)) { value32 = rtw_read32(pAdapter, EFUSE_TEST); @@ -1308,10 +1308,10 @@ ReadEFuseByIC( u8 logical_map[512]; #endif - if(!bPseudoTest )/* rtw_IOL_applied(Adapter)) */ + if (!bPseudoTest )/* rtw_IOL_applied(Adapter)) */ { int ret = _FAIL; - if(rtw_IOL_applied(Adapter)) + if (rtw_IOL_applied(Adapter)) { rtw_hal_power_on(Adapter); @@ -1323,7 +1323,7 @@ ReadEFuseByIC( #endif iol_mode_enable(Adapter, 0); - if(_SUCCESS == ret) + if (_SUCCESS == ret) goto exit; } } @@ -1332,16 +1332,16 @@ ReadEFuseByIC( exit: #ifdef DBG_IOL_READ_EFUSE_MAP - if(_rtw_memcmp(logical_map, Adapter->eeprompriv.efuse_eeprom_data, 0x130) == false) + if (_rtw_memcmp(logical_map, Adapter->eeprompriv.efuse_eeprom_data, 0x130) == false) { int i; DBG_871X("%s compare first 0x130 byte fail\n", __FUNCTION__); for(i=0;i<512;i++) { - if(i%16==0) + if (i%16==0) DBG_871X("0x%03x: ", i); DBG_871X("%02x ", logical_map[i]); - if(i%16==15) + if (i%16==15) DBG_871X("\n"); } DBG_871X("\n"); @@ -1374,7 +1374,7 @@ rtl8188e_ReadEFuse( bool bPseudoTest ) { - if(bPseudoTest) + if (bPseudoTest) { ReadEFuse_Pseudo(Adapter, efuseType, _offset, _size_byte, pbuf, bPseudoTest); } @@ -1530,7 +1530,7 @@ rtl8188e_EFUSE_GetEfuseDefinition( bool bPseudoTest ) { - if(bPseudoTest) + if (bPseudoTest) { Hal_EFUSEGetEfuseDefinition_Pseudo88E(pAdapter, efuseType, type, pOut); } @@ -1555,7 +1555,7 @@ Hal_EfuseWordEnableDataWrite(struct adapter *pAdapter, memset((void *)tmpdata, 0xff, PGPKT_DATA_SIZE); /* RT_TRACE(COMP_EFUSE, DBG_LOUD, ("word_en = %x efuse_addr=%x\n", word_en, efuse_addr)); */ - if(!(word_en&BIT0)) + if (!(word_en&BIT0)) { tmpaddr = start_addr; efuse_OneByteWrite(pAdapter,start_addr++, data[0], bPseudoTest); @@ -1563,11 +1563,11 @@ Hal_EfuseWordEnableDataWrite(struct adapter *pAdapter, efuse_OneByteRead(pAdapter,tmpaddr, &tmpdata[0], bPseudoTest); efuse_OneByteRead(pAdapter,tmpaddr+1, &tmpdata[1], bPseudoTest); - if((data[0]!=tmpdata[0])||(data[1]!=tmpdata[1])){ + if ((data[0]!=tmpdata[0])||(data[1]!=tmpdata[1])){ badworden &= (~BIT0); } } - if(!(word_en&BIT1)) + if (!(word_en&BIT1)) { tmpaddr = start_addr; efuse_OneByteWrite(pAdapter,start_addr++, data[2], bPseudoTest); @@ -1575,11 +1575,11 @@ Hal_EfuseWordEnableDataWrite(struct adapter *pAdapter, efuse_OneByteRead(pAdapter,tmpaddr , &tmpdata[2], bPseudoTest); efuse_OneByteRead(pAdapter,tmpaddr+1, &tmpdata[3], bPseudoTest); - if((data[2]!=tmpdata[2])||(data[3]!=tmpdata[3])){ + if ((data[2]!=tmpdata[2])||(data[3]!=tmpdata[3])){ badworden &=( ~BIT1); } } - if(!(word_en&BIT2)) + if (!(word_en&BIT2)) { tmpaddr = start_addr; efuse_OneByteWrite(pAdapter,start_addr++, data[4], bPseudoTest); @@ -1587,11 +1587,11 @@ Hal_EfuseWordEnableDataWrite(struct adapter *pAdapter, efuse_OneByteRead(pAdapter,tmpaddr, &tmpdata[4], bPseudoTest); efuse_OneByteRead(pAdapter,tmpaddr+1, &tmpdata[5], bPseudoTest); - if((data[4]!=tmpdata[4])||(data[5]!=tmpdata[5])){ + if ((data[4]!=tmpdata[4])||(data[5]!=tmpdata[5])){ badworden &=( ~BIT2); } } - if(!(word_en&BIT3)) + if (!(word_en&BIT3)) { tmpaddr = start_addr; efuse_OneByteWrite(pAdapter,start_addr++, data[6], bPseudoTest); @@ -1599,7 +1599,7 @@ Hal_EfuseWordEnableDataWrite(struct adapter *pAdapter, efuse_OneByteRead(pAdapter,tmpaddr, &tmpdata[6], bPseudoTest); efuse_OneByteRead(pAdapter,tmpaddr+1, &tmpdata[7], bPseudoTest); - if((data[6]!=tmpdata[6])||(data[7]!=tmpdata[7])){ + if ((data[6]!=tmpdata[6])||(data[7]!=tmpdata[7])){ badworden &=( ~BIT3); } } @@ -1629,7 +1629,7 @@ rtl8188e_Efuse_WordEnableDataWrite(struct adapter *pAdapter, { u8 ret=0; - if(bPseudoTest) + if (bPseudoTest) { ret = Hal_EfuseWordEnableDataWrite_Pseudo(pAdapter, efuse_addr, word_en, data, bPseudoTest); } @@ -1652,7 +1652,7 @@ hal_EfuseGetCurrentSize_8188e(struct adapter *pAdapter, u8 hoffset=0,hworden=0; u8 efuse_data,word_cnts=0; - if(bPseudoTest) + if (bPseudoTest) { efuse_addr = (u16)(fakeEfuseUsedBytes); } @@ -1666,14 +1666,14 @@ hal_EfuseGetCurrentSize_8188e(struct adapter *pAdapter, efuse_OneByteRead(pAdapter, efuse_addr ,&efuse_data, bPseudoTest) && AVAILABLE_EFUSE_ADDR(efuse_addr)) { - if(efuse_data!=0xFF) + if (efuse_data!=0xFF) { - if((efuse_data&0x1F) == 0x0F) /* extended header */ + if ((efuse_data&0x1F) == 0x0F) /* extended header */ { hoffset = efuse_data; efuse_addr++; efuse_OneByteRead(pAdapter, efuse_addr ,&efuse_data, bPseudoTest); - if((efuse_data & 0x0F) == 0x0F) + if ((efuse_data & 0x0F) == 0x0F) { efuse_addr++; continue; @@ -1699,7 +1699,7 @@ hal_EfuseGetCurrentSize_8188e(struct adapter *pAdapter, } } - if(bPseudoTest) + if (bPseudoTest) { fakeEfuseUsedBytes = efuse_addr; /* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfuseGetCurrentSize_8723A(), return %d\n", fakeEfuseUsedBytes)); */ @@ -1733,7 +1733,7 @@ rtl8188e_EfuseGetCurrentSize( { u16 ret=0; - if(bPseudoTest) + if (bPseudoTest) { ret = Hal_EfuseGetCurrentSize_Pseudo(pAdapter, bPseudoTest); } @@ -1769,9 +1769,9 @@ hal_EfusePgPacketRead_8188e( EFUSE_GetEfuseDefinition(pAdapter, EFUSE_WIFI, TYPE_EFUSE_MAX_SECTION, (void *)&max_section, bPseudoTest); - if(data==NULL) + if (data==NULL) return false; - if(offset>max_section) + if (offset>max_section) return false; memset((void *)data, 0xff, sizeof(u8)*PGPKT_DATA_SIZE); @@ -1786,16 +1786,16 @@ hal_EfusePgPacketRead_8188e( while(bContinual && AVAILABLE_EFUSE_ADDR(efuse_addr) ) { /* Header Read ------------- */ - if(ReadState & PG_STATE_HEADER) + if (ReadState & PG_STATE_HEADER) { - if(efuse_OneByteRead(pAdapter, efuse_addr ,&efuse_data, bPseudoTest)&&(efuse_data!=0xFF)) + if (efuse_OneByteRead(pAdapter, efuse_addr ,&efuse_data, bPseudoTest)&&(efuse_data!=0xFF)) { - if(EXT_HEADER(efuse_data)) + if (EXT_HEADER(efuse_data)) { tmp_header = efuse_data; efuse_addr++; efuse_OneByteRead(pAdapter, efuse_addr ,&efuse_data, bPseudoTest); - if(!ALL_WORDS_DISABLED(efuse_data)) + if (!ALL_WORDS_DISABLED(efuse_data)) { hoffset = ((tmp_header & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); hworden = efuse_data & 0x0F; @@ -1815,20 +1815,20 @@ hal_EfusePgPacketRead_8188e( word_cnts = Efuse_CalculateWordCnts(hworden); bDataEmpty = true ; - if(hoffset==offset) + if (hoffset==offset) { for(tmpidx = 0;tmpidx< word_cnts*2 ;tmpidx++) { - if(efuse_OneByteRead(pAdapter, efuse_addr+1+tmpidx ,&efuse_data, bPseudoTest) ) + if (efuse_OneByteRead(pAdapter, efuse_addr+1+tmpidx ,&efuse_data, bPseudoTest) ) { tmpdata[tmpidx] = efuse_data; - if(efuse_data!=0xff) + if (efuse_data!=0xff) { bDataEmpty = false; } } } - if(bDataEmpty==false){ + if (bDataEmpty==false){ ReadState = PG_STATE_DATA; }else{/* read next header */ efuse_addr = efuse_addr + (word_cnts*2)+1; @@ -1846,7 +1846,7 @@ hal_EfusePgPacketRead_8188e( } } /* Data section Read ------------- */ - else if(ReadState & PG_STATE_DATA) + else if (ReadState & PG_STATE_DATA) { efuse_WordEnableDataRead(hworden,tmpdata,data); efuse_addr = efuse_addr + (word_cnts*2)+1; @@ -1855,7 +1855,7 @@ hal_EfusePgPacketRead_8188e( } - if( (data[0]==0xff) &&(data[1]==0xff) && (data[2]==0xff) && (data[3]==0xff) && + if ( (data[0]==0xff) &&(data[1]==0xff) && (data[2]==0xff) && (data[3]==0xff) && (data[4]==0xff) &&(data[5]==0xff) && (data[6]==0xff) && (data[7]==0xff)) return false; else @@ -1898,7 +1898,7 @@ rtl8188e_Efuse_PgPacketRead( struct adapter *pAdapter, { int ret=0; - if(bPseudoTest) + if (bPseudoTest) { ret = Hal_EfusePgPacketRead_Pseudo(pAdapter, offset, data, bPseudoTest); } @@ -1925,15 +1925,15 @@ hal_EfuseFixHeaderProcess( memset((void *)originaldata, 0xff, 8); - if(Efuse_PgPacketRead(pAdapter, pFixPkt->offset, originaldata, bPseudoTest)) + if (Efuse_PgPacketRead(pAdapter, pFixPkt->offset, originaldata, bPseudoTest)) { /* check if data exist */ badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr+1, pFixPkt->word_en, originaldata, bPseudoTest); - if(badworden != 0xf) /* write fail */ + if (badworden != 0xf) /* write fail */ { PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pFixPkt->offset, badworden, originaldata, bPseudoTest); - if(!PgWriteSuccess) + if (!PgWriteSuccess) return false; else efuse_addr = Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest); @@ -1976,7 +1976,7 @@ hal_EfusePgPacketWrite2ByteHeader( while(tmp_header == 0xFF) { - if(repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) + if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { /* RTPRINT(FEEPROM, EFUSE_PG, ("Repeat over limit for pg_header!!\n")); */ return false; @@ -1987,7 +1987,7 @@ hal_EfusePgPacketWrite2ByteHeader( } /* to write ext_header */ - if(tmp_header == pg_header) + if (tmp_header == pg_header) { efuse_addr++; pg_header_temp = pg_header; @@ -1998,7 +1998,7 @@ hal_EfusePgPacketWrite2ByteHeader( while(tmp_header == 0xFF) { - if(repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) + if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { /* RTPRINT(FEEPROM, EFUSE_PG, ("Repeat over limit for ext_header!!\n")); */ return false; @@ -2008,9 +2008,9 @@ hal_EfusePgPacketWrite2ByteHeader( efuse_OneByteRead(pAdapter, efuse_addr, &tmp_header, bPseudoTest); } - if((tmp_header & 0x0F) == 0x0F) /* word_en PG fail */ + if ((tmp_header & 0x0F) == 0x0F) /* word_en PG fail */ { - if(repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) + if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { /* RTPRINT(FEEPROM, EFUSE_PG, ("Repeat over limit for word_en!!\n")); */ return false; @@ -2021,14 +2021,14 @@ hal_EfusePgPacketWrite2ByteHeader( continue; } } - else if(pg_header != tmp_header) /* offset PG fail */ + else if (pg_header != tmp_header) /* offset PG fail */ { PGPKT_STRUCT fixPkt; /* RTPRINT(FEEPROM, EFUSE_PG, ("Error condition for offset PG fail, need to cover the existed data\n")); */ fixPkt.offset = ((pg_header_temp & 0xE0) >> 5) | ((tmp_header & 0xF0) >> 1); fixPkt.word_en = tmp_header & 0x0F; fixPkt.word_cnts = Efuse_CalculateWordCnts(fixPkt.word_en); - if(!hal_EfuseFixHeaderProcess(pAdapter, efuseType, &fixPkt, &efuse_addr, bPseudoTest)) + if (!hal_EfuseFixHeaderProcess(pAdapter, efuseType, &fixPkt, &efuse_addr, bPseudoTest)) return false; } else @@ -2069,7 +2069,7 @@ hal_EfusePgPacketWrite1ByteHeader( while(tmp_header == 0xFF) { - if(repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) + if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { return false; } @@ -2077,7 +2077,7 @@ hal_EfusePgPacketWrite1ByteHeader( efuse_OneByteRead(pAdapter,efuse_addr, &tmp_header, bPseudoTest); } - if(pg_header == tmp_header) + if (pg_header == tmp_header) { bRet = true; } @@ -2088,7 +2088,7 @@ hal_EfusePgPacketWrite1ByteHeader( fixPkt.offset = (tmp_header>>4) & 0x0F; fixPkt.word_en = tmp_header & 0x0F; fixPkt.word_cnts = Efuse_CalculateWordCnts(fixPkt.word_en); - if(!hal_EfuseFixHeaderProcess(pAdapter, efuseType, &fixPkt, &efuse_addr, bPseudoTest)) + if (!hal_EfuseFixHeaderProcess(pAdapter, efuseType, &fixPkt, &efuse_addr, bPseudoTest)) return false; } @@ -2111,7 +2111,7 @@ hal_EfusePgPacketWriteData( badworden = 0x0f; badworden = Efuse_WordEnableDataWrite(pAdapter, efuse_addr+1, pTargetPkt->word_en, pTargetPkt->data, bPseudoTest); - if(badworden == 0x0F) + if (badworden == 0x0F) { /* write ok */ /* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfusePgPacketWriteData ok!!\n")); */ @@ -2124,7 +2124,7 @@ hal_EfusePgPacketWriteData( PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pTargetPkt->offset, badworden, pTargetPkt->data, bPseudoTest); - if(!PgWriteSuccess) + if (!PgWriteSuccess) return false; else return true; @@ -2143,7 +2143,7 @@ hal_EfusePgPacketWriteHeader( { bool bRet=false; - if(pTargetPkt->offset >= EFUSE_MAX_SECTION_BASE) + if (pTargetPkt->offset >= EFUSE_MAX_SECTION_BASE) { bRet = hal_EfusePgPacketWrite2ByteHeader(pAdapter, efuseType, pAddr, pTargetPkt, bPseudoTest); } @@ -2166,22 +2166,22 @@ wordEnMatched( u8 i; /* check if the same words are enabled both target and current PG packet */ - if( ((pTargetPkt->word_en & BIT0) == 0) && + if ( ((pTargetPkt->word_en & BIT0) == 0) && ((pCurPkt->word_en & BIT0) == 0) ) { match_word_en &= ~BIT0; /* enable word 0 */ } - if( ((pTargetPkt->word_en & BIT1) == 0) && + if ( ((pTargetPkt->word_en & BIT1) == 0) && ((pCurPkt->word_en & BIT1) == 0) ) { match_word_en &= ~BIT1; /* enable word 1 */ } - if( ((pTargetPkt->word_en & BIT2) == 0) && + if ( ((pTargetPkt->word_en & BIT2) == 0) && ((pCurPkt->word_en & BIT2) == 0) ) { match_word_en &= ~BIT2; /* enable word 2 */ } - if( ((pTargetPkt->word_en & BIT3) == 0) && + if ( ((pTargetPkt->word_en & BIT3) == 0) && ((pCurPkt->word_en & BIT3) == 0) ) { match_word_en &= ~BIT3; /* enable word 3 */ @@ -2189,7 +2189,7 @@ wordEnMatched( *pWden = match_word_en; - if(match_word_en != 0xf) + if (match_word_en != 0xf) return true; else return false; @@ -2208,7 +2208,7 @@ hal_EfuseCheckIfDatafollowed( for(i=0; i<(word_cnts*2) ; i++) { - if(efuse_OneByteRead(pAdapter, (startAddr+i) ,&efuse_data, bPseudoTest)&&(efuse_data != 0xFF)) + if (efuse_OneByteRead(pAdapter, (startAddr+i) ,&efuse_data, bPseudoTest)&&(efuse_data != 0xFF)) bRet = true; } @@ -2233,9 +2233,9 @@ hal_EfusePartialWriteCheck( EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_BANK, (void *)&efuse_max_available_len, bPseudoTest); EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&efuse_max, bPseudoTest); - if(efuseType == EFUSE_WIFI) + if (efuseType == EFUSE_WIFI) { - if(bPseudoTest) + if (bPseudoTest) { startAddr = (u16)(fakeEfuseUsedBytes%EFUSE_REAL_CONTENT_LEN); } @@ -2247,7 +2247,7 @@ hal_EfusePartialWriteCheck( } else { - if(bPseudoTest) + if (bPseudoTest) { startAddr = (u16)(fakeBTEfuseUsedBytes%EFUSE_REAL_CONTENT_LEN); } @@ -2260,20 +2260,20 @@ hal_EfusePartialWriteCheck( while(1) { - if(startAddr >= efuse_max_available_len) + if (startAddr >= efuse_max_available_len) { bRet = false; break; } - if(efuse_OneByteRead(pAdapter, startAddr, &efuse_data, bPseudoTest) && (efuse_data!=0xFF)) + if (efuse_OneByteRead(pAdapter, startAddr, &efuse_data, bPseudoTest) && (efuse_data!=0xFF)) { - if(EXT_HEADER(efuse_data)) + if (EXT_HEADER(efuse_data)) { cur_header = efuse_data; startAddr++; efuse_OneByteRead(pAdapter, startAddr, &efuse_data, bPseudoTest); - if(ALL_WORDS_DISABLED(efuse_data)) + if (ALL_WORDS_DISABLED(efuse_data)) { /* RTPRINT(FEEPROM, EFUSE_PG, ("Error condition, all words disabled")); */ bRet = false; @@ -2295,21 +2295,21 @@ hal_EfusePartialWriteCheck( curPkt.word_cnts = Efuse_CalculateWordCnts(curPkt.word_en); /* if same header is found but no data followed */ /* write some part of data followed by the header. */ - if( (curPkt.offset == pTargetPkt->offset) && + if ( (curPkt.offset == pTargetPkt->offset) && (!hal_EfuseCheckIfDatafollowed(pAdapter, curPkt.word_cnts, startAddr+1, bPseudoTest)) && wordEnMatched(pTargetPkt, &curPkt, &matched_wden) ) { /* RTPRINT(FEEPROM, EFUSE_PG, ("Need to partial write data by the previous wrote header\n")); */ /* Here to write partial data */ badworden = Efuse_WordEnableDataWrite(pAdapter, startAddr+1, matched_wden, pTargetPkt->data, bPseudoTest); - if(badworden != 0x0F) + if (badworden != 0x0F) { u32 PgWriteSuccess=0; /* if write fail on some words, write these bad words again */ PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pTargetPkt->offset, badworden, pTargetPkt->data, bPseudoTest); - if(!PgWriteSuccess) + if (!PgWriteSuccess) { bRet = false; /* write fail, return */ break; @@ -2318,7 +2318,7 @@ hal_EfusePartialWriteCheck( /* partial write ok, update the target packet for later use */ for(i=0; i<4; i++) { - if((matched_wden & (0x1<word_en |= (0x1<= efuse_max_available_len) + if (Efuse_GetCurrentSize(pAdapter, efuseType, bPseudoTest) >= efuse_max_available_len) { /* RTPRINT(FEEPROM, EFUSE_PG, ("hal_EfusePgCheckAvailableAddr error!!\n")); */ return false; @@ -2394,18 +2394,18 @@ hal_EfusePgPacketWrite_BT( u16 startAddr=0; u8 efuseType=EFUSE_BT; - if(!hal_EfusePgCheckAvailableAddr(pAdapter, efuseType, bPseudoTest)) + if (!hal_EfusePgCheckAvailableAddr(pAdapter, efuseType, bPseudoTest)) return false; hal_EfuseConstructPGPkt(offset, word_en, pData, &targetPkt); - if(!hal_EfusePartialWriteCheck(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) + if (!hal_EfusePartialWriteCheck(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) return false; - if(!hal_EfusePgPacketWriteHeader(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) + if (!hal_EfusePgPacketWriteHeader(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) return false; - if(!hal_EfusePgPacketWriteData(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) + if (!hal_EfusePgPacketWriteData(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) return false; return true; @@ -2424,18 +2424,18 @@ hal_EfusePgPacketWrite_8188e( u16 startAddr=0; u8 efuseType=EFUSE_WIFI; - if(!hal_EfusePgCheckAvailableAddr(pAdapter, efuseType, bPseudoTest)) + if (!hal_EfusePgCheckAvailableAddr(pAdapter, efuseType, bPseudoTest)) return false; hal_EfuseConstructPGPkt(offset, word_en, pData, &targetPkt); - if(!hal_EfusePartialWriteCheck(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) + if (!hal_EfusePartialWriteCheck(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) return false; - if(!hal_EfusePgPacketWriteHeader(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) + if (!hal_EfusePgPacketWriteHeader(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) return false; - if(!hal_EfusePgPacketWriteData(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) + if (!hal_EfusePgPacketWriteData(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest)) return false; return true; @@ -2479,7 +2479,7 @@ rtl8188e_Efuse_PgPacketWrite(struct adapter *pAdapter, { int ret; - if(bPseudoTest) + if (bPseudoTest) { ret = Hal_EfusePgPacketWrite_Pseudo(pAdapter, offset, word_en, data, bPseudoTest); } @@ -2570,10 +2570,10 @@ static void rtl8188e_SetHalODMVar( case HAL_ODM_STA_INFO: { struct sta_info *psta = (struct sta_info *)pValue1; - if(bSet){ + if (bSet){ DBG_8192C("### Set STA_(%d) info\n",psta->mac_id); ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS,psta->mac_id,psta); - #if(RATE_ADAPTIVE_SUPPORT==1) + #if (RATE_ADAPTIVE_SUPPORT==1) ODM_RAInfo_Init(podmpriv,psta->mac_id); #endif } @@ -2743,7 +2743,7 @@ void Read_LLT_Tab(struct adapter *padapter) for(addr=0;addr<176;addr++) { next_addr = _LLTRead(padapter,addr); printk("%d->",next_addr); - if(((addr+1) %8) ==0) + if (((addr+1) %8) ==0) printk("\n"); } printk("\n##################################\n"); @@ -2796,7 +2796,7 @@ Hal_InitPGData88E(struct adapter *padapter) u32 i; u16 value16; - if(false == pEEPROM->bautoload_fail_flag) + if (false == pEEPROM->bautoload_fail_flag) { /* autoload OK. */ if (is_boot_from_eeprom(padapter)) { @@ -2860,7 +2860,7 @@ Hal_EEValueCheck( u8 *pIn, *pOut; pIn = (u8*)pInValue; pOut = (u8*)pOutValue; - if(*pIn >= 0 && *pIn <= 63) + if (*pIn >= 0 && *pIn <= 63) { *pOut = *pIn; } @@ -2890,7 +2890,7 @@ Hal_ReadPowerValueFromPROM_8188E( memset(pwrInfo24G, 0, sizeof(TxPowerInfo24G)); - if(AutoLoadFail) + if (AutoLoadFail) { for(rfPath = 0 ; rfPath < pHalData->NumTotalRFPath ; rfPath++) { @@ -2902,7 +2902,7 @@ Hal_ReadPowerValueFromPROM_8188E( } for(TxCount=0;TxCountBW20_Diff[rfPath][0] = EEPROM_DEFAULT_24G_HT20_DIFF; pwrInfo24G->OFDM_Diff[rfPath][0] = EEPROM_DEFAULT_24G_OFDM_DIFF; @@ -2931,7 +2931,7 @@ Hal_ReadPowerValueFromPROM_8188E( /* printk(" IndexCCK_Base rfPath:%d group:%d,eeAddr:0x%02x ",rfPath,group,eeAddr); */ pwrInfo24G->IndexCCK_Base[rfPath][group] = PROMContent[eeAddr++]; /* printk(" IndexCCK_Base:%02x\n",pwrInfo24G->IndexCCK_Base[rfPath][group] ); */ - if(pwrInfo24G->IndexCCK_Base[rfPath][group] == 0xFF) + if (pwrInfo24G->IndexCCK_Base[rfPath][group] == 0xFF) { pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; /* pHalData->bNOPG = true; */ @@ -2942,29 +2942,29 @@ Hal_ReadPowerValueFromPROM_8188E( /* printk(" IndexBW40_Base rfPath:%d group:%d,eeAddr:0x%02x ",rfPath,group,eeAddr); */ pwrInfo24G->IndexBW40_Base[rfPath][group] = PROMContent[eeAddr++]; /* printk(" IndexBW40_Base: %02x\n",pwrInfo24G->IndexBW40_Base[rfPath][group] ); */ - if(pwrInfo24G->IndexBW40_Base[rfPath][group] == 0xFF) + if (pwrInfo24G->IndexBW40_Base[rfPath][group] == 0xFF) pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; } for(TxCount=0;TxCountBW40_Diff[rfPath][TxCount] = 0; - if(PROMContent[eeAddr] == 0xFF) + if (PROMContent[eeAddr] == 0xFF) pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_HT20_DIFF; else { pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; - if(pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + if (pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; } - if(PROMContent[eeAddr] == 0xFF) + if (PROMContent[eeAddr] == 0xFF) pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_OFDM_DIFF; else { pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); - if(pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; } pwrInfo24G->CCK_Diff[rfPath][TxCount] = 0; @@ -2972,40 +2972,40 @@ Hal_ReadPowerValueFromPROM_8188E( } else { - if(PROMContent[eeAddr] == 0xFF) + if (PROMContent[eeAddr] == 0xFF) pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; else { pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; - if(pwrInfo24G->BW40_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + if (pwrInfo24G->BW40_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->BW40_Diff[rfPath][TxCount] |= 0xF0; } - if(PROMContent[eeAddr] == 0xFF) + if (PROMContent[eeAddr] == 0xFF) pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; else { pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); - if(pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + if (pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; } eeAddr++; - if(PROMContent[eeAddr] == 0xFF) + if (PROMContent[eeAddr] == 0xFF) pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; else { pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; - if(pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; } - if(PROMContent[eeAddr] == 0xFF) + if (PROMContent[eeAddr] == 0xFF) pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; else { pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); - if(pwrInfo24G->CCK_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + if (pwrInfo24G->CCK_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ pwrInfo24G->CCK_Diff[rfPath][TxCount] |= 0xF0; } eeAddr++; @@ -3041,7 +3041,7 @@ Hal_GetChnlGroup88E( { u8 bIn24G=true; - if(chnl<=14) + if (chnl<=14) { bIn24G=true; @@ -3049,13 +3049,13 @@ Hal_GetChnlGroup88E( *pGroup = 0; else if (chnl < 6) /* Channel 3-5 */ *pGroup = 1; - else if(chnl <9) /* Channel 6-8 */ + else if (chnl <9) /* Channel 6-8 */ *pGroup = 2; - else if(chnl <12) /* Channel 9-11 */ + else if (chnl <12) /* Channel 9-11 */ *pGroup = 3; - else if(chnl <14) /* Channel 12-13 */ + else if (chnl <14) /* Channel 12-13 */ *pGroup = 4; - else if(chnl ==14) /* Channel 14 */ + else if (chnl ==14) /* Channel 14 */ *pGroup = 5; else { @@ -3070,27 +3070,27 @@ Hal_GetChnlGroup88E( *pGroup = 0; else if (chnl <=48) *pGroup = 1; - else if(chnl <=56) + else if (chnl <=56) *pGroup = 2; - else if(chnl <=64) + else if (chnl <=64) *pGroup = 3; - else if(chnl <=104) + else if (chnl <=104) *pGroup = 4; - else if(chnl <=112) + else if (chnl <=112) *pGroup = 5; - else if(chnl <=120) + else if (chnl <=120) *pGroup = 5; - else if(chnl <=128) + else if (chnl <=128) *pGroup = 6; - else if(chnl <=136) + else if (chnl <=136) *pGroup = 7; - else if(chnl <=144) + else if (chnl <=144) *pGroup = 8; - else if(chnl <=153) + else if (chnl <=153) *pGroup = 9; - else if(chnl <=161) + else if (chnl <=161) *pGroup = 10; - else if(chnl <=177) + else if (chnl <=177) *pGroup = 11; else { @@ -3112,7 +3112,7 @@ void Hal_ReadPowerSavingMode88E( struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); u8 tmpvalue; - if(AutoLoadFail){ + if (AutoLoadFail){ pwrctl->bHWPowerdown = false; pwrctl->bSupportRemoteWakeup = false; } @@ -3120,7 +3120,7 @@ void Hal_ReadPowerSavingMode88E( /* hw power down mode selection , 0:rf-off / 1:power down */ - if(padapter->registrypriv.hwpdn_mode==2) + if (padapter->registrypriv.hwpdn_mode==2) pwrctl->bHWPowerdown = (hwinfo[EEPROM_RF_FEATURE_OPTION_88E] & BIT4)?true:false; else pwrctl->bHWPowerdown = padapter->registrypriv.hwpdn_mode; @@ -3154,7 +3154,7 @@ Hal_ReadTxPowerInfo88E( Hal_ReadPowerValueFromPROM_8188E(padapter,&pwrInfo24G, PROMContent, AutoLoadFail); - if(!AutoLoadFail) + if (!AutoLoadFail) pHalData->bTXPowerDataReadFromEEPORM = true; /* for(rfPath = 0 ; rfPath < MAX_RF_PATH ; rfPath++) */ @@ -3163,18 +3163,18 @@ Hal_ReadTxPowerInfo88E( for(ch = 0 ; ch < CHANNEL_MAX_NUMBER ; ch++) { bIn24G = Hal_GetChnlGroup88E(ch+1,&group); - if(bIn24G) + if (bIn24G) { pHalData->Index24G_CCK_Base[rfPath][ch]=pwrInfo24G.IndexCCK_Base[rfPath][group]; - if(ch==(14-1)) + if (ch==(14-1)) pHalData->Index24G_BW40_Base[rfPath][ch]=pwrInfo24G.IndexBW40_Base[rfPath][4]; else pHalData->Index24G_BW40_Base[rfPath][ch]=pwrInfo24G.IndexBW40_Base[rfPath][group]; } - if(bIn24G) + if (bIn24G) { DBG_871X("======= Path %d, Channel %d =======\n",rfPath,ch+1 ); DBG_871X("Index24G_CCK_Base[%d][%d] = 0x%x\n",rfPath,ch+1 ,pHalData->Index24G_CCK_Base[rfPath][ch]); @@ -3200,11 +3200,11 @@ Hal_ReadTxPowerInfo88E( /* 2010/10/19 MH Add Regulator recognize for EU. */ - if(!AutoLoadFail) + if (!AutoLoadFail) { struct registry_priv *registry_par = &padapter->registrypriv; - if( registry_par->regulatory_tid == 0xff){ - if(PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF) + if ( registry_par->regulatory_tid == 0xff){ + if (PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF) pHalData->EEPROMRegulatory = (EEPROM_DEFAULT_BOARD_OPTION&0x7); /* bit0~2 */ else pHalData->EEPROMRegulatory = (PROMContent[EEPROM_RF_BOARD_OPTION_88E]&0x7); /* bit0~2 */ @@ -3230,10 +3230,10 @@ Hal_EfuseParseXtal_8188E( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - if(!AutoLoadFail) + if (!AutoLoadFail) { pHalData->CrystalCap = hwinfo[EEPROM_XTAL_88E]; - if(pHalData->CrystalCap == 0xFF) + if (pHalData->CrystalCap == 0xFF) pHalData->CrystalCap = EEPROM_Default_CrystalCap_88E; } else @@ -3268,9 +3268,9 @@ Hal_EfuseParseEEPROMVer88E( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - if(!AutoLoadFail){ + if (!AutoLoadFail){ pHalData->EEPROMVersion = hwinfo[EEPROM_VERSION_88E]; - if(pHalData->EEPROMVersion == 0xFF) + if (pHalData->EEPROMVersion == 0xFF) pHalData->EEPROMVersion = EEPROM_Default_Version; } else{ @@ -3332,13 +3332,13 @@ Hal_ReadAntennaDiversity88E( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); struct registry_priv *registry_par = &pAdapter->registrypriv; - if(!AutoLoadFail) + if (!AutoLoadFail) { /* Antenna Diversity setting. */ - if(registry_par->antdiv_cfg == 2)/* 2:By EFUSE */ + if (registry_par->antdiv_cfg == 2)/* 2:By EFUSE */ { pHalData->AntDivCfg = (PROMContent[EEPROM_RF_BOARD_OPTION_88E]&0x18)>>3; - if(PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF) + if (PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF) pHalData->AntDivCfg = (EEPROM_DEFAULT_BOARD_OPTION&0x18)>>3;; } else @@ -3346,7 +3346,7 @@ Hal_ReadAntennaDiversity88E( pHalData->AntDivCfg = registry_par->antdiv_cfg ; /* 0:OFF , 1:ON, 2:By EFUSE */ } - if(registry_par->antdiv_type == 0)/* If TRxAntDivType is AUTO in advanced setting, use EFUSE value instead. */ + if (registry_par->antdiv_type == 0)/* If TRxAntDivType is AUTO in advanced setting, use EFUSE value instead. */ { pHalData->TRxAntDivType = PROMContent[EEPROM_RF_ANTENNA_OPT_88E]; if (pHalData->TRxAntDivType == 0xFF) @@ -3383,12 +3383,12 @@ Hal_ReadThermalMeter_88E( /* */ /* ThermalMeter from EEPROM */ /* */ - if(!AutoloadFail) + if (!AutoloadFail) pHalData->EEPROMThermalMeter = PROMContent[EEPROM_THERMAL_METER_88E]; else pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E; - if(pHalData->EEPROMThermalMeter == 0xff || AutoloadFail) + if (pHalData->EEPROMThermalMeter == 0xff || AutoloadFail) { pHalData->bAPKThermalMeterIgnore = true; pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E; @@ -3416,7 +3416,7 @@ bool HalDetectPwrDownMode88E(struct adapter *Adapter) EFUSE_ShadowRead(Adapter, 1, EEPROM_RF_FEATURE_OPTION_88E, (u32 *)&tmpvalue); /* 2010/08/25 MH INF priority > PDN Efuse value. */ - if(tmpvalue & BIT(4) && pwrctrlpriv->reg_pdnmode) + if (tmpvalue & BIT(4) && pwrctrlpriv->reg_pdnmode) { pHalData->pwrdown = true; } diff --git a/hal/rtl8188e_phycfg.c b/hal/rtl8188e_phycfg.c index fddd407..a488148 100644 --- a/hal/rtl8188e_phycfg.c +++ b/hal/rtl8188e_phycfg.c @@ -77,7 +77,7 @@ phy_CalculateBitShift( return (i); } -#if(SIC_ENABLE == 1) +#if (SIC_ENABLE == 1) static bool sic_IsSICReady( struct adapter *Adapter @@ -89,22 +89,22 @@ sic_IsSICReady( while(1) { - if(retryCnt++ >= SIC_MAX_POLL_CNT) + if (retryCnt++ >= SIC_MAX_POLL_CNT) { /* RTPRINT(FPHY, (PHY_SICR|PHY_SICW), ("[SIC], sic_IsSICReady() return false\n")); */ return false; } - /* if(RT_SDIO_CANNOT_IO(Adapter)) */ + /* if (RT_SDIO_CANNOT_IO(Adapter)) */ /* return false; */ sic_cmd = rtw_read8(Adapter, SIC_CMD_REG); /* sic_cmd = PlatformEFIORead1Byte(Adapter, SIC_CMD_REG); */ -#if(SIC_HW_SUPPORT == 1) +#if (SIC_HW_SUPPORT == 1) sic_cmd &= 0xf0; /* [7:4] */ #endif /* RTPRINT(FPHY, (PHY_SICR|PHY_SICW), ("[SIC], sic_IsSICReady(), readback 0x%x=0x%x\n", SIC_CMD_REG, sic_cmd)); */ - if(sic_cmd == SIC_CMD_READY) + if (sic_cmd == SIC_CMD_READY) return true; else { @@ -127,9 +127,9 @@ sic_Read4Byte( /* RTPRINT(FPHY, PHY_SICR, ("[SIC], sic_Read4Byte(): read offset(%#x)\n", offset)); */ - if(sic_IsSICReady(Adapter)) + if (sic_IsSICReady(Adapter)) { -#if(SIC_HW_SUPPORT == 1) +#if (SIC_HW_SUPPORT == 1) rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_PREREAD); /* PlatformEFIOWrite1Byte(Adapter, SIC_CMD_REG, SIC_CMD_PREREAD); */ /* RTPRINT(FPHY, PHY_SICR, ("write cmdreg 0x%x = 0x%x\n", SIC_CMD_REG, SIC_CMD_PREREAD)); */ @@ -149,7 +149,7 @@ sic_Read4Byte( rtw_udelay_os(50); /* PlatformStallExecution(50); */ } - if(sic_IsSICReady(Adapter)) + if (sic_IsSICReady(Adapter)) { u4ret = rtw_read32(Adapter, SIC_DATA_REG); /* u4ret = PlatformEFIORead4Byte(Adapter, SIC_DATA_REG); */ @@ -170,9 +170,9 @@ sic_Write4Byte( { u8 retry = 6; - if(sic_IsSICReady(Adapter)) + if (sic_IsSICReady(Adapter)) { -#if(SIC_HW_SUPPORT == 1) +#if (SIC_HW_SUPPORT == 1) rtw_write8(Adapter, SIC_CMD_REG, SIC_CMD_PREWRITE); #endif rtw_write8(Adapter, SIC_ADDR_REG, (u8)(offset&0xff)); @@ -205,7 +205,7 @@ SIC_SetBBReg( /* RTPRINT(FPHY, PHY_SICW, ("[SIC], SIC_SetBBReg(), mask=0x%x, addr[0x%x]=0x%x\n", BitMask, RegAddr, Data)); */ - if(BitMask!= bMaskDWord){/* if not "double word" write */ + if (BitMask!= bMaskDWord){/* if not "double word" write */ OriginalValue = sic_Read4Byte(Adapter, RegAddr); /* BitShift = sic_CalculateBitShift(BitMask); */ BitShift = phy_CalculateBitShift(BitMask); @@ -251,7 +251,7 @@ SIC_Init( /* Here we need to write 0x1b8~0x1bf = 0 after fw is downloaded */ /* because for 8723E at beginning 0x1b8=0x1e, that will cause */ /* sic always not be ready */ -#if(SIC_HW_SUPPORT == 1) +#if (SIC_HW_SUPPORT == 1) /* RTPRINT(FPHY, PHY_SICR, ("[SIC], SIC_Init(), write 0x%x = 0x%x\n", */ /* SIC_INIT_REG, SIC_INIT_VAL)); */ rtw_write8(Adapter, SIC_INIT_REG, SIC_INIT_VAL); @@ -308,7 +308,7 @@ rtl8188e_PHY_QueryBBReg( return 0; #endif -#if(SIC_ENABLE == 1) +#if (SIC_ENABLE == 1) return SIC_QueryBBReg(Adapter, RegAddr, BitMask); #endif @@ -355,12 +355,12 @@ rtl8188e_PHY_SetBBReg( return; #endif -#if(SIC_ENABLE == 1) +#if (SIC_ENABLE == 1) SIC_SetBBReg(Adapter, RegAddr, BitMask, Data); return; #endif - if(BitMask!= bMaskDWord){/* if not "double word" write */ + if (BitMask!= bMaskDWord){/* if not "double word" write */ OriginalValue = rtw_read32(Adapter, RegAddr); BitShift = phy_CalculateBitShift(BitMask); Data = ((OriginalValue & (~BitMask)) | ((Data << BitShift) & BitMask)); @@ -417,7 +417,7 @@ phy_RFSerialRead( NewOffset = Offset; /* 2009/06/17 MH We can not execute IO for power save or other accident mode. */ - /* if(RT_CANNOT_IO(Adapter)) */ + /* if (RT_CANNOT_IO(Adapter)) */ /* */ /* RTPRINT(FPHY, PHY_RFR, ("phy_RFSerialRead return all one\n")); */ /* return 0xFFFFFFFF; */ @@ -427,7 +427,7 @@ phy_RFSerialRead( /* For RF A/B write 0x824/82c(does not work in the future) */ /* We must use 0x824 for RF A and B to execute read trigger */ tmplong = PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord); - if(eRFPath == RF_PATH_A) + if (eRFPath == RF_PATH_A) tmplong2 = tmplong; else tmplong2 = PHY_QueryBBReg(Adapter, pPhyReg->rfHSSIPara2, bMaskDWord); @@ -443,12 +443,12 @@ phy_RFSerialRead( /* PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2, bMaskDWord, tmplong|bLSSIReadEdge); */ rtw_udelay_os(10);/* PlatformStallExecution(10); */ - if(eRFPath == RF_PATH_A) + if (eRFPath == RF_PATH_A) RfPiEnable = (u8)PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter1, BIT8); - else if(eRFPath == RF_PATH_B) + else if (eRFPath == RF_PATH_B) RfPiEnable = (u8)PHY_QueryBBReg(Adapter, rFPGA0_XB_HSSIParameter1, BIT8); - if(RfPiEnable) + if (RfPiEnable) { /* Read from BBreg8b8, 12 bits for 8190, 20bits for T65 RF */ retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBackPi, bLSSIReadBackData); /* DBG_8192C("Readback from RF-PI : 0x%x\n", retValue); */ @@ -680,7 +680,7 @@ s32 PHY_MACConfig8188E(struct adapter *Adapter) pszMACRegFile = sz8188EMACRegFile; /* Config MAC */ - if(HAL_STATUS_FAILURE == ODM_ConfigMACWithHeaderFile(&pHalData->odmpriv)) + if (HAL_STATUS_FAILURE == ODM_ConfigMACWithHeaderFile(&pHalData->odmpriv)) rtStatus = _FAIL; /* 2010.07.13 AMPDU aggregation number B */ @@ -863,107 +863,107 @@ storePwrIndexDiffRateOffset( { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - if(RegAddr == rTxAGC_A_Rate18_06) + if (RegAddr == rTxAGC_A_Rate18_06) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][0]-TxAGC_A_Rate18_06 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0]); */ } - if(RegAddr == rTxAGC_A_Rate54_24) + if (RegAddr == rTxAGC_A_Rate54_24) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][1]-TxAGC_A_Rate54_24 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1]); */ } - if(RegAddr == rTxAGC_A_CCK1_Mcs32) + if (RegAddr == rTxAGC_A_CCK1_Mcs32) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][6]-TxAGC_A_CCK1_Mcs32 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6]); */ } - if(RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0xffffff00) + if (RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0xffffff00) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][7]-TxAGC_B_CCK11_A_CCK2_11 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7]); */ } - if(RegAddr == rTxAGC_A_Mcs03_Mcs00) + if (RegAddr == rTxAGC_A_Mcs03_Mcs00) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][2]-TxAGC_A_Mcs03_Mcs00 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2]); */ } - if(RegAddr == rTxAGC_A_Mcs07_Mcs04) + if (RegAddr == rTxAGC_A_Mcs07_Mcs04) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][3]-TxAGC_A_Mcs07_Mcs04 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3]); */ } - if(RegAddr == rTxAGC_A_Mcs11_Mcs08) + if (RegAddr == rTxAGC_A_Mcs11_Mcs08) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][4]-TxAGC_A_Mcs11_Mcs08 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4]); */ } - if(RegAddr == rTxAGC_A_Mcs15_Mcs12) + if (RegAddr == rTxAGC_A_Mcs15_Mcs12) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][5]-TxAGC_A_Mcs15_Mcs12 = 0x%x\n", pHalData->pwrGroupCnt,pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5]); */ - if(pHalData->rf_type== RF_1T1R) + if (pHalData->rf_type== RF_1T1R) { /* printk("pwrGroupCnt = %d\n", pHalData->pwrGroupCnt); */ pHalData->pwrGroupCnt++; } } - if(RegAddr == rTxAGC_B_Rate18_06) + if (RegAddr == rTxAGC_B_Rate18_06) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][8]-TxAGC_B_Rate18_06 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8]); */ } - if(RegAddr == rTxAGC_B_Rate54_24) + if (RegAddr == rTxAGC_B_Rate54_24) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][9]-TxAGC_B_Rate54_24 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9]); */ } - if(RegAddr == rTxAGC_B_CCK1_55_Mcs32) + if (RegAddr == rTxAGC_B_CCK1_55_Mcs32) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][14]-TxAGC_B_CCK1_55_Mcs32 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14]); */ } - if(RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0x000000ff) + if (RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0x000000ff) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][15]-TxAGC_B_CCK11_A_CCK2_11 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15]); */ } - if(RegAddr == rTxAGC_B_Mcs03_Mcs00) + if (RegAddr == rTxAGC_B_Mcs03_Mcs00) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][10]-TxAGC_B_Mcs03_Mcs00 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10]); */ } - if(RegAddr == rTxAGC_B_Mcs07_Mcs04) + if (RegAddr == rTxAGC_B_Mcs07_Mcs04) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][11]-TxAGC_B_Mcs07_Mcs04 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11]); */ } - if(RegAddr == rTxAGC_B_Mcs11_Mcs08) + if (RegAddr == rTxAGC_B_Mcs11_Mcs08) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][12]-TxAGC_B_Mcs11_Mcs08 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12]); */ } - if(RegAddr == rTxAGC_B_Mcs15_Mcs12) + if (RegAddr == rTxAGC_B_Mcs15_Mcs12) { pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13] = Data; /* printk("MCSTxPowerLevelOriginalOffset[%d][13]-TxAGC_B_Mcs15_Mcs12 = 0x%x\n", pHalData->pwrGroupCnt, */ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13]); */ - if(pHalData->rf_type != RF_1T1R) + if (pHalData->rf_type != RF_1T1R) { /* printk("pwrGroupCnt = %d\n", pHalData->pwrGroupCnt); */ pHalData->pwrGroupCnt++; @@ -1063,10 +1063,10 @@ phy_BB8188E_Config_ParaFile( /* 1. Read PHY_REG.TXT BB INIT!! */ /* We will seperate as 88C / 92C according to chip version */ /* */ - if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG)) + if (HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG)) rtStatus = _FAIL; - if(rtStatus != _SUCCESS){ + if (rtStatus != _SUCCESS){ /* RT_TRACE(COMP_INIT, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():Write BB Reg Fail!!")); */ goto phy_BB8190_Config_ParaFile_Fail; } @@ -1074,7 +1074,7 @@ phy_BB8188E_Config_ParaFile( /* */ /* 20100318 Joseph: Config 2T2R to 1T2R if necessary. */ /* */ - /* if(pHalData->rf_type == RF_1T2R) */ + /* if (pHalData->rf_type == RF_1T2R) */ /* */ /* phy_BB8192C_Config_1T(Adapter); */ /* DBG_8192C("phy_BB8188E_Config_ParaFile():Config to 1T!!\n"); */ @@ -1086,19 +1086,19 @@ phy_BB8188E_Config_ParaFile( if (pEEPROM->bautoload_fail_flag == false) { pHalData->pwrGroupCnt = 0; - if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG)) + if (HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG)) rtStatus = _FAIL; } - if(rtStatus != _SUCCESS){ + if (rtStatus != _SUCCESS){ /* RT_TRACE(COMP_INIT, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():BB_PG Reg Fail!!")); */ goto phy_BB8190_Config_ParaFile_Fail; } /* 3. BB AGC table Initialization */ - if(HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_AGC_TAB)) + if (HAL_STATUS_FAILURE ==ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_AGC_TAB)) rtStatus = _FAIL; - if(rtStatus != _SUCCESS){ + if (rtStatus != _SUCCESS){ /* RT_TRACE(COMP_FPGA, DBG_SERIOUS, ("phy_BB8192S_Config_ParaFile():AGC Table Fail\n")); */ goto phy_BB8190_Config_ParaFile_Fail; } @@ -1226,7 +1226,7 @@ PHY_ConfigRFExternalPA( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); u16 i=0; - if(!pHalData->ExternalPA) + if (!pHalData->ExternalPA) return rtStatus; return rtStatus; } @@ -1310,7 +1310,7 @@ PHY_CheckBBAndRFOK( /* */ /* Check whether readback data is correct */ /* */ - if(ulRegRead != WriteData[i]) + if (ulRegRead != WriteData[i]) { /* RT_TRACE(COMP_FPGA, DBG_LOUD, ("ulRegRead: %lx, WriteData: %lx\n", ulRegRead, WriteData[i])); */ rtStatus = _FAIL; @@ -1387,7 +1387,7 @@ phy_DbmToTxPwrIdx( break; } - if((PowerInDbm - Offset) > 0) + if ((PowerInDbm - Offset) > 0) { TxPwrIdx = (u8)((PowerInDbm - Offset) * 2); } @@ -1397,7 +1397,7 @@ phy_DbmToTxPwrIdx( } /* Tx Power Index is too large. */ - if(TxPwrIdx > MAX_TXPWR_IDX_NMODE_92S) + if (TxPwrIdx > MAX_TXPWR_IDX_NMODE_92S) TxPwrIdx = MAX_TXPWR_IDX_NMODE_92S; return TxPwrIdx; @@ -1479,14 +1479,14 @@ PHY_GetTxPowerLevel8188E( TxPwrLevel = pHalData->CurrentOfdm24GTxPwrIdx + pHalData->LegacyHTTxPowerDiff; /* Compare with Legacy OFDM Tx power. */ - if(phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_G, TxPwrLevel) > TxPwrDbm) + if (phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_G, TxPwrLevel) > TxPwrDbm) TxPwrDbm = phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_G, TxPwrLevel); /* HT OFDM */ TxPwrLevel = pHalData->CurrentOfdm24GTxPwrIdx; /* Compare with HT OFDM Tx power. */ - if(phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_N_24G, TxPwrLevel) > TxPwrDbm) + if (phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_N_24G, TxPwrLevel) > TxPwrDbm) TxPwrDbm = phy_TxPwrIdxToDbm(Adapter, WIRELESS_MODE_N_24G, TxPwrLevel); *powerlevel = TxPwrDbm; @@ -1507,14 +1507,14 @@ static void getTxPowerIndex88E( u8 TxCount=0,path_nums; - if((RF_1T2R == pHalData->rf_type) ||(RF_1T1R ==pHalData->rf_type )) + if ((RF_1T2R == pHalData->rf_type) ||(RF_1T1R ==pHalData->rf_type )) path_nums = 1; else path_nums = 2; for(TxCount=0;TxCount< path_nums ;TxCount++) { - if(TxCount==RF_PATH_A) + if (TxCount==RF_PATH_A) { /* 1. CCK */ cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; @@ -1531,7 +1531,7 @@ static void getTxPowerIndex88E( /* pHalData->BW20_24G_Diff[TxCount][RF_PATH_A], */ /* BW20PowerLevel[TxCount])); */ } - else if(TxCount==RF_PATH_B) + else if (TxCount==RF_PATH_B) { /* 1. CCK */ cckPowerLevel[TxCount] = pHalData->Index24G_CCK_Base[TxCount][index]; @@ -1596,7 +1596,7 @@ PHY_SetTxPowerLevel8188E( u8 BW20PowerLevel[MAX_TX_COUNT], BW40PowerLevel[MAX_TX_COUNT]; u8 i=0; /* -#if(MP_DRIVER == 1) +#if (MP_DRIVER == 1) if (Adapter->registrypriv.mp_mode == 1) return; #endif @@ -1640,7 +1640,7 @@ PHY_UpdateTxPowerDbm8188E( u8 CckTxPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_B, powerInDbm); u8 OfdmTxPwrIdx = phy_DbmToTxPwrIdx(Adapter, WIRELESS_MODE_N_24G, powerInDbm); - if(OfdmTxPwrIdx - pHalData->LegacyHTTxPowerDiff > 0) + if (OfdmTxPwrIdx - pHalData->LegacyHTTxPowerDiff > 0) OfdmTxPwrIdx -= pHalData->LegacyHTTxPowerDiff; else OfdmTxPwrIdx = 0; @@ -1711,16 +1711,16 @@ _PHY_SetBWMode92C( u8 regBwOpMode; u8 regRRSR_RSC; - if(pHalData->rf_chip == RF_PSEUDO_11N) + if (pHalData->rf_chip == RF_PSEUDO_11N) { return; } /* There is no 40MHz mode in RF_8225. */ - if(pHalData->rf_chip==RF_8225) + if (pHalData->rf_chip==RF_8225) return; - if(Adapter->bDriverStopped) + if (Adapter->bDriverStopped) return; regBwOpMode = rtw_read8(Adapter, REG_BWOPMODE); @@ -1856,7 +1856,7 @@ PHY_SetBWMode8188E( pHalData->nCur40MhzPrimeSC = Offset; - if((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) + if ((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) _PHY_SetBWMode92C(Adapter); else pHalData->CurrentChannelBW = tmpBW; @@ -1899,7 +1899,7 @@ static void phy_SpurCalibration_8188E( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); /* DbgPrint("===> phy_SpurCalibration_8188E CurrentChannelBW = %d, CurrentChannel = %d\n", pHalData->CurrentChannelBW, pHalData->CurrentChannel); */ - if(pHalData->CurrentChannelBW == 0 && pHalData->CurrentChannel == 13){ + if (pHalData->CurrentChannelBW == 0 && pHalData->CurrentChannel == 13){ PHY_SetBBReg(Adapter, rOFDM1_CFOTracking, BIT(28), 0x1); /* enable CSI Mask */ PHY_SetBBReg(Adapter, rOFDM1_csi_fix_mask, BIT(26)|BIT(25), 0x3); /* Fix CSI Mask Tone */ } @@ -1920,16 +1920,16 @@ PHY_SwChnl8188E( /* Call after initialization */ u8 tmpchannel = pHalData->CurrentChannel; bool bResult = true; - if(pHalData->rf_chip == RF_PSEUDO_11N) + if (pHalData->rf_chip == RF_PSEUDO_11N) { /* pHalData->SwChnlInProgress=false; */ return; /* return immediately if it is peudo-phy */ } - /* if(pHalData->SwChnlInProgress) */ + /* if (pHalData->SwChnlInProgress) */ /* return; */ - /* if(pHalData->SetBWModeInProgress) */ + /* if (pHalData->SetBWModeInProgress) */ /* return; */ /* */ @@ -1956,7 +1956,7 @@ PHY_SwChnl8188E( /* Call after initialization */ /* */ /* pHalData->SwChnlInProgress = true; */ - if(channel == 0) + if (channel == 0) channel = 1; pHalData->CurrentChannel=channel; @@ -1964,19 +1964,19 @@ PHY_SwChnl8188E( /* Call after initialization */ /* pHalData->SwChnlStage=0; */ /* pHalData->SwChnlStep=0; */ - if((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) + if ((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) { _PHY_SwChnl8192C(Adapter, channel); if (IS_VENDOR_8188E_I_CUT_SERIES(Adapter)) phy_SpurCalibration_8188E( Adapter); - if(bResult) + if (bResult) { /* RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress true schdule workitem done\n")); */ } else { /* RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress false schdule workitem error\n")); */ - /* if(IS_HARDWARE_TYPE_8192SU(Adapter)) */ + /* if (IS_HARDWARE_TYPE_8192SU(Adapter)) */ /* */ /* pHalData->SwChnlInProgress = false; */ pHalData->CurrentChannel = tmpchannel; @@ -1987,7 +1987,7 @@ PHY_SwChnl8188E( /* Call after initialization */ else { /* RT_TRACE(COMP_SCAN, DBG_LOUD, ("PHY_SwChnl8192C SwChnlInProgress false driver sleep or unload\n")); */ - /* if(IS_HARDWARE_TYPE_8192SU(Adapter)) */ + /* if (IS_HARDWARE_TYPE_8192SU(Adapter)) */ /* */ /* pHalData->SwChnlInProgress = false; */ pHalData->CurrentChannel = tmpchannel; @@ -2022,12 +2022,12 @@ phy_SetSwChnlCmdArray( { SwChnlCmd* pCmd; - if(CmdTable == NULL) + if (CmdTable == NULL) { /* RT_ASSERT(false, ("phy_SetSwChnlCmdArray(): CmdTable cannot be NULL.\n")); */ return false; } - if(CmdTableIdx >= CmdTableSz) + if (CmdTableIdx >= CmdTableSz) { /* RT_ASSERT(false, */ /* ("phy_SetSwChnlCmdArray(): Access invalid index, please check size of the table, CmdTableIdx:%ld, CmdTableSz:%ld\n", */ @@ -2073,22 +2073,22 @@ PHY_SwChnlPhy8192C( /* Only called during initialize */ /* RT_TRACE(COMP_SCAN | COMP_RM, DBG_LOUD, ("==>PHY_SwChnlPhy8192S(), switch from channel %d to channel %d.\n", pHalData->CurrentChannel, channel)); */ /* Cannot IO. */ - /* if(RT_CANNOT_IO(Adapter)) */ + /* if (RT_CANNOT_IO(Adapter)) */ /* return; */ /* Channel Switching is in progress. */ - /* if(pHalData->SwChnlInProgress) */ + /* if (pHalData->SwChnlInProgress) */ /* return; */ /* return immediately if it is peudo-phy */ - if(pHalData->rf_chip == RF_PSEUDO_11N) + if (pHalData->rf_chip == RF_PSEUDO_11N) { /* pHalData->SwChnlInProgress=false; */ return; } /* pHalData->SwChnlInProgress = true; */ - if( channel == 0) + if ( channel == 0) channel = 1; pHalData->CurrentChannel=channel; @@ -2154,7 +2154,7 @@ static void _PHY_SetRFPathSwitch( { u8 u1bTmp; - if(!pAdapter->hw_init_completed) + if (!pAdapter->hw_init_completed) { u1bTmp = rtw_read8(pAdapter, REG_LEDCFG2) | BIT7; rtw_write8(pAdapter, REG_LEDCFG2, u1bTmp); @@ -2162,9 +2162,9 @@ static void _PHY_SetRFPathSwitch( PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT13, 0x01); } - if(is2T) + if (is2T) { - if(bMain) + if (bMain) PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x1); /* 92C_Path_A */ else PHY_SetBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6, 0x2); /* BT */ @@ -2172,7 +2172,7 @@ static void _PHY_SetRFPathSwitch( else { - if(bMain) + if (bMain) PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300, 0x2); /* Main */ else PHY_SetBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300, 0x1); /* Aux */ @@ -2187,25 +2187,25 @@ static bool _PHY_QueryRFPathSwitch( bool is2T ) { -/* if(is2T) */ +/* if (is2T) */ /* return true; */ - if(!pAdapter->hw_init_completed) + if (!pAdapter->hw_init_completed) { PHY_SetBBReg(pAdapter, REG_LEDCFG0, BIT23, 0x01); PHY_SetBBReg(pAdapter, rFPGA0_XAB_RFParameter, BIT13, 0x01); } - if(is2T) + if (is2T) { - if(PHY_QueryBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6) == 0x01) + if (PHY_QueryBBReg(pAdapter, rFPGA0_XB_RFInterfaceOE, BIT5|BIT6) == 0x01) return true; else return false; } else { - if(PHY_QueryBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300) == 0x02) + if (PHY_QueryBBReg(pAdapter, rFPGA0_XA_RFInterfaceOE, 0x300) == 0x02) return true; else return false; diff --git a/hal/rtl8188e_rf6052.c b/hal/rtl8188e_rf6052.c index 1873e2f..6d4a77e 100644 --- a/hal/rtl8188e_rf6052.c +++ b/hal/rtl8188e_rf6052.c @@ -173,14 +173,14 @@ rtl8188e_PHY_RF6052SetCckTxPower( TurboScanOff = true; - if(pmlmeext->sitesurvey_res.state == SCAN_PROCESS) + if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) { TxAGC[RF_PATH_A] = 0x3f3f3f3f; TxAGC[RF_PATH_B] = 0x3f3f3f3f; TurboScanOff = true;/* disable turbo scan */ - if(TurboScanOff) + if (TurboScanOff) { for(idx1=RF_PATH_A; idx1<=RF_PATH_B; idx1++) { @@ -198,12 +198,12 @@ rtl8188e_PHY_RF6052SetCckTxPower( /* 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. */ /* Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. */ /* In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. */ - if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) + if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) { TxAGC[RF_PATH_A] = 0x10101010; TxAGC[RF_PATH_B] = 0x10101010; } - else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) + else if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) { TxAGC[RF_PATH_A] = 0x00000000; TxAGC[RF_PATH_B] = 0x00000000; @@ -217,7 +217,7 @@ rtl8188e_PHY_RF6052SetCckTxPower( (pPowerlevel[idx1]<<16) | (pPowerlevel[idx1]<<24); } - if(pHalData->EEPROMRegulatory==0) + if (pHalData->EEPROMRegulatory==0) { tmpval = (pHalData->MCSTxPowerLevelOriginalOffset[0][6]) + (pHalData->MCSTxPowerLevelOriginalOffset[0][7]<<8); @@ -252,7 +252,7 @@ rtl8188e_PHY_RF6052SetCckTxPower( ptr = (u8*)(&(TxAGC[idx1])); for(idx2=0; idx2<4; idx2++) { - if(*ptr > RF6052_MAX_TX_PWR) + if (*ptr > RF6052_MAX_TX_PWR) *ptr = RF6052_MAX_TX_PWR; ptr++; } @@ -301,7 +301,7 @@ static void getPowerBase88E( for(i=0; iNumTotalRFPath; i++) { /* Check HT20 to HT40 diff */ - if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) { powerlevel[i] = pPowerLevelBW20[i]; } @@ -350,24 +350,24 @@ static void getTxPowerWriteValByRegulatory88E( case 1: /* Realtek regulatory */ /* increase power diff defined by Realtek for regulatory */ { - if(pHalData->pwrGroupCnt == 1) + if (pHalData->pwrGroupCnt == 1) chnlGroup = 0; - /* if(pHalData->pwrGroupCnt >= pHalData->PGMaxGroup) */ + /* if (pHalData->pwrGroupCnt >= pHalData->PGMaxGroup) */ { if (Channel < 3) /* Chanel 1-2 */ chnlGroup = 0; else if (Channel < 6) /* Channel 3-5 */ chnlGroup = 1; - else if(Channel <9) /* Channel 6-8 */ + else if (Channel <9) /* Channel 6-8 */ chnlGroup = 2; - else if(Channel <12) /* Channel 9-11 */ + else if (Channel <12) /* Channel 9-11 */ chnlGroup = 3; - else if(Channel <14) /* Channel 12-13 */ + else if (Channel <14) /* Channel 12-13 */ chnlGroup = 4; - else if(Channel ==14) /* Channel 14 */ + else if (Channel ==14) /* Channel 14 */ chnlGroup = 4; - if(pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) chnlGroup++; else chnlGroup+=6; @@ -383,7 +383,7 @@ static void getTxPowerWriteValByRegulatory88E( case 3: /* Customer defined power diff. */ /* increase power diff defined by customer. */ chnlGroup = 0; - if(index < 2) + if (index < 2) pwr_diff = pHalData->TxPwrLegacyHtDiff[rf][Channel-1]; else if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) pwr_diff = pHalData->TxPwrHt20Diff[rf][Channel-1]; @@ -393,7 +393,7 @@ static void getTxPowerWriteValByRegulatory88E( else customer_pwr_limit = pHalData->PwrGroupHT20[rf][Channel-1]; - if(pwr_diff >= customer_pwr_limit) + if (pwr_diff >= customer_pwr_limit) pwr_diff = 0; else pwr_diff = customer_pwr_limit - pwr_diff; @@ -402,7 +402,7 @@ static void getTxPowerWriteValByRegulatory88E( { pwr_diff_limit[i] = (u8)((pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)]&(0x7f<<(i*8)))>>(i*8)); - if(pwr_diff_limit[i] > pwr_diff) + if (pwr_diff_limit[i] > pwr_diff) pwr_diff_limit[i] = pwr_diff; } customer_limit = (pwr_diff_limit[3]<<24) | (pwr_diff_limit[2]<<16) | @@ -423,19 +423,19 @@ static void getTxPowerWriteValByRegulatory88E( /* Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. */ /* In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. */ /* 92d do not need this */ - if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) + if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) writeVal = 0x14141414; - else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) + else if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) writeVal = 0x00000000; /* 20100628 Joseph: High power mode for BT-Coexist mechanism. */ /* This mechanism is only applied when Driver-Highpower-Mechanism is OFF. */ - if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1) + if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1) { /* RTPRINT(FBT, BT_TRACE, ("Tx Power (-6)\n")); */ writeVal = writeVal - 0x06060606; } - else if(pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2) + else if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2) { /* RTPRINT(FBT, BT_TRACE, ("Tx Power (-0)\n")); */ writeVal = writeVal ; @@ -472,7 +472,7 @@ static void writeOFDMPowerReg88E( } writeVal = (pwr_val[3]<<24) | (pwr_val[2]<<16) |(pwr_val[1]<<8) |pwr_val[0]; - if(rf == 0) + if (rf == 0) RegOffset = RegOffset_A[index]; else RegOffset = RegOffset_B[index]; @@ -481,19 +481,19 @@ static void writeOFDMPowerReg88E( /* printk("Set OFDM tx pwr- 0x%x = %08x\n", RegOffset, writeVal); */ /* 201005115 Joseph: Set Tx Power diff for Tx power training mechanism. */ - if(((pHalData->rf_type == RF_2T2R) && + if (((pHalData->rf_type == RF_2T2R) && (RegOffset == rTxAGC_A_Mcs15_Mcs12 || RegOffset == rTxAGC_B_Mcs15_Mcs12))|| ((pHalData->rf_type != RF_2T2R) && (RegOffset == rTxAGC_A_Mcs07_Mcs04 || RegOffset == rTxAGC_B_Mcs07_Mcs04)) ) { writeVal = pwr_val[3]; - if(RegOffset == rTxAGC_A_Mcs15_Mcs12 || RegOffset == rTxAGC_A_Mcs07_Mcs04) + if (RegOffset == rTxAGC_A_Mcs15_Mcs12 || RegOffset == rTxAGC_A_Mcs07_Mcs04) RegOffset = 0xc90; - if(RegOffset == rTxAGC_B_Mcs15_Mcs12 || RegOffset == rTxAGC_B_Mcs07_Mcs04) + if (RegOffset == rTxAGC_B_Mcs15_Mcs12 || RegOffset == rTxAGC_B_Mcs07_Mcs04) RegOffset = 0xc98; for(i=0; i<3; i++) { - if(i!=2) + if (i!=2) writeVal = (writeVal>8)?(writeVal-8):0; else writeVal = (writeVal>6)?(writeVal-6):0; @@ -648,11 +648,11 @@ phy_RF6052_Config_ParaFile( switch(eRFPath) { case RF_PATH_A: - if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,(ODM_RF_RADIO_PATH_E)eRFPath, (ODM_RF_RADIO_PATH_E)eRFPath)) + if (HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,(ODM_RF_RADIO_PATH_E)eRFPath, (ODM_RF_RADIO_PATH_E)eRFPath)) rtStatus= _FAIL; break; case RF_PATH_B: - if(HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,(ODM_RF_RADIO_PATH_E)eRFPath, (ODM_RF_RADIO_PATH_E)eRFPath)) + if (HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,(ODM_RF_RADIO_PATH_E)eRFPath, (ODM_RF_RADIO_PATH_E)eRFPath)) rtStatus= _FAIL; break; case RF_PATH_C: @@ -674,7 +674,7 @@ phy_RF6052_Config_ParaFile( break; } - if(rtStatus != _SUCCESS){ + if (rtStatus != _SUCCESS){ /* RT_TRACE(COMP_FPGA, DBG_LOUD, ("phy_RF6052_Config_ParaFile():Radio[%d] Fail!!", eRFPath)); */ goto phy_RF6052_Config_ParaFile_Fail; } @@ -700,7 +700,7 @@ PHY_RF6052_Config8188E( /* Initialize general global value */ /* */ /* TODO: Extend RF_PATH_C and RF_PATH_D in the future */ - if(pHalData->rf_type == RF_1T1R) + if (pHalData->rf_type == RF_1T1R) pHalData->NumTotalRFPath = 1; else pHalData->NumTotalRFPath = 2; diff --git a/hal/rtl8188e_rxdesc.c b/hal/rtl8188e_rxdesc.c index 54174d4..8c1d6b1 100644 --- a/hal/rtl8188e_rxdesc.c +++ b/hal/rtl8188e_rxdesc.c @@ -44,7 +44,7 @@ static void process_rssi(struct adapter *padapter,union recv_frame *prframe) struct signal_stat * signal_stat = &padapter->recvpriv.signal_strength_data; - if(signal_stat->update_req) { + if (signal_stat->update_req) { signal_stat->total_num = 0; signal_stat->total_val = 0; signal_stat->update_req = 0; @@ -61,14 +61,14 @@ static void process_link_qual(struct adapter *padapter,union recv_frame *prframe struct rx_pkt_attrib *pattrib; struct signal_stat * signal_stat; - if(prframe == NULL || padapter==NULL){ + if (prframe == NULL || padapter==NULL){ return; } pattrib = &prframe->u.hdr.attrib; signal_stat = &padapter->recvpriv.signal_qual_data; - if(signal_stat->update_req) { + if (signal_stat->update_req) { signal_stat->total_num = 0; signal_stat->total_val = 0; signal_stat->update_req = 0; @@ -130,7 +130,7 @@ void update_recvframe_attrib_88e( /* update rx report to recv_frame attribute */ pattrib->pkt_rpt_type = (u8)((le32_to_cpu(report.rxdw3) >> 14) & 0x3);/* prxreport->rpt_sel; */ - if(pattrib->pkt_rpt_type == NORMAL_RX)/* Normal rx packet */ + if (pattrib->pkt_rpt_type == NORMAL_RX)/* Normal rx packet */ { pattrib->pkt_len = (u16)(le32_to_cpu(report.rxdw0) &0x00003fff);/* u16)prxreport->pktlen; */ pattrib->drvinfo_sz = (u8)((le32_to_cpu(report.rxdw0) >> 16) & 0xf) * 8;/* u8)(prxreport->drvinfosize << 3); */ @@ -156,10 +156,10 @@ void update_recvframe_attrib_88e( pattrib->icv_err = (u8)((le32_to_cpu(report.rxdw0) >> 15) & 0x1);/* u8)prxreport->icverr; */ pattrib->shift_sz = (u8)((le32_to_cpu(report.rxdw0) >> 24) & 0x3); - } else if(pattrib->pkt_rpt_type == TX_REPORT1) {/* CCX */ + } else if (pattrib->pkt_rpt_type == TX_REPORT1) {/* CCX */ pattrib->pkt_len = TX_RPT1_PKT_LEN; pattrib->drvinfo_sz = 0; - } else if(pattrib->pkt_rpt_type == TX_REPORT2) { /* TX RPT */ + } else if (pattrib->pkt_rpt_type == TX_REPORT2) { /* TX RPT */ pattrib->pkt_len =(u16)(le32_to_cpu(report.rxdw0) & 0x3FF);/* Rx length[9:0] */ pattrib->drvinfo_sz = 0; @@ -170,7 +170,7 @@ void update_recvframe_attrib_88e( pattrib->MacIDValidEntry[1] = le32_to_cpu(report.rxdw5); } - else if(pattrib->pkt_rpt_type == HIS_REPORT)/* USB HISR RPT */ + else if (pattrib->pkt_rpt_type == HIS_REPORT)/* USB HISR RPT */ { pattrib->pkt_len = (u16)(le32_to_cpu(report.rxdw0) &0x00003fff);/* u16)prxreport->pktlen; */ } @@ -211,8 +211,8 @@ void update_recvframe_phyinfo_88e( pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID && (GetFrameSubType(wlanhdr) == WIFI_BEACON); - if(pkt_info.bPacketBeacon){ - if(check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE) == true){ + if (pkt_info.bPacketBeacon){ + if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE) == true){ sa = padapter->mlmepriv.cur_network.network.MacAddress; } else diff --git a/hal/rtl8188e_sreset.c b/hal/rtl8188e_sreset.c index fb48d95..38bc167 100644 --- a/hal/rtl8188e_sreset.c +++ b/hal/rtl8188e_sreset.c @@ -32,13 +32,13 @@ void rtl8188e_sreset_xmit_status_check(struct adapter *padapter) unsigned int diff_time; u32 txdma_status; - if( (txdma_status=rtw_read32(padapter, REG_TXDMA_STATUS)) !=0x00){ + if ( (txdma_status=rtw_read32(padapter, REG_TXDMA_STATUS)) !=0x00){ DBG_871X("%s REG_TXDMA_STATUS:0x%08x\n", __FUNCTION__, txdma_status); rtw_hal_sreset_reset(padapter); } current_time = rtw_get_current_time(); - if(0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) { + if (0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) { diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_time); @@ -77,16 +77,16 @@ void rtl8188e_sreset_linked_status_check(struct adapter *padapter) u32 rx_dma_status = 0; u8 fw_status=0; rx_dma_status = rtw_read32(padapter,REG_RXDMA_STATUS); - if(rx_dma_status!= 0x00){ + if (rx_dma_status!= 0x00){ DBG_8192C("%s REG_RXDMA_STATUS:0x%08x\n",__FUNCTION__,rx_dma_status); rtw_write32(padapter,REG_RXDMA_STATUS,rx_dma_status); } fw_status = rtw_read8(padapter,REG_FMETHR); - if(fw_status != 0x00) + if (fw_status != 0x00) { - if(fw_status == 1) + if (fw_status == 1) DBG_8192C("%s REG_FW_STATUS (0x%02x), Read_Efuse_Fail !! \n",__FUNCTION__,fw_status); - else if(fw_status == 2) + else if (fw_status == 2) DBG_8192C("%s REG_FW_STATUS (0x%02x), Condition_No_Match !! \n",__FUNCTION__,fw_status); } if (psrtpriv->dbg_trigger_point == SRESET_TGP_LINK_STATUS) { diff --git a/hal/rtl8188e_xmit.c b/hal/rtl8188e_xmit.c index f51c407..f839862 100644 --- a/hal/rtl8188e_xmit.c +++ b/hal/rtl8188e_xmit.c @@ -67,22 +67,22 @@ void _dbg_dump_tx_info(struct adapter *padapter,int frame_tag,struct tx_desc *pt u8 bDumpTxDesc = false; rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DUMP_TXPKT, &(bDumpTxPkt)); - if(bDumpTxPkt ==1){/* dump txdesc for data frame */ + if (bDumpTxPkt ==1){/* dump txdesc for data frame */ DBG_871X("dump tx_desc for data frame\n"); - if((frame_tag&0x0f) == DATA_FRAMETAG){ + if ((frame_tag&0x0f) == DATA_FRAMETAG){ bDumpTxDesc = true; } } - else if(bDumpTxPkt ==2){/* dump txdesc for mgnt frame */ + else if (bDumpTxPkt ==2){/* dump txdesc for mgnt frame */ DBG_871X("dump tx_desc for mgnt frame\n"); - if((frame_tag&0x0f) == MGNT_FRAMETAG){ + if ((frame_tag&0x0f) == MGNT_FRAMETAG){ bDumpTxDesc = true; } } - else if(bDumpTxPkt ==3){/* dump early info */ + else if (bDumpTxPkt ==3){/* dump early info */ } - if(bDumpTxDesc){ + if (bDumpTxDesc){ DBG_8192C("=====================================\n"); DBG_8192C("txdw0(0x%08x)\n",ptxdesc->txdw0); DBG_8192C("txdw1(0x%08x)\n",ptxdesc->txdw1); diff --git a/hal/rtl8188eu_led.c b/hal/rtl8188eu_led.c index 56f8c6b..1ba38c0 100644 --- a/hal/rtl8188eu_led.c +++ b/hal/rtl8188eu_led.c @@ -52,7 +52,7 @@ SwLedOn( u8 LedCfg; /* HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); */ - if( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) + if ( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) { return; } @@ -89,7 +89,7 @@ SwLedOff( u8 LedCfg; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - if((padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) + if ((padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) { goto exit; } @@ -100,7 +100,7 @@ SwLedOff( switch(pLed->LedPin) { case LED_PIN_LED0: - if(pHalData->bLedOpenDrain == true) /* Open-drain arrangement for controlling the LED) */ + if (pHalData->bLedOpenDrain == true) /* Open-drain arrangement for controlling the LED) */ { LedCfg &= 0x90; /* Set to software control. */ rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3)); diff --git a/hal/rtl8188eu_recv.c b/hal/rtl8188eu_recv.c index da71ede..34157dc 100644 --- a/hal/rtl8188eu_recv.c +++ b/hal/rtl8188eu_recv.c @@ -44,7 +44,7 @@ void rtl8188eu_init_recvbuf(struct adapter *padapter, struct recv_buf *precvbuf) precvbuf->ref_cnt = 0; - if(precvbuf->pbuf) + if (precvbuf->pbuf) { precvbuf->pdata = precvbuf->phead = precvbuf->ptail = precvbuf->pbuf; precvbuf->pend = precvbuf->pdata + MAX_RECVBUF_SZ; @@ -64,13 +64,13 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter) #ifdef CONFIG_USB_INTERRUPT_IN_PIPE precvpriv->int_in_urb = usb_alloc_urb(0, GFP_KERNEL); - if(precvpriv->int_in_urb == NULL){ + if (precvpriv->int_in_urb == NULL){ res= _FAIL; DBG_8192C("alloc_urb for interrupt in endpoint fail !!!!\n"); goto exit; } precvpriv->int_in_buf = rtw_zmalloc(INTERRUPT_MSG_FORMAT_LEN); - if(precvpriv->int_in_buf == NULL){ + if (precvpriv->int_in_buf == NULL){ res= _FAIL; DBG_8192C("alloc_mem for interrupt in endpoint fail !!!!\n"); goto exit; @@ -81,7 +81,7 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter) _rtw_init_queue(&precvpriv->free_recv_buf_queue); precvpriv->pallocated_recv_buf = rtw_zmalloc(NR_RECVBUFF *sizeof(struct recv_buf) + 4); - if(precvpriv->pallocated_recv_buf==NULL){ + if (precvpriv->pallocated_recv_buf==NULL){ res= _FAIL; RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("alloc recv_buf fail!\n")); goto exit; @@ -100,7 +100,7 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter) precvbuf->alloc_sz = MAX_RECVBUF_SZ; res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf); - if(res==_FAIL) + if (res==_FAIL) break; precvbuf->ref_cnt = 0; @@ -130,7 +130,7 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter) { pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); - if(pskb) + if (pskb) { pskb->dev = padapter->pnetdev; @@ -164,14 +164,14 @@ void rtl8188eu_free_recv_priv (struct adapter *padapter) precvbuf++; } - if(precvpriv->pallocated_recv_buf) + if (precvpriv->pallocated_recv_buf) rtw_mfree(precvpriv->pallocated_recv_buf, NR_RECVBUFF *sizeof(struct recv_buf) + 4); #ifdef CONFIG_USB_INTERRUPT_IN_PIPE - if(precvpriv->int_in_urb) + if (precvpriv->int_in_urb) usb_free_urb(precvpriv->int_in_urb); - if(precvpriv->int_in_buf) + if (precvpriv->int_in_buf) rtw_mfree(precvpriv->int_in_buf, INTERRUPT_MSG_FORMAT_LEN); #endif/* CONFIG_USB_INTERRUPT_IN_PIPE */ diff --git a/hal/rtl8188eu_xmit.c b/hal/rtl8188eu_xmit.c index 13d8af3..d571563 100644 --- a/hal/rtl8188eu_xmit.c +++ b/hal/rtl8188eu_xmit.c @@ -163,19 +163,19 @@ static void fill_txdesc_vcs(struct pkt_attrib *pattrib, __le32 *pdw) break; } - if(pattrib->vcs_mode) { + if (pattrib->vcs_mode) { *pdw |= cpu_to_le32(HW_RTS_EN); /* Set RTS BW */ - if(pattrib->ht_en) + if (pattrib->ht_en) { *pdw |= (pattrib->bwmode&HT_CHANNEL_WIDTH_40)? cpu_to_le32(BIT(27)):0; - if(pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER) + if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER) *pdw |= cpu_to_le32((0x01<<28)&0x30000000); - else if(pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER) + else if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER) *pdw |= cpu_to_le32((0x02<<28)&0x30000000); - else if(pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE) + else if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE) *pdw |= 0; else *pdw |= cpu_to_le32((0x03<<28)&0x30000000); @@ -187,15 +187,15 @@ static void fill_txdesc_phy(struct pkt_attrib *pattrib, __le32 *pdw) { /* DBG_8192C("bwmode=%d, ch_off=%d\n", pattrib->bwmode, pattrib->ch_offset); */ - if(pattrib->ht_en) + if (pattrib->ht_en) { *pdw |= (pattrib->bwmode&HT_CHANNEL_WIDTH_40)? cpu_to_le32(BIT(25)):0; - if(pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER) + if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER) *pdw |= cpu_to_le32((0x01<ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER) + else if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER) *pdw |= cpu_to_le32((0x02<ch_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE) + else if (pattrib->ch_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE) *pdw |= 0; else *pdw |= cpu_to_le32((0x03<registrypriv.mp_mode == 0) { - if((!bagg_pkt) &&(urb_zero_packet_chk(padapter, sz)==0)) { + if ((!bagg_pkt) &&(urb_zero_packet_chk(padapter, sz)==0)) { ptxdesc = (struct tx_desc *)(pmem+PACKET_OFFSET_SZ); pull = 1; } @@ -240,8 +240,8 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag if (bmcst) ptxdesc->txdw0 |= cpu_to_le32(BMC); if (padapter->registrypriv.mp_mode == 0) { - if(!bagg_pkt) { - if((pull) && (pxmitframe->pkt_offset>0)) + if (!bagg_pkt) { + if ((pull) && (pxmitframe->pkt_offset>0)) pxmitframe->pkt_offset = pxmitframe->pkt_offset -1; } } @@ -252,7 +252,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag /* driver uses rate */ ptxdesc->txdw4 |= cpu_to_le32(USERATE);/* rate control always by driver */ - if((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) + if ((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) { /* DBG_8192C("pxmitframe->frame_tag == DATA_FRAMETAG\n"); */ @@ -267,7 +267,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag fill_txdesc_sectype(pattrib, ptxdesc); - if(pattrib->ampdu_en==true){ + if (pattrib->ampdu_en==true){ ptxdesc->txdw2 |= cpu_to_le32(AGG_EN);/* AGG EN */ ptxdesc->txdw6 = cpu_to_le32(0x6666f800); } else{ @@ -305,14 +305,14 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag ptxdesc->txdw5 |= cpu_to_le32(0x0001ff00);/* DATA/RTS Rate FB LMT */ #if (RATE_ADAPTIVE_SUPPORT == 1) - if(pattrib->ht_en){ - if( ODM_RA_GetShortGI_8188E(&pHalData->odmpriv,pattrib->mac_id)) + if (pattrib->ht_en){ + if ( ODM_RA_GetShortGI_8188E(&pHalData->odmpriv,pattrib->mac_id)) ptxdesc->txdw5 |= cpu_to_le32(SGI);/* SGI */ } data_rate =ODM_RA_GetDecisionRate_8188E(&pHalData->odmpriv,pattrib->mac_id); /* for debug */ - if(padapter->fix_rate!= 0xFF){ + if (padapter->fix_rate!= 0xFF){ data_rate = padapter->fix_rate; ptxdesc->txdw4 |= cpu_to_le32(DISDATAFB); @@ -326,11 +326,11 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag #endif /* POWER_TRAINING_ACTIVE==1) */ #else/* if (RATE_ADAPTIVE_SUPPORT == 1) */ - if(pattrib->ht_en) + if (pattrib->ht_en) ptxdesc->txdw5 |= cpu_to_le32(SGI);/* SGI */ data_rate = 0x13; /* default rate: MCS7 */ - if(padapter->fix_rate!= 0xFF){/* rate control by iwpriv */ + if (padapter->fix_rate!= 0xFF){/* rate control by iwpriv */ data_rate = padapter->fix_rate; ptxdesc->txdw4 | cpu_to_le32(DISDATAFB); } @@ -352,7 +352,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate(pmlmeext->tx_rate)); } - } else if((pxmitframe->frame_tag&0x0f)== MGNT_FRAMETAG) { + } else if ((pxmitframe->frame_tag&0x0f)== MGNT_FRAMETAG) { /* offset 4 */ ptxdesc->txdw1 |= cpu_to_le32(pattrib->mac_id&0x3f); @@ -378,13 +378,13 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag /* offset 20 */ ptxdesc->txdw5 |= cpu_to_le32(RTY_LMT_EN);/* retry limit enable */ - if(pattrib->retry_ctrl == true) + if (pattrib->retry_ctrl == true) ptxdesc->txdw5 |= cpu_to_le32(0x00180000);/* retry limit = 6 */ else ptxdesc->txdw5 |= cpu_to_le32(0x00300000);/* retry limit = 12 */ #ifdef CONFIG_INTEL_PROXIM - if((padapter->proximity.proxim_on==true)&&(pattrib->intel_proxim==true)){ + if ((padapter->proximity.proxim_on==true)&&(pattrib->intel_proxim==true)){ DBG_871X("\n %s pattrib->rate=%d\n",__FUNCTION__,pattrib->rate); ptxdesc->txdw5 |= cpu_to_le32( pattrib->rate); } @@ -394,7 +394,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate(pmlmeext->tx_rate)); } } - else if((pxmitframe->frame_tag&0x0f) == TXAGG_FRAMETAG) + else if ((pxmitframe->frame_tag&0x0f) == TXAGG_FRAMETAG) { DBG_8192C("pxmitframe->frame_tag == TXAGG_FRAMETAG\n"); } @@ -424,7 +424,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag /* (2) Enable HW SEQ control for beacon packet, because we use Hw beacon. */ /* (3) Use HW Qos SEQ to control the seq num of Ext port non-Qos packets. */ /* 2010.06.23. Added by tynli. */ - if(!pattrib->qos_en) + if (!pattrib->qos_en) { ptxdesc->txdw3 |= cpu_to_le32(EN_HWSEQ); /* Hw set sequence number */ ptxdesc->txdw4 |= cpu_to_le32(HW_SSN); /* Hw set sequence number */ @@ -478,7 +478,7 @@ static s32 rtw_dump_xframe(struct adapter *padapter, struct xmit_frame *pxmitfra pull = update_txdesc(pxmitframe, mem_addr, sz, false); - if(pull) + if (pull) { mem_addr += PACKET_OFFSET_SZ; /* pull txdesc head */ @@ -525,7 +525,7 @@ static u32 xmitframe_need_length(struct xmit_frame *pxmitframe) pattrib->pktlen + ((pattrib->bswenc) ? pattrib->icv_len : 0); - if(pattrib->encrypt ==_TKIP_) + if (pattrib->encrypt ==_TKIP_) len += 8; return len; @@ -643,13 +643,13 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *padapter, struct xmit_priv *pxm /* dequeue same priority packet from station tx queue */ /* psta = pfirstframe->attrib.psta; */ psta = rtw_get_stainfo(&padapter->stapriv, pfirstframe->attrib.ra); - if(pfirstframe->attrib.psta != psta){ + if (pfirstframe->attrib.psta != psta){ DBG_871X("%s, pattrib->psta(%p) != psta(%p)\n", __func__, pfirstframe->attrib.psta, psta); } if (psta == NULL) { DBG_8192C("rtw_xmit_classifier: psta == NULL\n"); } - if(!(psta->state &_FW_LINKED)){ + if (!(psta->state &_FW_LINKED)){ DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, psta->state); } @@ -956,7 +956,7 @@ s32 rtl8188eu_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt) pxmit_skb = rtw_skb_alloc(len + TXDESC_SIZE); - if(!pxmit_skb) + if (!pxmit_skb) goto _exit; pxmitbuf = pxmit_skb->data; @@ -975,7 +975,7 @@ s32 rtl8188eu_hostap_mgnt_xmit_entry(struct adapter *padapter, _pkt *pkt) ptxdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE+OFFSET_SZ)<txdw0 |= cpu_to_le32(OWN | FSG | LSG); - if(bmcst) + if (bmcst) { ptxdesc->txdw0 |= cpu_to_le32(BIT(24)); } diff --git a/hal/usb_halinit.c b/hal/usb_halinit.c index ab10018..c60c247 100644 --- a/hal/usb_halinit.c +++ b/hal/usb_halinit.c @@ -83,14 +83,14 @@ static bool HalUsbSetQueuePipeMapping8188EUsb( _ConfigNormalChipOutEP_8188E(pAdapter, NumOutPipe); /* Normal chip with one IN and one OUT doesn't have interrupt IN EP. */ - if(1 == pHalData->OutEpNumber){ - if(1 != NumInPipe){ + if (1 == pHalData->OutEpNumber){ + if (1 != NumInPipe){ return result; } } /* All config other than above support one Bulk IN and one Interrupt IN. */ - /* if(2 != NumInPipe){ */ + /* if (2 != NumInPipe){ */ /* return result; */ /* */ @@ -137,10 +137,10 @@ static u32 InitPowerOn_rtl8188eu(struct adapter *padapter) /* HW Power on sequence */ rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); - if(bMacPwrCtrlOn == true) + if (bMacPwrCtrlOn == true) return _SUCCESS; - if(!HalPwrSeqCmdParsing(padapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, Rtl8188E_NIC_PWR_ON_FLOW)) + if (!HalPwrSeqCmdParsing(padapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, Rtl8188E_NIC_PWR_ON_FLOW)) { DBG_871X(KERN_ERR "%s: run power on flow fail\n", __func__); return _FAIL; @@ -193,7 +193,7 @@ static void _InitPABias(struct adapter *padapter) /* RT_TRACE(COMP_INIT, DBG_LOUD, ("_InitPABias 0x1FA 0x%x\n",pa_setting)); */ - if(!(pa_setting & BIT0)) + if (!(pa_setting & BIT0)) { PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0x0F406); PHY_SetRFReg(padapter, RF_PATH_A, 0x15, 0x0FFFFF, 0x4F406); @@ -202,7 +202,7 @@ static void _InitPABias(struct adapter *padapter) /* RT_TRACE(COMP_INIT, DBG_LOUD, ("PA BIAS path A\n")); */ } - if(!(pa_setting & BIT1) && is92C) + if (!(pa_setting & BIT1) && is92C) { PHY_SetRFReg(padapter,RF_PATH_B, 0x15, 0x0FFFFF, 0x0F406); PHY_SetRFReg(padapter,RF_PATH_B, 0x15, 0x0FFFFF, 0x4F406); @@ -211,7 +211,7 @@ static void _InitPABias(struct adapter *padapter) /* RT_TRACE(COMP_INIT, DBG_LOUD, ("PA BIAS path B\n")); */ } - if(!(pa_setting & BIT4)) + if (!(pa_setting & BIT4)) { pa_setting = rtw_read8(padapter, 0x16); pa_setting &= 0x0F; @@ -226,13 +226,13 @@ static void _InitBTCoexist(struct adapter *padapter) struct btcoexist_priv *pbtpriv = &(pHalData->bt_coexist); u8 u1Tmp; - if(pbtpriv->BT_Coexist && pbtpriv->BT_CoexistType == BT_CSR_BC4) + if (pbtpriv->BT_Coexist && pbtpriv->BT_CoexistType == BT_CSR_BC4) { /* if MP_DRIVER != 1 */ if (padapter->registrypriv.mp_mode == 0) { - if(pbtpriv->BT_Ant_isolation) + if (pbtpriv->BT_Ant_isolation) { rtw_write8( padapter,REG_GPIO_MUXCFG, 0xa0); DBG_8192C("BT write 0x%x = 0x%x\n", REG_GPIO_MUXCFG, 0xa0); @@ -329,7 +329,7 @@ _InitInterrupt( usb_opt = rtw_read8(Adapter, REG_USB_SPECIAL_OPTION); - if(!adapter_to_dvobj(Adapter)->ishighspeed + if (!adapter_to_dvobj(Adapter)->ishighspeed #ifdef CONFIG_USB_INTERRUPT_IN_PIPE || pHalData->RtIntInPipe == 0x05 #endif @@ -357,7 +357,7 @@ _InitQueueReservedPage( u8 value8; bool bWiFiConfig = pregistrypriv->wifi_spec; - if((bWiFiConfig)|| (pregistrypriv->qos_opt_enable)) + if ((bWiFiConfig)|| (pregistrypriv->qos_opt_enable)) { if (pHalData->OutEpQueueSel & TX_SELE_HQ) { @@ -509,7 +509,7 @@ _InitNormalChipTwoOutEpPriority( break; } - if(!pregistrypriv->wifi_spec ){ + if (!pregistrypriv->wifi_spec ){ beQ = valueLow; bkQ = valueLow; viQ = valueHi; @@ -538,7 +538,7 @@ _InitNormalChipThreeOutEpPriority( struct registry_priv *pregistrypriv = &Adapter->registrypriv; u16 beQ,bkQ,viQ,voQ,mgtQ,hiQ; - if(!pregistrypriv->wifi_spec ){/* typical setting */ + if (!pregistrypriv->wifi_spec ){/* typical setting */ beQ = QUEUE_LOW; bkQ = QUEUE_LOW; viQ = QUEUE_NORMAL; @@ -803,10 +803,10 @@ usb_AggSettingTxUpdate( /* PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo); */ u32 value32; - if(Adapter->registrypriv.wifi_spec) + if (Adapter->registrypriv.wifi_spec) pHalData->UsbTxAggMode = false; - if(pHalData->UsbTxAggMode){ + if (pHalData->UsbTxAggMode){ value32 = rtw_read32(Adapter, REG_TDECTRL); value32 = value32 & ~(BLK_DESC_NUM_MASK << BLK_DESC_NUM_SHIFT); value32 |= ((pHalData->UsbTxAggDescNum & BLK_DESC_NUM_MASK) << BLK_DESC_NUM_SHIFT); @@ -1012,7 +1012,7 @@ _InitRFType( pHalData->rf_chip = RF_6052; - if(false == is92CU){ + if (false == is92CU){ pHalData->rf_type = RF_1T1R; DBG_8192C("Set RF Chip ID to RF_6052 and RF type to 1T1R.\n"); return; @@ -1071,14 +1071,14 @@ _InitAntenna_Selection(struct adapter *Adapter) HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); - if(pHalData->AntDivCfg==0) + if (pHalData->AntDivCfg==0) return; DBG_8192C("==> %s ....\n",__FUNCTION__); rtw_write32(Adapter, REG_LEDCFG0, rtw_read32(Adapter, REG_LEDCFG0)|BIT23); PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, BIT13, 0x01); - if(PHY_QueryBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300) == Antenna_A) + if (PHY_QueryBBReg(Adapter, rFPGA0_XA_RFInterfaceOE, 0x300) == Antenna_A) pHalData->CurAntenna = Antenna_A; else pHalData->CurAntenna = Antenna_B; @@ -1128,7 +1128,7 @@ rt_rf_power_state RfOnOffDetect(struct adapter *pAdapter ) u8 val8; rt_rf_power_state rfpowerstate = rf_off; - if(adapter_to_pwrctl(pAdapter)->bHWPowerdown) + if (adapter_to_pwrctl(pAdapter)->bHWPowerdown) { val8 = rtw_read8(pAdapter, REG_HSISR); DBG_8192C("pwrdown, 0x5c(BIT7)=%02x\n", val8); @@ -1238,11 +1238,11 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BEGIN); - if(pwrctrlpriv->bkeepfwalive) + if (pwrctrlpriv->bkeepfwalive) { _ps_open_RF(Adapter); - if(pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized){ + if (pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized){ PHY_IQCalibrate_8188E(Adapter,true); } else @@ -1260,7 +1260,7 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_PW_ON); status = InitPowerOn_rtl8188eu(Adapter); - if(status == _FAIL){ + if (status == _FAIL){ RT_TRACE(_module_hci_hal_init_c_, _drv_err_, ("Failed to init power on!\n")); goto exit; } @@ -1269,7 +1269,7 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) pHalData->CurrentChannel = 6;/* default set to 6 */ - if(pwrctrlpriv->reg_rfoff == true){ + if (pwrctrlpriv->reg_rfoff == true){ pwrctrlpriv->rf_pwrstate = rf_off; } @@ -1315,7 +1315,7 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MAC); #if (HAL_MAC_ENABLE == 1) status = PHY_MACConfig8188E(Adapter); - if(status == _FAIL) + if (status == _FAIL) { DBG_871X(" ### Failed to init MAC ......\n "); goto exit; @@ -1328,7 +1328,7 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BB); #if (HAL_BB_ENABLE == 1) status = PHY_BBConfig8188E(Adapter); - if(status == _FAIL) + if (status == _FAIL) { DBG_871X(" ### Failed to init BB ......\n "); goto exit; @@ -1339,7 +1339,7 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_RF); #if (HAL_RF_ENABLE == 1) status = PHY_RFConfig8188E(Adapter); - if(status == _FAIL) + if (status == _FAIL) { DBG_871X(" ### Failed to init RF ......\n "); goto exit; @@ -1348,7 +1348,7 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_EFUSE_PATCH); status = rtl8188e_iol_efuse_patch(Adapter); - if(status == _FAIL){ + if (status == _FAIL){ DBG_871X("%s rtl8188e_iol_efuse_patch failed\n",__FUNCTION__); goto exit; } @@ -1357,7 +1357,7 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_INIT_LLTT); status = InitLLTTable(Adapter, txpktbuf_bndy); - if(status == _FAIL){ + if (status == _FAIL){ RT_TRACE(_module_hci_hal_init_c_, _drv_err_, ("Failed to init LLT table\n")); goto exit; } @@ -1391,7 +1391,7 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) _InitHardwareDropIncorrectBulkOut(Adapter); - if(pHalData->bRDGEnable){ + if (pHalData->bRDGEnable){ _InitRDGSetting(Adapter); } @@ -1449,7 +1449,7 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) /* set 0x0 to 0xFF by tynli. Default enable HW SEQ NUM. */ rtw_write8(Adapter,REG_HWSEQ_CTRL, 0xFF); - if(pregistrypriv->wifi_spec) + if (pregistrypriv->wifi_spec) rtw_write16(Adapter,REG_FAST_EDCA_CTRL ,0); /* Nav limit , suggest by scott */ @@ -1493,9 +1493,9 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_IQK); /* 2010/08/26 MH Merge from 8192CE. */ - if(pwrctrlpriv->rf_pwrstate == rf_on) + if (pwrctrlpriv->rf_pwrstate == rf_on) { - if(pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized){ + if (pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized){ PHY_IQCalibrate_8188E(Adapter,true); } else { PHY_IQCalibrate_8188E(Adapter,false); @@ -1554,7 +1554,7 @@ static void hal_poweroff_rtl8188eu( u8 bMacPwrCtrlOn=false; rtw_hal_get_hwreg(Adapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); - if(bMacPwrCtrlOn == false) + if (bMacPwrCtrlOn == false) return ; RT_TRACE(COMP_INIT, DBG_LOUD, ("%s\n",__FUNCTION__)); @@ -1636,14 +1636,14 @@ static u32 rtl8188eu_hal_deinit(struct adapter *Adapter) rtw_write32(Adapter, REG_HIMRE_88E, IMR_DISABLED_88E); DBG_8192C("bkeepfwalive(%x)\n", pwrctl->bkeepfwalive); - if(pwrctl->bkeepfwalive) { - if((pwrctl->bHWPwrPindetect) && (pwrctl->bHWPowerdown)) + if (pwrctl->bkeepfwalive) { + if ((pwrctl->bHWPwrPindetect) && (pwrctl->bHWPowerdown)) rtl8188eu_hw_power_down(Adapter); } else { - if(Adapter->hw_init_completed == true){ + if (Adapter->hw_init_completed == true){ hal_poweroff_rtl8188eu(Adapter); - if((pwrctl->bHWPwrPindetect ) && (pwrctl->bHWPowerdown)) + if ((pwrctl->bHWPwrPindetect ) && (pwrctl->bHWPowerdown)) rtl8188eu_hw_power_down(Adapter); } @@ -1680,7 +1680,7 @@ static unsigned int rtl8188eu_inirp_init(struct adapter *Adapter) precvbuf = (struct recv_buf *)precvpriv->precv_buf; for(i=0; iff_hwaddr, 0, (unsigned char *)precvbuf) == false ) + if (_read_port(pintfhdl, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf) == false ) { RT_TRACE(_module_hci_hal_init_c_,_drv_err_,("usb_rx_init: usb_read_port error\n")); status = _FAIL; @@ -1692,14 +1692,14 @@ static unsigned int rtl8188eu_inirp_init(struct adapter *Adapter) } #ifdef CONFIG_USB_INTERRUPT_IN_PIPE - if(pHalData->RtIntInPipe != 0x05) + if (pHalData->RtIntInPipe != 0x05) { status = _FAIL; DBG_871X("%s =>Warning !! Have not USB Int-IN pipe, pHalData->RtIntInPipe(%d)!!!\n",__FUNCTION__,pHalData->RtIntInPipe); goto exit; } _read_interrupt = pintfhdl->io_ops._read_interrupt; - if(_read_interrupt(pintfhdl, RECV_INT_IN_ADDR) == false ) + if (_read_interrupt(pintfhdl, RECV_INT_IN_ADDR) == false ) { RT_TRACE(_module_hci_hal_init_c_,_drv_err_,("usb_rx_init: usb_read_interrupt error\n")); status = _FAIL; @@ -1839,7 +1839,7 @@ Hal_EfuseParsePIDVID_8188EU( HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); - if( !AutoLoadFail ) + if ( !AutoLoadFail ) { /* VID, PID */ pHalData->EEPROMVID = EF2BYTE(*(__le16 *)&hwinfo[EEPROM_VID_88EU]); @@ -1981,7 +1981,7 @@ static int _ReadAdapterInfo8188EU(struct adapter *Adapter) /* Efuse_InitSomeVar(Adapter); */ - /* if(IS_HARDWARE_TYPE_8723A(Adapter)) */ + /* if (IS_HARDWARE_TYPE_8723A(Adapter)) */ /* _EfuseCellSel(Adapter); */ _ReadRFType(Adapter);/* rf_chip -> _InitRFType() */ @@ -2041,7 +2041,7 @@ static void UpdateInterruptMask8188EU(struct adapter *padapter,u8 bHIMR0 ,u32 Ad u32 *himr; pHalData = GET_HAL_DATA(padapter); - if(bHIMR0) + if (bHIMR0) himr = &(pHalData->IntrMask[0]); else himr = &(pHalData->IntrMask[1]); @@ -2052,7 +2052,7 @@ static void UpdateInterruptMask8188EU(struct adapter *padapter,u8 bHIMR0 ,u32 Ad if (RemoveMSR) *himr &= (~RemoveMSR); - if(bHIMR0) + if (bHIMR0) rtw_write32(padapter, REG_HIMR_88E, *himr); else rtw_write32(padapter, REG_HIMRE_88E, *himr); @@ -2090,20 +2090,20 @@ static void hw_var_set_opmode(struct adapter *Adapter, u8 variable, u8* val) DBG_871X("%s()-%d mode = %d\n", __FUNCTION__, __LINE__, mode); - if((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) + if ((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) { StopTxBeacon(Adapter); rtw_write8(Adapter,REG_BCN_CTRL, 0x19);/* disable atim wnd */ } - else if((mode == _HW_STATE_ADHOC_) /*|| (mode == _HW_STATE_AP_)*/) + else if ((mode == _HW_STATE_ADHOC_) /*|| (mode == _HW_STATE_AP_)*/) { ResumeTxBeacon(Adapter); rtw_write8(Adapter,REG_BCN_CTRL, 0x1a); /* BIT3 - If set 0, hw will clr bcnq when tx becon ok/fail or port 0 */ rtw_write8(Adapter, REG_MBID_NUM, rtw_read8(Adapter, REG_MBID_NUM)|BIT(3)|BIT(4)); } - else if(mode == _HW_STATE_AP_) + else if (mode == _HW_STATE_AP_) { ResumeTxBeacon(Adapter); @@ -2178,7 +2178,7 @@ static void hw_var_set_bcn_func(struct adapter *Adapter, u8 variable, u8* val) bcn_ctrl_reg = REG_BCN_CTRL; - if(*((u8 *)val)) + if (*((u8 *)val)) rtw_write8(Adapter, bcn_ctrl_reg, (EN_BCN_FUNCTION | EN_TXBCN_RPT)); else rtw_write8(Adapter, bcn_ctrl_reg, rtw_read8(Adapter, bcn_ctrl_reg)&(~(EN_BCN_FUNCTION | EN_TXBCN_RPT))); @@ -2285,7 +2285,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; /* us */ - if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) + if (((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) { /* pHalData->RegTxPause |= STOP_BCNQ;BIT(6) */ /* rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)|BIT(6))); */ @@ -2302,7 +2302,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)|BIT(3)); - if(((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) + if (((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) { /* pHalData->RegTxPause &= (~STOP_BCNQ); */ /* rtw_write8(Adapter, REG_TXPAUSE, (rtw_read8(Adapter, REG_TXPAUSE)&(~BIT(6)))); */ @@ -2311,7 +2311,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) } break; case HW_VAR_CHECK_BSSID: - if(*((u8 *)val)) + if (*((u8 *)val)) { rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN); } @@ -2341,7 +2341,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) } break; case HW_VAR_MLME_SITESURVEY: - if(*((u8 *)val))/* under sitesurvey */ + if (*((u8 *)val))/* under sitesurvey */ { /* config RCR to receive different BSSID & not to receive data frame */ u32 v = rtw_read32(Adapter, REG_RCR); @@ -2368,7 +2368,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) /* enable update TSF */ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4))); } - else if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) + else if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { /* rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_ADF); */ rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF); @@ -2377,11 +2377,11 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4))); } - if((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) + if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_BCN); else { - if(Adapter->in_cta_test) + if (Adapter->in_cta_test) { u32 v = rtw_read32(Adapter, REG_RCR); v &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN );/* RCR_ADF */ @@ -2400,13 +2400,13 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) u8 type = *((u8 *)val); struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; - if(type == 0) /* prepare to join */ + if (type == 0) /* prepare to join */ { /* enable to rx data frame.Accept all data frame */ /* rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF); */ rtw_write16(Adapter, REG_RXFLTMAP2,0xFFFF); - if(Adapter->in_cta_test) + if (Adapter->in_cta_test) { u32 v = rtw_read32(Adapter, REG_RCR); v &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN );/* RCR_ADF */ @@ -2417,7 +2417,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) rtw_write32(Adapter, REG_RCR, rtw_read32(Adapter, REG_RCR)|RCR_CBSSID_DATA|RCR_CBSSID_BCN); } - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { RetryLimit = (pHalData->CustomerID == RT_CID_CCX) ? 7 : 48; } @@ -2426,16 +2426,16 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) RetryLimit = 0x7; } } - else if(type == 1) /* joinbss_event call back when join res < 0 */ + else if (type == 1) /* joinbss_event call back when join res < 0 */ { rtw_write16(Adapter, REG_RXFLTMAP2,0x00); } - else if(type == 2) /* sta add event call back */ + else if (type == 2) /* sta add event call back */ { /* enable update TSF */ rtw_write8(Adapter, REG_BCN_CTRL, rtw_read8(Adapter, REG_BCN_CTRL)&(~BIT(4))); - if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) { RetryLimit = 0x7; } @@ -2463,9 +2463,9 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) rtw_write8(Adapter, REG_SLOT, val[0]); - if(pmlmeinfo->WMM_enable == 0) + if (pmlmeinfo->WMM_enable == 0) { - if( pmlmeext->cur_wireless_mode == WIRELESS_11B) + if ( pmlmeext->cur_wireless_mode == WIRELESS_11B) aSifsTime = 10; else aSifsTime = 16; @@ -2496,7 +2496,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) /* Joseph marked out for Netgear 3500 TKIP channel 7 issue.(Temporarily) */ regTmp = (pHalData->nCur40MhzPrimeSC)<<5; /* regTmp = 0; */ - if(bShortPreamble) + if (bShortPreamble) regTmp |= 0x80; rtw_write8(Adapter, REG_RRSR+2, regTmp); @@ -2510,7 +2510,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) /* DBG_871X("HW_VAR_DM_FLAG ==> SupportAbility:0x%08x\n",podmpriv->SupportAbility ); */ break; case HW_VAR_DM_FUNC_OP: - if(val[0]) + if (val[0]) {/* save dm flag */ podmpriv->BK_SupportAbility = podmpriv->SupportAbility; } @@ -2524,7 +2524,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) /* ); */ break; case HW_VAR_DM_FUNC_SET: - if(*((u32 *)val) == DYNAMIC_ALL_FUNC_ENABLE){ + if (*((u32 *)val) == DYNAMIC_ALL_FUNC_ENABLE){ pdmpriv->DMFlag = pdmpriv->InitDMFlag; podmpriv->SupportAbility = pdmpriv->InitODMFlag; } @@ -2548,7 +2548,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) for(i=0;i 1) + if (acm_ctrl > 1) AcmCtrl = AcmCtrl | 0x1; - if(acm_ctrl & BIT(3)) + if (acm_ctrl & BIT(3)) AcmCtrl |= AcmHw_VoqEn; else AcmCtrl &= (~AcmHw_VoqEn); - if(acm_ctrl & BIT(2)) + if (acm_ctrl & BIT(2)) AcmCtrl |= AcmHw_ViqEn; else AcmCtrl &= (~AcmHw_ViqEn); - if(acm_ctrl & BIT(1)) + if (acm_ctrl & BIT(1)) AcmCtrl |= AcmHw_BeqEn; else AcmCtrl &= (~AcmHw_BeqEn); @@ -2627,7 +2627,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) u8 SecMinSpace; MinSpacingToSet = *((u8 *)val); - if(MinSpacingToSet <= 7) + if (MinSpacingToSet <= 7) { switch(Adapter->securitypriv.dot11PrivacyAlgrthm) { @@ -2647,7 +2647,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) break; } - if(MinSpacingToSet < SecMinSpace){ + if (MinSpacingToSet < SecMinSpace){ MinSpacingToSet = SecMinSpace; } @@ -2665,7 +2665,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) u8 index = 0; #ifdef CONFIG_BT_COEXIST - if( (pHalData->bt_coexist.BT_Coexist) && + if ( (pHalData->bt_coexist.BT_Coexist) && (pHalData->bt_coexist.BT_CoexistType == BT_CSR_BC4) ) pRegToSet = RegToSet_BT; /* 0x97427431; */ else @@ -2673,18 +2673,18 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) pRegToSet = RegToSet_Normal; /* 0xb972a841; */ FactorToSet = *((u8 *)val); - if(FactorToSet <= 3) + if (FactorToSet <= 3) { FactorToSet = (1<<(FactorToSet + 2)); - if(FactorToSet>0xf) + if (FactorToSet>0xf) FactorToSet = 0xf; for(index=0; index<4; index++) { - if((pRegToSet[index] & 0xf0) > (FactorToSet<<4)) + if ((pRegToSet[index] & 0xf0) > (FactorToSet<<4)) pRegToSet[index] = (pRegToSet[index] & 0x0f) | (FactorToSet<<4); - if((pRegToSet[index] & 0x0f) > FactorToSet) + if ((pRegToSet[index] & 0x0f) > FactorToSet) pRegToSet[index] = (pRegToSet[index] & 0xf0) | (FactorToSet); rtw_write8(Adapter, (REG_AGGLEN_LMT+index), pRegToSet[index]); @@ -2697,7 +2697,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) case HW_VAR_RXDMA_AGG_PG_TH: { u8 threshold = *((u8 *)val); - if( threshold == 0) + if ( threshold == 0) { threshold = pHalData->UsbRxAggPageCount; } @@ -2712,7 +2712,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) /* Forece leave RF low power mode for 1T1R to prevent conficting setting in Fw power */ /* saving sequence. 2010.06.07. Added by tynli. Suggested by SD3 yschang. */ - if( (psmode != PS_MODE_ACTIVE) && (!IS_92C_SERIAL(pHalData->VersionID))) + if ( (psmode != PS_MODE_ACTIVE) && (!IS_92C_SERIAL(pHalData->VersionID))) { ODM_RF_Saving(podmpriv, true); } @@ -2738,7 +2738,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) DIG_T *pDigTable = &podmpriv->DM_DigTable; u32 rx_gain = ((u32 *)(val))[0]; - if(rx_gain == 0xff){/* restore rx gain */ + if (rx_gain == 0xff){/* restore rx gain */ ODM_Write_DIG(podmpriv,pDigTable->BackupIGValue); } else{ @@ -2778,7 +2778,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) u8 Ant ; /* switch antenna to Optimum_antenna */ /* DBG_8192C("==> HW_VAR_ANTENNA_DIVERSITY_SELECT , Ant_(%s)\n",(Optimum_antenna==2)?"A":"B"); */ - if(pHalData->CurAntenna != Optimum_antenna) + if (pHalData->CurAntenna != Optimum_antenna) { Ant = (Optimum_antenna==2)?MAIN_ANT:AUX_ANT; ODM_UpdateRxIdleAnt_88E(&pHalData->odmpriv, Ant); @@ -2802,15 +2802,15 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) /* keep sn */ Adapter->xmitpriv.nqos_ssn = rtw_read16(Adapter,REG_NQOS_SEQ); - if(pwrpriv->bkeepfwalive != true) + if (pwrpriv->bkeepfwalive != true) { /* RX DMA stop */ rtw_write32(Adapter,REG_RXPKT_NUM,(rtw_read32(Adapter,REG_RXPKT_NUM)|RW_RELEASE_EN)); do{ - if(!(rtw_read32(Adapter,REG_RXPKT_NUM)&RXDMA_IDLE)) + if (!(rtw_read32(Adapter,REG_RXPKT_NUM)&RXDMA_IDLE)) break; }while(trycnt--); - if(trycnt ==0) + if (trycnt ==0) DBG_8192C("Stop RX DMA failed......\n"); /* RQPN Load 0 */ @@ -2879,7 +2879,7 @@ static void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) case HW_VAR_FWLPS_RF_ON: { /* When we halt NIC, we should check if FW LPS is leave. */ - if(adapter_to_pwrctl(Adapter)->rf_pwrstate == rf_off) + if (adapter_to_pwrctl(Adapter)->rf_pwrstate == rf_off) { /* If it is in HW/SW Radio OFF or IPS state, we do not check Fw LPS Leave, */ /* because Fw is unload. */ @@ -2890,7 +2890,7 @@ static void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) u32 valRCR; valRCR = rtw_read32(Adapter, REG_RCR); valRCR &= 0x00070000; - if(valRCR) + if (valRCR) val[0] = false; else val[0] = true; @@ -2951,7 +2951,7 @@ static u8 GetHalDefVar8188EUsb( struct sta_priv * pstapriv = &Adapter->stapriv; struct sta_info * psta; psta = rtw_get_stainfo(pstapriv, pmlmepriv->cur_network.network.MacAddress); - if(psta) + if (psta) { *((int *)pValue) = psta->rssi_stat.UndecoratedSmoothedPWDB; } @@ -2990,7 +2990,7 @@ static u8 GetHalDefVar8188EUsb( case HAL_DEF_PT_PWR_STATUS: -#if(POWER_TRAINING_ACTIVE==1) +#if (POWER_TRAINING_ACTIVE==1) { u8 MacID = *((u8*)pValue); *((u8*)pValue) = ODM_RA_GetHwPwrStatus_8188E(podmpriv, MacID); @@ -3009,14 +3009,14 @@ static u8 GetHalDefVar8188EUsb( u8 i; u8 bLinked = false; - /* if(check_fwstate(&Adapter->mlmepriv, _FW_LINKED)== true) */ + /* if (check_fwstate(&Adapter->mlmepriv, _FW_LINKED)== true) */ - if(rtw_linked_check(Adapter)) + if (rtw_linked_check(Adapter)) bLinked = true; - if(bLinked){ + if (bLinked){ DBG_871X("============ RA status check ===================\n"); - if(Adapter->bRxRSSIDisplay >30) + if (Adapter->bRxRSSIDisplay >30) Adapter->bRxRSSIDisplay = 1; for(i=0;i< Adapter->bRxRSSIDisplay;i++){ DBG_8192C("Mac_id:%d ,RSSI:%d,RateID = %d,RAUseRate = 0x%08x,RateSGI = %d, DecisionRate = 0x%02x ,PTStage = %d, RetryOver drop:%d, LifeTimeOver drop:%d\n", @@ -3074,25 +3074,25 @@ static u8 SetHalDefVar8188EUsb( { u8 dm_func = *(( u8*)pValue); - if(dm_func == 0){ /* disable all dynamic func */ + if (dm_func == 0){ /* disable all dynamic func */ podmpriv->SupportAbility = DYNAMIC_FUNC_DISABLE; DBG_8192C("==> Disable all dynamic function...\n"); } - else if(dm_func == 1){/* disable DIG */ + else if (dm_func == 1){/* disable DIG */ podmpriv->SupportAbility &= (~DYNAMIC_BB_DIG); DBG_8192C("==> Disable DIG...\n"); } - else if(dm_func == 2){/* disable High power */ + else if (dm_func == 2){/* disable High power */ podmpriv->SupportAbility &= (~DYNAMIC_BB_DYNAMIC_TXPWR); } - else if(dm_func == 3){/* disable tx power tracking */ + else if (dm_func == 3){/* disable tx power tracking */ podmpriv->SupportAbility &= (~DYNAMIC_RF_CALIBRATION); DBG_8192C("==> Disable tx power tracking...\n"); - } else if(dm_func == 5){/* disable antenna diversity */ + } else if (dm_func == 5){/* disable antenna diversity */ podmpriv->SupportAbility &= (~DYNAMIC_BB_ANT_DIV); } - else if(dm_func == 6){/* turn on all dynamic func */ - if(!(podmpriv->SupportAbility & DYNAMIC_BB_DIG)) + else if (dm_func == 6){/* turn on all dynamic func */ + if (!(podmpriv->SupportAbility & DYNAMIC_BB_DIG)) { DIG_T *pDigTable = &podmpriv->DM_DigTable; pDigTable->CurIGValue= rtw_read8(Adapter,0xc50); @@ -3154,7 +3154,7 @@ static void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rss } psta = pmlmeinfo->FW_sta_info[mac_id].psta; - if(psta == NULL) + if (psta == NULL) { return; } @@ -3180,7 +3180,7 @@ static void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rss case 1:/* for broadcast/multicast */ supportRateNum = rtw_get_rateset_len(pmlmeinfo->FW_sta_info[mac_id].SupportedRates); - if(pmlmeext->cur_wireless_mode & WIRELESS_11B) + if (pmlmeext->cur_wireless_mode & WIRELESS_11B) networkType = WIRELESS_11B; else networkType = WIRELESS_11G; @@ -3210,7 +3210,7 @@ static void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rss init_rate = get_highest_rate_idx(mask)&0x3f; - if(pHalData->fw_ractrl == true) + if (pHalData->fw_ractrl == true) { u8 arg = 0; @@ -3224,7 +3224,7 @@ static void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rss DBG_871X("update raid entry, mask=0x%x, arg=0x%x\n", mask, arg); psta->ra_mask=mask; #ifdef CONFIG_INTEL_PROXIM - if(padapter->proximity.proxim_on ==true){ + if (padapter->proximity.proxim_on ==true){ arg &= ~BIT(6); } else { @@ -3244,7 +3244,7 @@ static void UpdateHalRAMask8188EUsb(struct adapter *padapter, u32 mac_id, u8 rss else { -#if(RATE_ADAPTIVE_SUPPORT == 1) +#if (RATE_ADAPTIVE_SUPPORT == 1) ODM_RA_UpdateRateInfo_8188E( &(pHalData->odmpriv), @@ -3331,7 +3331,7 @@ static void rtl8188eu_init_default_value(struct adapter * padapter) /* init default value */ pHalData->fw_ractrl = false; - if(!pwrctrlpriv->bkeepfwalive) + if (!pwrctrlpriv->bkeepfwalive) pHalData->LastHMEBoxNum = 0; /* init dm default value */ @@ -3370,7 +3370,7 @@ void rtl8188eu_set_hal_ops(struct adapter * padapter) padapter->HalData = rtw_zmalloc(sizeof(HAL_DATA_TYPE)); - if(padapter->HalData == NULL){ + if (padapter->HalData == NULL){ DBG_8192C("cant not alloc memory for HAL DATA\n"); } diff --git a/include/Hal8188EPhyCfg.h b/include/Hal8188EPhyCfg.h index c87ebc0..155fd05 100644 --- a/include/Hal8188EPhyCfg.h +++ b/include/Hal8188EPhyCfg.h @@ -330,7 +330,7 @@ storePwrIndexDiffRateOffset( #define SIC_MAX_POLL_CNT 5 -#if(SIC_HW_SUPPORT == 1) +#if (SIC_HW_SUPPORT == 1) #define SIC_CMD_READY 0 #define SIC_CMD_PREWRITE 0x1 #define SIC_CMD_WRITE 0x40 @@ -353,7 +353,7 @@ storePwrIndexDiffRateOffset( #define SIC_DATA_REG 0x1EC /* 1bc~1bf */ #endif -#if(SIC_ENABLE == 1) +#if (SIC_ENABLE == 1) void SIC_Init(IN struct adapter *Adapter); #endif diff --git a/include/HalPwrSeqCmd.h b/include/HalPwrSeqCmd.h index 6685824..55f17e5 100644 --- a/include/HalPwrSeqCmd.h +++ b/include/HalPwrSeqCmd.h @@ -43,7 +43,7 @@ /* value: the value to be polled, masked by the msd field. */ /* note: driver shall implement this cmd by */ /* do{ */ - /* if( (Read(offset) & msk) == (value & msk) ) */ + /* if ( (Read(offset) & msk) == (value & msk) ) */ /* break; */ /* } while(not timeout); */ diff --git a/include/rtw_ioctl.h b/include/rtw_ioctl.h index d11112a..4092bd7 100644 --- a/include/rtw_ioctl.h +++ b/include/rtw_ioctl.h @@ -65,7 +65,7 @@ #define OID_MP_SEG4 0xFF011100 #define DEBUG_OID(dbg, str) \ - if((!dbg)) \ + if ((!dbg)) \ { \ RT_TRACE(_module_rtl871x_ioctl_c_,_drv_info_,("%s(%d): %s", __FUNCTION__, __LINE__, str)); \ } diff --git a/include/rtw_led.h b/include/rtw_led.h index 17f15ed..3c929e2 100644 --- a/include/rtw_led.h +++ b/include/rtw_led.h @@ -173,7 +173,7 @@ struct led_priv{ #define rtw_led_control(adapter, LedAction) \ do { \ - if((adapter)->ledpriv.LedControlHandler) \ + if ((adapter)->ledpriv.LedControlHandler) \ (adapter)->ledpriv.LedControlHandler((adapter), (LedAction)); \ } while(0) diff --git a/include/rtw_mlme.h b/include/rtw_mlme.h index df40e14..400b188 100644 --- a/include/rtw_mlme.h +++ b/include/rtw_mlme.h @@ -577,7 +577,7 @@ __inline static void set_fwstate(struct mlme_priv *pmlmepriv, sint state) { pmlmepriv->fw_state |= state; /* FOR HW integration */ - if(_FW_UNDER_SURVEY==state){ + if (_FW_UNDER_SURVEY==state){ pmlmepriv->bScanInProcess = true; } } @@ -586,7 +586,7 @@ __inline static void _clr_fwstate_(struct mlme_priv *pmlmepriv, sint state) { pmlmepriv->fw_state &= ~state; /* FOR HW integration */ - if(_FW_UNDER_SURVEY==state){ + if (_FW_UNDER_SURVEY==state){ pmlmepriv->bScanInProcess = false; } } diff --git a/include/rtw_p2p.h b/include/rtw_p2p.h index fbc220d..e7cf116 100644 --- a/include/rtw_p2p.h +++ b/include/rtw_p2p.h @@ -74,21 +74,21 @@ int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role); static inline void _rtw_p2p_set_state(struct wifidirect_info *wdinfo, enum P2P_STATE state) { - if(wdinfo->p2p_state != state) { + if (wdinfo->p2p_state != state) { /* wdinfo->pre_p2p_state = wdinfo->p2p_state; */ wdinfo->p2p_state = state; } } static inline void _rtw_p2p_set_pre_state(struct wifidirect_info *wdinfo, enum P2P_STATE state) { - if(wdinfo->pre_p2p_state != state) { + if (wdinfo->pre_p2p_state != state) { wdinfo->pre_p2p_state = state; } } static inline void _rtw_p2p_set_role(struct wifidirect_info *wdinfo, enum P2P_ROLE role) { - if(wdinfo->role != role) { + if (wdinfo->role != role) { wdinfo->role = role; } } diff --git a/include/rtw_recv.h b/include/rtw_recv.h index a4149b3..24b1724 100644 --- a/include/rtw_recv.h +++ b/include/rtw_recv.h @@ -352,7 +352,7 @@ void rtw_reordering_ctrl_timeout_handler(void *pcontext); __inline static u8 *get_rxmem(union recv_frame *precvframe) { /* always return rx_head... */ - if(precvframe==NULL) + if (precvframe==NULL) return NULL; return precvframe->u.hdr.rx_head; @@ -369,7 +369,7 @@ __inline static u8 *get_recvframe_data(union recv_frame *precvframe) { /* alwasy return rx_data */ - if(precvframe==NULL) + if (precvframe==NULL) return NULL; return precvframe->u.hdr.rx_data; @@ -386,12 +386,12 @@ __inline static u8 *recvframe_push(union recv_frame *precvframe, sint sz) * start. rx_data must be still larger than rx_head, after pushing. */ - if(precvframe==NULL) + if (precvframe==NULL) return NULL; precvframe->u.hdr.rx_data -= sz ; - if( precvframe->u.hdr.rx_data < precvframe->u.hdr.rx_head ) + if ( precvframe->u.hdr.rx_data < precvframe->u.hdr.rx_head ) { precvframe->u.hdr.rx_data += sz ; return NULL; @@ -411,13 +411,13 @@ __inline static u8 *recvframe_pull(union recv_frame *precvframe, sint sz) /* used for extract sz bytes from rx_data, update rx_data and return the updated rx_data to the caller */ - if(precvframe==NULL) + if (precvframe==NULL) return NULL; precvframe->u.hdr.rx_data += sz; - if(precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) + if (precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) { precvframe->u.hdr.rx_data -= sz; return NULL; @@ -437,14 +437,14 @@ __inline static u8 *recvframe_put(union recv_frame *precvframe, sint sz) /* after putting, rx_tail must be still larger than rx_end. */ unsigned char * prev_rx_tail; - if(precvframe==NULL) + if (precvframe==NULL) return NULL; prev_rx_tail = precvframe->u.hdr.rx_tail; precvframe->u.hdr.rx_tail += sz; - if(precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end) + if (precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end) { precvframe->u.hdr.rx_tail -= sz; return NULL; @@ -465,12 +465,12 @@ __inline static u8 *recvframe_pull_tail(union recv_frame *precvframe, sint sz) /* used for extract sz bytes from rx_end, update rx_end and return the updated rx_end to the caller */ /* after pulling, rx_end must be still larger than rx_data. */ - if(precvframe==NULL) + if (precvframe==NULL) return NULL; precvframe->u.hdr.rx_tail -= sz; - if(precvframe->u.hdr.rx_tail < precvframe->u.hdr.rx_data) + if (precvframe->u.hdr.rx_tail < precvframe->u.hdr.rx_data) { precvframe->u.hdr.rx_tail += sz; return NULL; @@ -488,7 +488,7 @@ __inline static unsigned char *get_rxbuf_desc(union recv_frame *precvframe) { unsigned char *buf_desc; - if(precvframe==NULL) + if (precvframe==NULL) return NULL; return buf_desc; } diff --git a/include/rtw_security.h b/include/rtw_security.h index 2009b95..3a0483f 100644 --- a/include/rtw_security.h +++ b/include/rtw_security.h @@ -209,7 +209,7 @@ do{\ encry_algo = (u8)psecuritypriv->dot11PrivacyAlgrthm;\ break;\ case dot11AuthAlgrthm_8021X:\ - if(bmcst)\ + if (bmcst)\ encry_algo = (u8)psecuritypriv->dot118021XGrpPrivacy;\ else\ encry_algo =(u8) psta->dot118021XPrivacy;\ diff --git a/include/wifi.h b/include/wifi.h index d44e451..dac7bd1 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -446,7 +446,7 @@ __inline static unsigned char * get_hdr_bssid(unsigned char *pframe) __inline static int IsFrameTypeCtrl(unsigned char *pframe) { - if(WIFI_CTRL_TYPE == GetFrameType(pframe)) + if (WIFI_CTRL_TYPE == GetFrameType(pframe)) return true; else return false; diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c index 1d34b86..a6ed974 100644 --- a/os_dep/ioctl_cfg80211.c +++ b/os_dep/ioctl_cfg80211.c @@ -170,12 +170,12 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc( struct ieee80211_supported_band *spt_band = NULL; int n_channels, n_bitrates; - if(band == IEEE80211_BAND_2GHZ) + if (band == IEEE80211_BAND_2GHZ) { n_channels = RTW_2G_CHANNELS_NUM; n_bitrates = RTW_G_RATES_NUM; } - else if(band == IEEE80211_BAND_5GHZ) + else if (band == IEEE80211_BAND_5GHZ) { n_channels = RTW_5G_CHANNELS_NUM; n_bitrates = RTW_A_RATES_NUM; @@ -190,7 +190,7 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc( + sizeof(struct ieee80211_channel)*n_channels + sizeof(struct ieee80211_rate)*n_bitrates ); - if(!spt_band) + if (!spt_band) goto exit; spt_band->channels = (struct ieee80211_channel*)(((u8*)spt_band)+sizeof(struct ieee80211_supported_band)); @@ -199,12 +199,12 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc( spt_band->n_channels = n_channels; spt_band->n_bitrates = n_bitrates; - if(band == IEEE80211_BAND_2GHZ) + if (band == IEEE80211_BAND_2GHZ) { rtw_2g_channels_init(spt_band->channels); rtw_2g_rates_init(spt_band->bitrates); } - else if(band == IEEE80211_BAND_5GHZ) + else if (band == IEEE80211_BAND_5GHZ) { rtw_5g_channels_init(spt_band->channels); rtw_5g_rates_init(spt_band->bitrates); @@ -221,16 +221,16 @@ static void rtw_spt_band_free(struct ieee80211_supported_band *spt_band) { u32 size; - if(!spt_band) + if (!spt_band) return; - if(spt_band->band == IEEE80211_BAND_2GHZ) + if (spt_band->band == IEEE80211_BAND_2GHZ) { size = sizeof(struct ieee80211_supported_band) + sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM + sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM; } - else if(spt_band->band == IEEE80211_BAND_5GHZ) + else if (spt_band->band == IEEE80211_BAND_5GHZ) { size = sizeof(struct ieee80211_supported_band) + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM @@ -342,13 +342,13 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl /* DBG_8192C("%s\n", __func__); */ bssinf_len = pnetwork->network.IELength+sizeof (struct rtw_ieee80211_hdr_3addr); - if(bssinf_len > MAX_BSSINFO_LEN){ + if (bssinf_len > MAX_BSSINFO_LEN){ DBG_871X("%s IE Length too long > %d byte\n",__FUNCTION__,MAX_BSSINFO_LEN); goto exit; } /* To reduce PBC Overlap rate */ - if(wdev_to_priv(wdev)->scan_request != NULL) + if (wdev_to_priv(wdev)->scan_request != NULL) { u8 *psr=NULL, sr = 0; struct ndis_802_11_ssid *pssid = &pnetwork->network.Ssid; @@ -359,25 +359,25 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl wpsie = rtw_get_wps_ie(pnetwork->network.IEs+_FIXED_IE_LENGTH_, pnetwork->network.IELength-_FIXED_IE_LENGTH_, NULL, &wpsielen); - if(wpsie && wpsielen>0) + if (wpsie && wpsielen>0) psr = rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL); if (sr != 0) { - if(request->n_ssids == 1 && request->n_channels == 1) /* it means under processing WPS */ + if (request->n_ssids == 1 && request->n_channels == 1) /* it means under processing WPS */ { DBG_8192C("ssid=%s, len=%d\n", pssid->Ssid, pssid->SsidLength); if (ssids[0].ssid_len == 0) { } - else if(pssid->SsidLength == ssids[0].ssid_len && + else if (pssid->SsidLength == ssids[0].ssid_len && _rtw_memcmp(pssid->Ssid, ssids[0].ssid, ssids[0].ssid_len)) { DBG_871X("%s, got sr and ssid match!\n", __func__); } else { - if(psr !=NULL) + if (psr !=NULL) *psr = 0; /* clear sr */ } @@ -437,7 +437,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl len += pnetwork->network.IELength; /* ifdef CONFIG_P2P */ - /* if(rtw_get_p2p_ie(pnetwork->network.IEs+12, pnetwork->network.IELength-12, NULL, NULL)) */ + /* if (rtw_get_p2p_ie(pnetwork->network.IEs+12, pnetwork->network.IELength-12, NULL, NULL)) */ /* */ /* DBG_8192C("%s, got p2p_ie\n", __func__); */ /* */ @@ -456,7 +456,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl /* patch for cfg80211, update beacon ies to information_elements */ if (pnetwork->network.Reserved[0] == 1) { /* WIFI_BEACON */ - if(bss->len_information_elements != bss->len_beacon_ies) + if (bss->len_information_elements != bss->len_beacon_ies) { bss->information_elements = bss->beacon_ies; bss->len_information_elements = bss->len_beacon_ies; @@ -467,15 +467,15 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl /* { - if( bss->information_elements == bss->proberesp_ies) + if ( bss->information_elements == bss->proberesp_ies) { - if( bss->len_information_elements != bss->len_proberesp_ies) + if ( bss->len_information_elements != bss->len_proberesp_ies) { DBG_8192C("error!, len_information_elements != bss->len_proberesp_ies\n"); } } - else if(bss->len_information_elements < bss->len_beacon_ies) + else if (bss->len_information_elements < bss->len_beacon_ies) { bss->information_elements = bss->beacon_ies; bss->len_information_elements = bss->len_beacon_ies; @@ -545,11 +545,11 @@ void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter) struct wlan_bssid_ex *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network); struct wlan_network *scanned = pmlmepriv->cur_network_scanned; - if(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==true) + if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==true) { memcpy(&cur_network->network, pnetwork, sizeof(struct wlan_bssid_ex)); - if(cur_network) { + if (cur_network) { if (!rtw_cfg80211_inform_bss(padapter,cur_network)) DBG_871X(FUNC_ADPT_FMT" inform fail !!\n", FUNC_ADPT_ARG(padapter)); else @@ -613,13 +613,13 @@ void rtw_cfg80211_indicate_connect(struct adapter *padapter) return; } - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) return; #ifdef CONFIG_P2P - if(pwdinfo->driver_interface == DRIVER_CFG80211 ) + if (pwdinfo->driver_interface == DRIVER_CFG80211 ) { - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); rtw_p2p_set_role(pwdinfo, P2P_ROLE_CLIENT); @@ -635,7 +635,7 @@ void rtw_cfg80211_indicate_connect(struct adapter *padapter) /* DBG_871X(FUNC_ADPT_FMT" BSS not found\n", FUNC_ADPT_ARG(padapter)); */ - if(scanned == NULL) { + if (scanned == NULL) { rtw_warn_on(1); goto check_bss; } @@ -715,13 +715,13 @@ void rtw_cfg80211_indicate_disconnect(struct adapter *padapter) return; } - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) return; #ifdef CONFIG_P2P - if( pwdinfo->driver_interface == DRIVER_CFG80211 ) + if ( pwdinfo->driver_interface == DRIVER_CFG80211 ) { - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE); @@ -733,10 +733,10 @@ void rtw_cfg80211_indicate_disconnect(struct adapter *padapter) if (!padapter->mlmepriv.not_indic_disco) { #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) - if(pwdev->sme_state==CFG80211_SME_CONNECTING) + if (pwdev->sme_state==CFG80211_SME_CONNECTING) cfg80211_connect_result(padapter->pnetdev, NULL, NULL, 0, NULL, 0, WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_ATOMIC/*GFP_KERNEL*/); - else if(pwdev->sme_state==CFG80211_SME_CONNECTED) + else if (pwdev->sme_state==CFG80211_SME_CONNECTED) cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC); #else /* TODO */ @@ -760,7 +760,7 @@ static u8 set_pairwise_key(struct adapter *padapter, struct sta_info *psta) } psetstakey_para = (struct set_stakey_parm*)rtw_zmalloc(sizeof(struct set_stakey_parm)); - if(psetstakey_para==NULL){ + if (psetstakey_para==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); res=_FAIL; goto exit; @@ -795,12 +795,12 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) DBG_8192C("%s\n", __FUNCTION__); pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmd==NULL){ + if (pcmd==NULL){ res= _FAIL; goto exit; } psetkeyparm=(struct setkey_parm*)rtw_zmalloc(sizeof(struct setkey_parm)); - if(psetkeyparm==NULL){ + if (psetkeyparm==NULL){ rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -906,7 +906,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa else { psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if(!psta) + if (!psta) { /* ret = -EINVAL; */ DBG_8192C("rtw_set_encryption(), sta has already been removed or never been added\n"); @@ -933,7 +933,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa DBG_8192C("r871x_set_encryption, wep_key_idx=%d, len=%d\n", wep_key_idx, wep_key_len); - if((wep_key_idx >= WEP_KEYS) || (wep_key_len<=0)) + if ((wep_key_idx >= WEP_KEYS) || (wep_key_len<=0)) { ret = -EINVAL; goto exit; @@ -952,7 +952,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa psecuritypriv->dot11PrivacyAlgrthm=_WEP40_; psecuritypriv->dot118021XGrpPrivacy=_WEP40_; - if(wep_key_len == 13) + if (wep_key_len == 13) { psecuritypriv->dot11PrivacyAlgrthm=_WEP104_; psecuritypriv->dot118021XGrpPrivacy=_WEP104_; @@ -972,24 +972,24 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa } - if(!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) /* group key */ + if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) /* group key */ { - if(param->u.crypt.set_tx == 0) /* group key */ + if (param->u.crypt.set_tx == 0) /* group key */ { - if(strcmp(param->u.crypt.alg, "WEP") == 0) + if (strcmp(param->u.crypt.alg, "WEP") == 0) { DBG_8192C("%s, set group_key, WEP\n", __FUNCTION__); memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if(param->u.crypt.key_len==13) + if (param->u.crypt.key_len==13) { psecuritypriv->dot118021XGrpPrivacy = _WEP104_; } } - else if(strcmp(param->u.crypt.alg, "TKIP") == 0) + else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { DBG_8192C("%s, set group_key, TKIP\n", __FUNCTION__); @@ -1005,7 +1005,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa psecuritypriv->busetkipkey = true; } - else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { DBG_8192C("%s, set group_key, CCMP\n", __FUNCTION__); @@ -1029,7 +1029,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); pbcmc_sta=rtw_get_bcmc_stainfo(padapter); - if(pbcmc_sta) + if (pbcmc_sta) { pbcmc_sta->ieee8021x_blocked = false; pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ @@ -1041,25 +1041,25 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa } - if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) /* psk/802_1x */ + if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) /* psk/802_1x */ { - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - if(param->u.crypt.set_tx ==1) /* pairwise key */ + if (param->u.crypt.set_tx ==1) /* pairwise key */ { memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - if(strcmp(param->u.crypt.alg, "WEP") == 0) + if (strcmp(param->u.crypt.alg, "WEP") == 0) { DBG_8192C("%s, set pairwise key, WEP\n", __FUNCTION__); psta->dot118021XPrivacy = _WEP40_; - if(param->u.crypt.key_len==13) + if (param->u.crypt.key_len==13) { psta->dot118021XPrivacy = _WEP104_; } } - else if(strcmp(param->u.crypt.alg, "TKIP") == 0) + else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { DBG_8192C("%s, set pairwise key, TKIP\n", __FUNCTION__); @@ -1073,7 +1073,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa psecuritypriv->busetkipkey = true; } - else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { DBG_8192C("%s, set pairwise key, CCMP\n", __FUNCTION__); @@ -1096,17 +1096,17 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa } else/* group key??? */ { - if(strcmp(param->u.crypt.alg, "WEP") == 0) + if (strcmp(param->u.crypt.alg, "WEP") == 0) { memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if(param->u.crypt.key_len==13) + if (param->u.crypt.key_len==13) { psecuritypriv->dot118021XGrpPrivacy = _WEP104_; } } - else if(strcmp(param->u.crypt.alg, "TKIP") == 0) + else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { psecuritypriv->dot118021XGrpPrivacy = _TKIP_; @@ -1120,7 +1120,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa psecuritypriv->busetkipkey = true; } - else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { psecuritypriv->dot118021XGrpPrivacy = _AES_; @@ -1140,7 +1140,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); pbcmc_sta=rtw_get_bcmc_stainfo(padapter); - if(pbcmc_sta) + if (pbcmc_sta) { pbcmc_sta->ieee8021x_blocked = false; pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ @@ -1225,7 +1225,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param psecuritypriv->dot11PrivacyAlgrthm = _WEP40_; psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if(wep_key_len==13) { + if (wep_key_len==13) { psecuritypriv->dot11PrivacyAlgrthm = _WEP104_; psecuritypriv->dot118021XGrpPrivacy = _WEP104_; } @@ -1242,7 +1242,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param goto exit; } - if(padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) /* 802_1x */ + if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) /* 802_1x */ { struct sta_info * psta,*pbcmc_sta; struct sta_priv * pstapriv = &padapter->stapriv; @@ -1263,20 +1263,20 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param psta->ieee8021x_blocked = false; - if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| + if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; } - if(param->u.crypt.set_tx ==1)/* pairwise key */ + if (param->u.crypt.set_tx ==1)/* pairwise key */ { DBG_8192C("%s, : param->u.crypt.set_tx ==1\n", __func__); memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - if(strcmp(param->u.crypt.alg, "TKIP") == 0)/* set mic key */ + if (strcmp(param->u.crypt.alg, "TKIP") == 0)/* set mic key */ { /* DEBUG_ERR(("\nset key length :param->u.crypt.key_len=%d\n", param->u.crypt.key_len)); */ memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8); @@ -1293,7 +1293,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param } else/* group key */ { - if(strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) + if (strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) { memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key,(param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[16]),8); @@ -1306,7 +1306,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1,true); } #ifdef CONFIG_IEEE80211W - else if(strcmp(param->u.crypt.alg, "BIP") == 0) + else if (strcmp(param->u.crypt.alg, "BIP") == 0) { int no; /* DBG_871X("BIP key_len=%d , index=%d @@@@@@@@@@@@@@@@@@\n", param->u.crypt.key_len, param->u.crypt.idx); */ @@ -1323,9 +1323,9 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param #endif /* CONFIG_IEEE80211W */ #ifdef CONFIG_P2P - if(pwdinfo->driver_interface == DRIVER_CFG80211 ) + if (pwdinfo->driver_interface == DRIVER_CFG80211 ) { - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) { rtw_p2p_set_state(pwdinfo, P2P_STATE_PROVISIONING_DONE); } @@ -1336,7 +1336,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param } pbcmc_sta=rtw_get_bcmc_stainfo(padapter); - if(pbcmc_sta==NULL) + if (pbcmc_sta==NULL) { /* DEBUG_ERR( ("Set OID_802_11_ADD_KEY: bcmc stainfo is null\n")); */ } @@ -1346,14 +1346,14 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param if (strcmp(param->u.crypt.alg, "none") != 0) pbcmc_sta->ieee8021x_blocked = false; - if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| + if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; } } } - else if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) /* adhoc mode */ + else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) /* adhoc mode */ { } } @@ -1445,20 +1445,20 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, memcpy(param->u.crypt.seq, (void *)params->seq, params->seq_len); } - if(params->key_len && params->key) + if (params->key_len && params->key) { param->u.crypt.key_len = params->key_len; memcpy(param->u.crypt.key, (void *)params->key, params->key_len); } - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { ret = rtw_cfg80211_set_encryption(ndev, param, param_len); } - else if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { #ifdef CONFIG_AP_MODE - if(mac_addr) + if (mac_addr) memcpy(param->sta_addr, (void*)mac_addr, ETH_ALEN); ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len); @@ -1471,7 +1471,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, } addkey_end: - if(param) + if (param) { rtw_mfree((u8*)param, param_len); } @@ -1589,7 +1589,7 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy, #endif /* for infra./P2PClient mode */ - if( check_fwstate(pmlmepriv, WIFI_STATION_STATE) + if ( check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) ) { @@ -1652,7 +1652,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - if(adapter_to_dvobj(padapter)->processing_dev_remove == true) + if (adapter_to_dvobj(padapter)->processing_dev_remove == true) { ret= -EPERM; goto exit; @@ -1660,12 +1660,12 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, DBG_871X(FUNC_NDEV_FMT" call netdev_open\n", FUNC_NDEV_ARG(ndev)); - if(netdev_open(ndev) != 0) { + if (netdev_open(ndev) != 0) { ret= -EPERM; goto exit; } - if(_FAIL == rtw_pwr_wakeup(padapter)) { + if (_FAIL == rtw_pwr_wakeup(padapter)) { ret= -EPERM; goto exit; } @@ -1674,7 +1674,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, DBG_871X(FUNC_NDEV_FMT" old_iftype=%d, new_iftype=%d\n", FUNC_NDEV_ARG(ndev), old_type, type); - if(old_type != type) + if (old_type != type) { change = true; pmlmeext->action_public_rxseq = 0xffff; @@ -1691,9 +1691,9 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, case NL80211_IFTYPE_STATION: networkType = Ndis802_11Infrastructure; #ifdef CONFIG_P2P - if(pwdinfo->driver_interface == DRIVER_CFG80211 ) + if (pwdinfo->driver_interface == DRIVER_CFG80211 ) { - if(change && rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + if (change && rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { /* it means remove GO and change mode from AP(GO) to station(P2P DEVICE) */ rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE); @@ -1710,9 +1710,9 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy, case NL80211_IFTYPE_AP: networkType = Ndis802_11APMode; #ifdef CONFIG_P2P - if(pwdinfo->driver_interface == DRIVER_CFG80211 ) + if (pwdinfo->driver_interface == DRIVER_CFG80211 ) { - if(change && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (change && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { /* it means P2P Group created, we will be GO and change mode from P2P DEVICE to AP(GO) */ rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO); @@ -1745,7 +1745,7 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv, bool abor unsigned long irqL; spin_lock_bh(&pwdev_priv->scan_req_lock); - if(pwdev_priv->scan_request != NULL) + if (pwdev_priv->scan_request != NULL) { /* struct cfg80211_scan_request *scan_request = pwdev_priv->scan_request; */ @@ -1754,8 +1754,8 @@ void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv, bool abor #endif /* avoid WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); */ - /* if(scan_request == wiphy_to_dev(scan_request->wiphy)->scan_req) */ - if(pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy) + /* if (scan_request == wiphy_to_dev(scan_request->wiphy)->scan_req) */ + if (pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy) { DBG_8192C("error wiphy compare\n"); } @@ -1806,7 +1806,7 @@ void rtw_cfg80211_surveydone_event_callback(struct adapter *padapter) pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); /* report network only if the current channel set contains the channel to which this network belongs */ - if(rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, pnetwork->network.Configuration.DSConfig) >= 0 + if (rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, pnetwork->network.Configuration.DSConfig) >= 0 && true == rtw_validate_ssid(&(pnetwork->network.Ssid)) ) { @@ -1839,15 +1839,15 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *b DBG_8192C("%s, ielen=%d\n", __func__, len); #endif - if(len>0) + if (len>0) { - if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) + if ((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) { #ifdef CONFIG_DEBUG_CFG80211 DBG_8192C("probe_req_wps_ielen=%d\n", wps_ielen); #endif - if(pmlmepriv->wps_probe_req_ie) + if (pmlmepriv->wps_probe_req_ie) { u32 free_len = pmlmepriv->wps_probe_req_ie_len; pmlmepriv->wps_probe_req_ie_len = 0; @@ -1869,7 +1869,7 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *b /* len -= wps_ielen; */ #ifdef CONFIG_P2P - if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) + if ((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) { struct wifidirect_info *wdinfo = &padapter->wdinfo; u32 attr_contentlen = 0; @@ -1879,7 +1879,7 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *b DBG_8192C("probe_req_p2p_ielen=%d\n", p2p_ielen); #endif - if(pmlmepriv->p2p_probe_req_ie) + if (pmlmepriv->p2p_probe_req_ie) { u32 free_len = pmlmepriv->p2p_probe_req_ie_len; pmlmepriv->p2p_probe_req_ie_len = 0; @@ -1896,7 +1896,7 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *b memcpy(pmlmepriv->p2p_probe_req_ie, p2p_ie, p2p_ielen); pmlmepriv->p2p_probe_req_ie_len = p2p_ielen; - if(rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_LISTEN_CH, (u8*)listen_ch_attr, (uint*) &attr_contentlen) + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_LISTEN_CH, (u8*)listen_ch_attr, (uint*) &attr_contentlen) && attr_contentlen == 5) { if (wdinfo->listen_channel != listen_ch_attr[4]) { @@ -1913,13 +1913,13 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *b /* len -= p2p_ielen; */ #ifdef CONFIG_P2P - if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) + if (rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) { #ifdef CONFIG_DEBUG_CFG80211 DBG_8192C("probe_req_wfd_ielen=%d\n", wfd_ielen); #endif - if(pmlmepriv->wfd_probe_req_ie) + if (pmlmepriv->wfd_probe_req_ie) { u32 free_len = pmlmepriv->wfd_probe_req_ie_len; pmlmepriv->wfd_probe_req_ie_len = 0; @@ -1987,7 +1987,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy { DBG_8192C("%s, fwstate=0x%x\n", __func__, pmlmepriv->fw_state); - if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) + if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { DBG_8192C("AP mode process WPS\n"); } @@ -1997,17 +1997,17 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy } } - if(_FAIL == rtw_pwr_wakeup(padapter)) { + if (_FAIL == rtw_pwr_wakeup(padapter)) { need_indicate_scan_done = true; goto check_need_indicate_scan_done; } #ifdef CONFIG_P2P - if( pwdinfo->driver_interface == DRIVER_CFG80211 ) + if ( pwdinfo->driver_interface == DRIVER_CFG80211 ) { if (_rtw_memcmp(ssids->ssid, "DIRECT-", 7) && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL)) { - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { rtw_p2p_enable(padapter, P2P_ROLE_DEVICE); wdev_to_priv(padapter->rtw_wdev)->p2p_enabled = true; } else { @@ -2027,7 +2027,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy } #endif /* CONFIG_P2P */ - if(request->ie && request->ie_len>0) + if (request->ie && request->ie_len>0) rtw_cfg80211_set_probe_req_wpsp2pie(padapter, (u8 *)request->ie, request->ie_len ); if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) { @@ -2053,13 +2053,13 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy } #ifdef CONFIG_P2P - if( pwdinfo->driver_interface == DRIVER_CFG80211 ) { + if ( pwdinfo->driver_interface == DRIVER_CFG80211 ) { if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) && !rtw_p2p_chk_state(pwdinfo, P2P_STATE_IDLE)) { rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_SEARCH); rtw_free_network_queue(padapter, true); - if(social_channel == 0) + if (social_channel == 0) rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE); else rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_SOCIAL_LAST); @@ -2103,11 +2103,11 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy spin_unlock_bh(&pmlmepriv->lock); - if(_status == false) + if (_status == false) ret = -1; check_need_indicate_scan_done: - if(need_indicate_scan_done) + if (need_indicate_scan_done) rtw_cfg80211_surveydone_event_callback(padapter); exit: @@ -2148,7 +2148,7 @@ static int rtw_cfg80211_set_auth_type(struct security_priv *psecuritypriv, break; case NL80211_AUTHTYPE_OPEN_SYSTEM: psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; - if(psecuritypriv->ndisauthtype>Ndis802_11AuthModeWPA) + if (psecuritypriv->ndisauthtype>Ndis802_11AuthModeWPA) psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; break; case NL80211_AUTHTYPE_SHARED_KEY: @@ -2204,11 +2204,11 @@ static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 ciph return -ENOTSUPP; } - if(ucast) + if (ucast) { psecuritypriv->ndisencryptstatus = ndisencryptstatus; - /* if(psecuritypriv->dot11PrivacyAlgrthm >= _AES_) */ + /* if (psecuritypriv->dot11PrivacyAlgrthm >= _AES_) */ /* psecuritypriv->ndisauthtype = Ndis802_11AuthModeWPA2PSK; */ } @@ -2271,16 +2271,16 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel } pos = buf; - if(ielen < RSN_HEADER_LEN){ + if (ielen < RSN_HEADER_LEN){ RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("Ie len too short %d\n", ielen)); ret = -1; goto exit; } pwpa = rtw_get_wpa_ie(buf, &wpa_ielen, ielen); - if(pwpa && wpa_ielen>0) + if (pwpa && wpa_ielen>0) { - if(rtw_parse_wpa_ie(pwpa, wpa_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + if (rtw_parse_wpa_ie(pwpa, wpa_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPAPSK; @@ -2291,9 +2291,9 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel } pwpa2 = rtw_get_wpa2_ie(buf, &wpa2_ielen, ielen); - if(pwpa2 && wpa2_ielen>0) + if (pwpa2 && wpa2_ielen>0) { - if(rtw_parse_wpa2_ie(pwpa2, wpa2_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + if (rtw_parse_wpa2_ie(pwpa2, wpa2_ielen+2, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPA2PSK; @@ -2381,13 +2381,13 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel u8 *p2p_ie; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - if((p2p_ie=rtw_get_p2p_ie(buf, ielen, NULL, &p2p_ielen))) + if ((p2p_ie=rtw_get_p2p_ie(buf, ielen, NULL, &p2p_ielen))) { #ifdef CONFIG_DEBUG_CFG80211 DBG_8192C("%s p2p_assoc_req_ielen=%d\n", __FUNCTION__, p2p_ielen); #endif - if(pmlmepriv->p2p_assoc_req_ie) + if (pmlmepriv->p2p_assoc_req_ie) { u32 free_len = pmlmepriv->p2p_assoc_req_ie_len; pmlmepriv->p2p_assoc_req_ie_len = 0; @@ -2412,13 +2412,13 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel u8 *wfd_ie; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - if(rtw_get_wfd_ie(buf, ielen, NULL, &wfd_ielen)) + if (rtw_get_wfd_ie(buf, ielen, NULL, &wfd_ielen)) { #ifdef CONFIG_DEBUG_CFG80211 DBG_8192C("%s wfd_assoc_req_ielen=%d\n", __FUNCTION__, wfd_ielen); #endif - if(pmlmepriv->wfd_assoc_req_ie) + if (pmlmepriv->wfd_assoc_req_ie) { u32 free_len = pmlmepriv->wfd_assoc_req_ie_len; pmlmepriv->wfd_assoc_req_ie_len = 0; @@ -2437,7 +2437,7 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel #endif /* CONFIG_P2P */ /* TKIP and AES disallow multicast packets until installing group key */ - if(padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ + if (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ || padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ || padapter->securitypriv.dot11PrivacyAlgrthm == _AES_) /* WPS open need to enable multicast */ @@ -2465,12 +2465,12 @@ static int cfg80211_rtw_join_ibss(struct wiphy *wiphy, struct net_device *ndev, struct mlme_priv *pmlmepriv = &padapter->mlmepriv; int ret=0; - if(_FAIL == rtw_pwr_wakeup(padapter)) { + if (_FAIL == rtw_pwr_wakeup(padapter)) { ret= -EPERM; goto exit; } - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { ret = -EPERM; goto exit; } @@ -2544,19 +2544,19 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, sme->privacy, sme->key, sme->key_len, sme->key_idx); - if(wdev_to_priv(padapter->rtw_wdev)->block == true) + if (wdev_to_priv(padapter->rtw_wdev)->block == true) { ret = -EBUSY; DBG_871X("%s wdev_priv.block is set\n", __FUNCTION__); goto exit; } - if(_FAIL == rtw_pwr_wakeup(padapter)) { + if (_FAIL == rtw_pwr_wakeup(padapter)) { ret= -EPERM; goto exit; } - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { ret = -EPERM; goto exit; } @@ -2621,7 +2621,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, } /* For WEP Shared auth */ - if((psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_Shared + if ((psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_Shared || psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_Auto) && sme->key ) { @@ -2642,7 +2642,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); pwep =(struct ndis_802_11_wep *) rtw_malloc(wep_total_len); - if(pwep == NULL){ + if (pwep == NULL){ DBG_871X(" wpa_set_encryption: pwep allocate fail !!!\n"); ret = -ENOMEM; goto exit; @@ -2653,7 +2653,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, pwep->KeyLength = wep_key_len; pwep->Length = wep_total_len; - if(wep_key_len==13) + if (wep_key_len==13) { padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_; padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_; @@ -2669,7 +2669,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, memcpy(pwep->KeyMaterial, (void *)sme->key, pwep->KeyLength); - if(rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) + if (rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) { ret = -EOPNOTSUPP ; } @@ -2678,7 +2678,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, rtw_mfree((u8 *)pwep,wep_total_len); } - if(ret < 0) + if (ret < 0) goto exit; } @@ -2724,7 +2724,7 @@ static int cfg80211_rtw_disconnect(struct wiphy *wiphy, struct net_device *ndev, rtw_set_roaming(padapter, 0); - if(check_fwstate(&padapter->mlmepriv, _FW_LINKED)) + if (check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { rtw_scan_abort(padapter); LeaveAllPowerSaveMode(padapter); @@ -2811,7 +2811,7 @@ static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, /* overwrite PMKID */ for(index=0 ; indexPMKIDList[index].Bssid, (void *)pmksa->bssid, ETH_ALEN) ==true ) + if ( _rtw_memcmp( psecuritypriv->PMKIDList[index].Bssid, (void *)pmksa->bssid, ETH_ALEN) ==true ) { /* BSSID is matched, the same AP => rewrite with new PMKID. */ DBG_871X(FUNC_NDEV_FMT" BSSID exists in the PMKList.\n", FUNC_NDEV_ARG(netdev)); @@ -2823,7 +2823,7 @@ static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, } } - if(!blInserted) + if (!blInserted) { /* Find a new entry */ DBG_871X(FUNC_NDEV_FMT" Use the new entry index = %d for this PMKID.\n", @@ -2834,7 +2834,7 @@ static int cfg80211_rtw_set_pmksa(struct wiphy *wiphy, psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bUsed = true; psecuritypriv->PMKIDIndex++ ; - if(psecuritypriv->PMKIDIndex==16) + if (psecuritypriv->PMKIDIndex==16) { psecuritypriv->PMKIDIndex =0; } @@ -2855,7 +2855,7 @@ static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy, for(index=0 ; indexPMKIDList[index].Bssid, (void *)pmksa->bssid, ETH_ALEN) ==true ) + if ( _rtw_memcmp( psecuritypriv->PMKIDList[index].Bssid, (void *)pmksa->bssid, ETH_ALEN) ==true ) { /* BSSID is matched, the same AP => Remove this PMKID information and reset it. */ memset( psecuritypriv->PMKIDList[index].Bssid, 0x00, ETH_ALEN ); memset( psecuritypriv->PMKIDList[index].PMKID, 0x00, WLAN_PMKID_LEN ); @@ -2865,7 +2865,7 @@ static int cfg80211_rtw_del_pmksa(struct wiphy *wiphy, } } - if(false == bMatched) + if (false == bMatched) { DBG_871X(FUNC_NDEV_FMT" do not have matched BSSID\n" , FUNC_NDEV_ARG(netdev)); @@ -2983,7 +2983,7 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de if (unlikely(skb->len < rtap_len)) goto fail; - if(rtap_len != 14) + if (rtap_len != 14) { DBG_8192C("radiotap len (should be 14): %d\n", rtap_len); goto fail; @@ -3050,7 +3050,7 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de DBG_8192C("RTW_Tx:da="MAC_FMT" via "FUNC_NDEV_FMT"\n", MAC_ARG(GetAddr1Ptr(buf)), FUNC_NDEV_ARG(ndev)); #ifdef CONFIG_P2P - if((type = rtw_p2p_check_frames(padapter, buf, len, true)) >= 0) + if ((type = rtw_p2p_check_frames(padapter, buf, len, true)) >= 0) goto dump; #endif if (category == RTW_WLAN_CATEGORY_PUBLIC) @@ -3142,7 +3142,7 @@ static const struct net_device_ops rtw_cfg80211_monitor_if_ops = { }; #endif -static int rtw_cfg80211_add_monitor_if(struct adapter *padapter, char *name, struct net_device **ndev) +static int rtw_cfg80211_add_monitor_if (struct adapter *padapter, char *name, struct net_device **ndev) { int ret = 0; struct net_device* mon_ndev = NULL; @@ -3257,7 +3257,7 @@ static int ret = -ENODEV; break; case NL80211_IFTYPE_MONITOR: - ret = rtw_cfg80211_add_monitor_if(padapter, (char *)name, &ndev); + ret = rtw_cfg80211_add_monitor_if (padapter, (char *)name, &ndev); break; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) @@ -3334,21 +3334,21 @@ static int rtw_add_beacon(struct adapter *adapter, const u8 *head, size_t head_l DBG_8192C("%s beacon_head_len=%zu, beacon_tail_len=%zu\n", __FUNCTION__, head_len, tail_len); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) return -EINVAL; - if(head_len<24) + if (head_len<24) return -EINVAL; pbuf = rtw_zmalloc(head_len+tail_len); - if(!pbuf) + if (!pbuf) return -ENOMEM; /* memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); */ - /* if((pstapriv->max_num_sta>NUM_STA) || (pstapriv->max_num_sta<=0)) */ + /* if ((pstapriv->max_num_sta>NUM_STA) || (pstapriv->max_num_sta<=0)) */ /* pstapriv->max_num_sta = NUM_STA; */ @@ -3358,15 +3358,15 @@ static int rtw_add_beacon(struct adapter *adapter, const u8 *head, size_t head_l len = head_len+tail_len-24; /* check wps ie if inclued */ - if(rtw_get_wps_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &wps_ielen)) + if (rtw_get_wps_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &wps_ielen)) DBG_8192C("add bcn, wps_ielen=%d\n", wps_ielen); #ifdef CONFIG_P2P /* check p2p ie if inclued */ - if( adapter->wdinfo.driver_interface == DRIVER_CFG80211 ) + if ( adapter->wdinfo.driver_interface == DRIVER_CFG80211 ) { /* check p2p if enable */ - if(rtw_get_p2p_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &p2p_ielen)) + if (rtw_get_p2p_ie(pbuf+_FIXED_IE_LENGTH_, len-_FIXED_IE_LENGTH_, NULL, &p2p_ielen)) { struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; struct wifidirect_info *pwdinfo= &(adapter->wdinfo); @@ -3374,7 +3374,7 @@ static int rtw_add_beacon(struct adapter *adapter, const u8 *head, size_t head_l DBG_8192C("got p2p_ie, len=%d\n", p2p_ielen); got_p2p_ie = true; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { DBG_8192C("Enable P2P function for the first time\n"); rtw_p2p_enable(adapter, P2P_ROLE_GO); @@ -3400,7 +3400,7 @@ static int rtw_add_beacon(struct adapter *adapter, const u8 *head, size_t head_l { #ifdef CONFIG_P2P /* check p2p if enable */ - if(got_p2p_ie == true) + if (got_p2p_ie == true) { struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; struct wifidirect_info *pwdinfo= &(adapter->wdinfo); @@ -3541,14 +3541,14 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev DBG_871X("+"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); - if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) + if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) { DBG_8192C("%s, fw_state != FW_LINKED|WIFI_AP_STATE\n", __func__); return -EINVAL; } - if(!mac) + if (!mac) { DBG_8192C("flush all sta, and cam_entry\n"); @@ -3582,9 +3582,9 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev plist = get_next(plist); - if(_rtw_memcmp((void *)mac, psta->hwaddr, ETH_ALEN)) + if (_rtw_memcmp((void *)mac, psta->hwaddr, ETH_ALEN)) { - if(psta->dot8021xalg == 1 && psta->bpairwise_key_installed == false) + if (psta->dot8021xalg == 1 && psta->bpairwise_key_installed == false) { DBG_8192C("%s, sta's dot8021xalg = 1 and key_installed = false\n", __func__); } @@ -4031,7 +4031,7 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, DBG_871X(FUNC_ADPT_FMT" ch:%u duration:%d\n", FUNC_ADPT_ARG(padapter), remain_ch, duration); - if(pcfg80211_wdinfo->is_ro_ch == true) + if (pcfg80211_wdinfo->is_ro_ch == true) { DBG_8192C("%s, cancel ro ch timer\n", __func__); @@ -4042,7 +4042,7 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, pcfg80211_wdinfo->is_ro_ch = true; - if(_FAIL == rtw_pwr_wakeup(padapter)) { + if (_FAIL == rtw_pwr_wakeup(padapter)) { err = -EFAULT; goto exit; } @@ -4054,7 +4054,7 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, pcfg80211_wdinfo->remain_on_ch_cookie= *cookie; rtw_scan_abort(padapter); - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { rtw_p2p_enable(padapter, P2P_ROLE_DEVICE); wdev_to_priv(padapter->rtw_wdev)->p2p_enabled = true; @@ -4072,14 +4072,14 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, rtw_p2p_set_state(pwdinfo, P2P_STATE_LISTEN); - if(duration < 400) + if (duration < 400) duration = duration*3;/* extend from exper. */ pcfg80211_wdinfo->restore_channel = rtw_get_oper_ch(padapter); - if(rtw_ch_set_search_ch(pmlmeext->channel_set, remain_ch) >= 0) { - if(remain_ch != rtw_get_oper_ch(padapter) ) + if (rtw_ch_set_search_ch(pmlmeext->channel_set, remain_ch) >= 0) { + if (remain_ch != rtw_get_oper_ch(padapter) ) ready_on_channel = true; } else { DBG_871X("%s remain_ch:%u not in channel plan!!!!\n", __FUNCTION__, remain_ch); @@ -4088,7 +4088,7 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy, /* call this after other things have been done */ - if(ready_on_channel == true) { + if (ready_on_channel == true) { if ( !check_fwstate(&padapter->mlmepriv, _FW_LINKED ) ) { pmlmeext->cur_channel = remain_ch; @@ -4159,7 +4159,7 @@ static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *b struct wifidirect_info *pwdinfo = &padapter->wdinfo; /* struct cfg80211_wifidirect_info *pcfg80211_wdinfo = &padapter->cfg80211_wdinfo; */ - if(_FAIL == rtw_pwr_wakeup(padapter)) { + if (_FAIL == rtw_pwr_wakeup(padapter)) { ret = -EFAULT; goto exit; } @@ -4168,7 +4168,7 @@ static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *b rtw_scan_abort(padapter); - if(tx_ch != rtw_get_oper_ch(padapter)) { + if (tx_ch != rtw_get_oper_ch(padapter)) { if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED )) pmlmeext->cur_channel = tx_ch; set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); @@ -4331,7 +4331,7 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, DBG_8192C("RTW_Tx:tx_ch=%d, da="MAC_FMT"\n", tx_ch, MAC_ARG(GetAddr1Ptr(buf))); #ifdef CONFIG_P2P - if((type = rtw_p2p_check_frames(padapter, buf, len, true)) >= 0) { + if ((type = rtw_p2p_check_frames(padapter, buf, len, true)) >= 0) { goto dump; } #endif @@ -4409,15 +4409,15 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *ndev, char *buf, DBG_871X(FUNC_NDEV_FMT" ielen=%d\n", FUNC_NDEV_ARG(ndev), len); - if(len>0) + if (len>0) { - if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) + if ((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) { #ifdef CONFIG_DEBUG_CFG80211 DBG_8192C("bcn_wps_ielen=%d\n", wps_ielen); #endif - if(pmlmepriv->wps_beacon_ie) + if (pmlmepriv->wps_beacon_ie) { u32 free_len = pmlmepriv->wps_beacon_ie_len; pmlmepriv->wps_beacon_ie_len = 0; @@ -4443,13 +4443,13 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *ndev, char *buf, /* len -= wps_ielen; */ #ifdef CONFIG_P2P - if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) + if ((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) { #ifdef CONFIG_DEBUG_CFG80211 DBG_8192C("bcn_p2p_ielen=%d\n", p2p_ielen); #endif - if(pmlmepriv->p2p_beacon_ie) + if (pmlmepriv->p2p_beacon_ie) { u32 free_len = pmlmepriv->p2p_beacon_ie_len; pmlmepriv->p2p_beacon_ie_len = 0; @@ -4474,13 +4474,13 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *ndev, char *buf, /* len -= p2p_ielen; */ #ifdef CONFIG_P2P - if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) + if (rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) { #ifdef CONFIG_DEBUG_CFG80211 DBG_8192C("bcn_wfd_ielen=%d\n", wfd_ielen); #endif - if(pmlmepriv->wfd_beacon_ie) + if (pmlmepriv->wfd_beacon_ie) { u32 free_len = pmlmepriv->wfd_beacon_ie_len; pmlmepriv->wfd_beacon_ie_len = 0; @@ -4522,9 +4522,9 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu DBG_8192C("%s, ielen=%d\n", __func__, len); #endif - if(len>0) + if (len>0) { - if((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) + if ((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen))) { uint attr_contentlen = 0; __be16 uconfig_method, *puconfig_method = NULL; @@ -4533,7 +4533,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu DBG_8192C("probe_resp_wps_ielen=%d\n", wps_ielen); #endif - if(check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) + if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { u8 sr = 0; rtw_get_wps_attr_content(wps_ie, wps_ielen, WPS_ATTR_SELECTED_REGISTRAR, (u8*)(&sr), NULL); @@ -4549,7 +4549,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu } } - if(pmlmepriv->wps_probe_resp_ie) + if (pmlmepriv->wps_probe_resp_ie) { u32 free_len = pmlmepriv->wps_probe_resp_ie_len; pmlmepriv->wps_probe_resp_ie_len = 0; @@ -4585,7 +4585,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu /* len -= wps_ielen; */ #ifdef CONFIG_P2P - if((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) + if ((p2p_ie=rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen))) { u8 is_GO = false; u32 attr_contentlen = 0; @@ -4597,7 +4597,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu #endif /* Check P2P Capability ATTR */ - if( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*) &attr_contentlen) ) + if ( rtw_get_p2p_attr_content( p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8*)&le_tmp, (uint*) &attr_contentlen) ) { u8 grp_cap=0; /* DBG_8192C( "[%s] Got P2P Capability Attr!!\n", __FUNCTION__ ); */ @@ -4606,14 +4606,14 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu is_GO = (grp_cap&BIT(0)) ? true:false; - if(is_GO) + if (is_GO) DBG_8192C("Got P2P Capability Attr, grp_cap=0x%x, is_GO\n", grp_cap); } - if(is_GO == false) + if (is_GO == false) { - if(pmlmepriv->p2p_probe_resp_ie) + if (pmlmepriv->p2p_probe_resp_ie) { u32 free_len = pmlmepriv->p2p_probe_resp_ie_len; pmlmepriv->p2p_probe_resp_ie_len = 0; @@ -4632,7 +4632,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu } else { - if(pmlmepriv->p2p_go_probe_resp_ie) + if (pmlmepriv->p2p_go_probe_resp_ie) { u32 free_len = pmlmepriv->p2p_go_probe_resp_ie_len; pmlmepriv->p2p_go_probe_resp_ie_len = 0; @@ -4657,13 +4657,13 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu /* len -= p2p_ielen; */ #ifdef CONFIG_P2P - if(rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) + if (rtw_get_wfd_ie(buf, len, NULL, &wfd_ielen)) { #ifdef CONFIG_DEBUG_CFG80211 DBG_8192C("probe_resp_wfd_ielen=%d\n", wfd_ielen); #endif - if(pmlmepriv->wfd_probe_resp_ie) + if (pmlmepriv->wfd_probe_resp_ie) { u32 free_len = pmlmepriv->wfd_probe_resp_ie_len; pmlmepriv->wfd_probe_resp_ie_len = 0; @@ -4695,9 +4695,9 @@ static int rtw_cfg80211_set_assoc_resp_wpsp2pie(struct net_device *net, char *bu DBG_8192C("%s, ielen=%d\n", __func__, len); - if(len>0) + if (len>0) { - if(pmlmepriv->wps_assoc_resp_ie) + if (pmlmepriv->wps_assoc_resp_ie) { u32 free_len = pmlmepriv->wps_assoc_resp_ie_len; pmlmepriv->wps_assoc_resp_ie_len = 0; @@ -4730,7 +4730,7 @@ int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, DBG_8192C("%s, ielen=%d\n", __func__, len); #endif - if( (rtw_get_wps_ie(buf, len, NULL, &wps_ielen) && (wps_ielen>0)) + if ( (rtw_get_wps_ie(buf, len, NULL, &wps_ielen) && (wps_ielen>0)) #ifdef CONFIG_P2P || (rtw_get_p2p_ie(buf, len, NULL, &p2p_ielen) && (p2p_ielen>0)) #endif @@ -4849,7 +4849,7 @@ static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum *if BW_40 rx_mask[4]=0x01; *highest supported RX rate */ - if(rf_type == RF_1T1R) + if (rf_type == RF_1T1R) { ht_cap->mcs.rx_mask[0] = 0xFF; ht_cap->mcs.rx_mask[1] = 0x00; @@ -4857,7 +4857,7 @@ static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum ht_cap->mcs.rx_highest = cpu_to_le16(MAX_BIT_RATE_40MHZ_MCS7); } - else if((rf_type == RF_1T2R) || (rf_type==RF_2T2R)) + else if ((rf_type == RF_1T2R) || (rf_type==RF_2T2R)) { ht_cap->mcs.rx_mask[0] = 0xFF; ht_cap->mcs.rx_mask[1] = 0xFF; @@ -4886,14 +4886,14 @@ void rtw_cfg80211_init_wiphy(struct adapter *padapter) /* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */ { bands = wiphy->bands[IEEE80211_BAND_2GHZ]; - if(bands) + if (bands) rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_2GHZ, rf_type); } /* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */ { bands = wiphy->bands[IEEE80211_BAND_5GHZ]; - if(bands) + if (bands) rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type); } } @@ -4971,7 +4971,7 @@ static void rtw_cfg80211_preinit_wiphy(struct adapter *padapter, struct wiphy *w wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX | WIPHY_FLAG_HAVE_AP_SME; #endif - if(padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE) + if (padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE) wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; else wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; @@ -5033,7 +5033,7 @@ int rtw_wdev_alloc(struct adapter *padapter, struct device *dev) pwdev_priv->bandroid_scan = false; - if(padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE) + if (padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE) pwdev_priv->power_mgmt = true; else pwdev_priv->power_mgmt = false; diff --git a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c index a605786..c6a47d1 100644 --- a/os_dep/ioctl_linux.c +++ b/os_dep/ioctl_linux.c @@ -136,7 +136,7 @@ static void indicate_wx_custom_event(struct adapter *padapter, char *msg) } buff = rtw_zmalloc(IW_CUSTOM_MAX+1); - if(!buff) + if (!buff) return; memcpy(buff, msg, strlen(msg)); @@ -156,7 +156,7 @@ static void request_wps_pbc_event(struct adapter *padapter) buff = rtw_malloc(IW_CUSTOM_MAX); - if(!buff) + if (!buff) return; memset(buff, 0, IW_CUSTOM_MAX); @@ -173,7 +173,7 @@ static void request_wps_pbc_event(struct adapter *padapter) DBG_871X("%s\n", __FUNCTION__); - if(buff) + if (buff) { rtw_mfree(buff, IW_CUSTOM_MAX); } @@ -204,7 +204,7 @@ void rtw_indicate_wx_assoc_event(struct adapter *padapter) wrqu.ap_addr.sa_family = ARPHRD_ETHER; - if(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==true ) + if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)==true ) memcpy(wrqu.ap_addr.sa_data, pnetwork->MacAddress, ETH_ALEN); else memcpy(wrqu.ap_addr.sa_data, pmlmepriv->cur_network.network.MacAddress, ETH_ALEN); @@ -255,7 +255,7 @@ static char *translate_scan(struct adapter *padapter, ( SCAN_RESULT_WFD_TYPE == pwdinfo->wfd_info->scan_result_type ) ) #endif /* CONFIG_P2P */ { - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { u32 blnGotP2PIE = false; @@ -345,7 +345,7 @@ static char *translate_scan(struct adapter *padapter, /* parsing HT_CAP_IE */ p = rtw_get_ie(&pnetwork->network.IEs[12], _HT_CAPABILITY_IE_, &ht_ielen, pnetwork->network.IELength-12); - if(p && ht_ielen>0) { + if (p && ht_ielen>0) { struct ieee80211_ht_cap *pht_capie; ht_cap = true; pht_capie = (struct ieee80211_ht_cap *)(p+2); @@ -357,23 +357,23 @@ static char *translate_scan(struct adapter *padapter, /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; if ((rtw_is_cckratesonly_included((u8*)&pnetwork->network.SupportedRates)) == true) { - if(ht_cap == true) + if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11b"); } else if ((rtw_is_cckrates_included((u8*)&pnetwork->network.SupportedRates)) == true) { - if(ht_cap == true) + if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bgn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bg"); } else { - if(pnetwork->network.Configuration.DSConfig > 14) { - if(ht_cap == true) + if (pnetwork->network.Configuration.DSConfig > 14) { + if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11an"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11a"); } else { - if(ht_cap == true) + if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11gn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11g"); @@ -389,7 +389,7 @@ static char *translate_scan(struct adapter *padapter, cap = le16_to_cpu(le_cap); - if(cap & (WLAN_CAPABILITY_IBSS |WLAN_CAPABILITY_BSS)){ + if (cap & (WLAN_CAPABILITY_IBSS |WLAN_CAPABILITY_BSS)){ if (cap & WLAN_CAPABILITY_BSS) iwe.u.mode = IW_MODE_MASTER; else @@ -398,7 +398,7 @@ static char *translate_scan(struct adapter *padapter, start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_UINT_LEN); } - if(pnetwork->network.Configuration.DSConfig<1 /*|| pnetwork->network.Configuration.DSConfig>14*/) + if (pnetwork->network.Configuration.DSConfig<1 /*|| pnetwork->network.Configuration.DSConfig>14*/) pnetwork->network.Configuration.DSConfig = 1; /* Add frequency/channel */ @@ -430,11 +430,11 @@ static char *translate_scan(struct adapter *padapter, i++; } - if(ht_cap == true) { - if(mcs_rate&0x8000) { /* MCS15 */ + if (ht_cap == true) { + if (mcs_rate&0x8000) { /* MCS15 */ max_rate = (bw_40MHz) ? ((short_GI)?300:270):((short_GI)?144:130); - } else if(mcs_rate&0x0080) { /* MCS7 */ + } else if (mcs_rate&0x0080) { /* MCS7 */ max_rate = (bw_40MHz) ? ((short_GI)?150:135):((short_GI)?72:65); } else { /* default MCS7 */ /* DBG_871X("wx_get_scan, mcs_rate_bitmap=0x%x\n", mcs_rate); */ @@ -520,7 +520,7 @@ static char *translate_scan(struct adapter *padapter, while(cnt < total_ielen) { - if(rtw_is_wps_ie(&ie_ptr[cnt], &wps_ielen) && (wps_ielen>2)) + if (rtw_is_wps_ie(&ie_ptr[cnt], &wps_ielen) && (wps_ielen>2)) { wpsie_ptr = &ie_ptr[cnt]; iwe.cmd =IWEVGENIE; @@ -593,18 +593,18 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value) padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeShared; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; } - else if(value & AUTH_ALG_OPEN_SYSTEM) + else if (value & AUTH_ALG_OPEN_SYSTEM) { DBG_871X("wpa_set_auth_algs, AUTH_ALG_OPEN_SYSTEM\n"); /* padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; */ - if(padapter->securitypriv.ndisauthtype < Ndis802_11AuthModeWPAPSK) + if (padapter->securitypriv.ndisauthtype < Ndis802_11AuthModeWPAPSK) { padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open; } } - else if(value & AUTH_ALG_LEAP) + else if (value & AUTH_ALG_LEAP) { DBG_871X("wpa_set_auth_algs, AUTH_ALG_LEAP\n"); } @@ -684,7 +684,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); pwep =(struct ndis_802_11_wep *) rtw_malloc(wep_total_len); - if(pwep == NULL){ + if (pwep == NULL){ RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,(" wpa_set_encryption: pwep allocate fail !!!\n")); goto exit; } @@ -694,7 +694,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, pwep->KeyLength = wep_key_len; pwep->Length = wep_total_len; - if(wep_key_len==13) + if (wep_key_len==13) { padapter->securitypriv.dot11PrivacyAlgrthm=_WEP104_; padapter->securitypriv.dot118021XGrpPrivacy=_WEP104_; @@ -710,11 +710,11 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, memcpy(pwep->KeyMaterial, param->u.crypt.key, pwep->KeyLength); - if(param->u.crypt.set_tx) + if (param->u.crypt.set_tx) { DBG_871X("wep, set_tx=1\n"); - if(rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) + if (rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) { ret = -EOPNOTSUPP ; } @@ -733,7 +733,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, goto exit; } - if(padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) /* 802_1x */ + if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) /* 802_1x */ { struct sta_info * psta,*pbcmc_sta; struct sta_priv * pstapriv = &padapter->stapriv; @@ -750,17 +750,17 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, if (strcmp(param->u.crypt.alg, "none") != 0) psta->ieee8021x_blocked = false; - if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| + if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; } - if(param->u.crypt.set_tx ==1)/* pairwise key */ + if (param->u.crypt.set_tx ==1)/* pairwise key */ { memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - if(strcmp(param->u.crypt.alg, "TKIP") == 0)/* set mic key */ + if (strcmp(param->u.crypt.alg, "TKIP") == 0)/* set mic key */ { memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8); memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8); @@ -774,12 +774,12 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, } else/* group key */ { - if(strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) + if (strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) { printk("[%s] GTK key_len=%d @@@@@@@@@@@@@@@@@@\n", param->u.crypt.alg, param->u.crypt.key_len); memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key,(param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); /* only TKIP group key need to install this */ - if(param->u.crypt.key_len > 16) + if (param->u.crypt.key_len > 16) { memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[16]),8); memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[24]),8); @@ -792,7 +792,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, rtw_set_key(padapter,&padapter->securitypriv,param->u.crypt.idx, 1,true); } #ifdef CONFIG_IEEE80211W - else if(strcmp(param->u.crypt.alg, "BIP") == 0) + else if (strcmp(param->u.crypt.alg, "BIP") == 0) { int no; /* save the IGTK key, length 16 bytes */ @@ -804,7 +804,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, #endif /* CONFIG_IEEE80211W */ #ifdef CONFIG_P2P - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) rtw_p2p_set_state(pwdinfo, P2P_STATE_PROVISIONING_DONE); #endif /* CONFIG_P2P */ @@ -812,7 +812,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, } pbcmc_sta=rtw_get_bcmc_stainfo(padapter); - if(pbcmc_sta==NULL) + if (pbcmc_sta==NULL) { /* DEBUG_ERR( ("Set OID_802_11_ADD_KEY: bcmc stainfo is null\n")); */ } @@ -822,7 +822,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, if (strcmp(param->u.crypt.alg, "none") != 0) pbcmc_sta->ieee8021x_blocked = false; - if((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| + if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; @@ -849,15 +849,15 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie struct wifidirect_info* pwdinfo = &padapter->wdinfo; #endif /* CONFIG_P2P */ - if((ielen > MAX_WPA_IE_LEN) || (pie == NULL)){ + if ((ielen > MAX_WPA_IE_LEN) || (pie == NULL)){ _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); - if(pie == NULL) + if (pie == NULL) return ret; else return -EINVAL; } - if(ielen) { + if (ielen) { buf = rtw_zmalloc(ielen); if (buf == NULL){ ret = -ENOMEM; @@ -875,20 +875,20 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie } pos = buf; - if(ielen < RSN_HEADER_LEN){ + if (ielen < RSN_HEADER_LEN){ RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_err_,("Ie len too short %d\n", ielen)); ret = -1; goto exit; } - if(rtw_parse_wpa_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + if (rtw_parse_wpa_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPAPSK; memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); } - if(rtw_parse_wpa2_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) + if (rtw_parse_wpa2_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { padapter->securitypriv.dot11AuthAlgrthm= dot11AuthAlgrthm_8021X; padapter->securitypriv.ndisauthtype=Ndis802_11AuthModeWPA2PSK; @@ -961,7 +961,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie { eid = buf[cnt]; - if((eid==_VENDOR_SPECIFIC_IE_)&&(_rtw_memcmp(&buf[cnt+2], wps_oui, 4)==true)) + if ((eid==_VENDOR_SPECIFIC_IE_)&&(_rtw_memcmp(&buf[cnt+2], wps_oui, 4)==true)) { DBG_871X("SET WPS_IE\n"); @@ -972,7 +972,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS); #ifdef CONFIG_P2P - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_OK)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_OK)) { rtw_p2p_set_state(pwdinfo, P2P_STATE_PROVISIONING_ING); } @@ -988,7 +988,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie } /* TKIP and AES disallow multicast packets until installing group key */ - if(padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ + if (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ || padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ || padapter->securitypriv.dot11PrivacyAlgrthm == _AES_) /* WPS open need to enable multicast */ @@ -1023,29 +1023,29 @@ static int rtw_wx_get_name(struct net_device *dev, if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) { /* parsing HT_CAP_IE */ p = rtw_get_ie(&pcur_bss->IEs[12], _HT_CAPABILITY_IE_, &ht_ielen, pcur_bss->IELength-12); - if(p && ht_ielen>0) + if (p && ht_ielen>0) ht_cap = true; prates = pcur_bss->SupportedRates; if (rtw_is_cckratesonly_included((u8*)prates)) { - if(ht_cap == true) + if (ht_cap == true) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bn"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11b"); } else if ((rtw_is_cckrates_included((u8*)prates))) { - if(ht_cap == true) + if (ht_cap == true) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bgn"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bg"); } else { - if(pcur_bss->Configuration.DSConfig > 14) { - if(ht_cap == true) + if (pcur_bss->Configuration.DSConfig > 14) { + if (ht_cap == true) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11an"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11a"); } else { - if(ht_cap == true) + if (ht_cap == true) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11gn"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11g"); @@ -1078,7 +1078,7 @@ static int rtw_wx_get_freq(struct net_device *dev, struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; - if(check_fwstate(pmlmepriv, _FW_LINKED) == true) + if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { /* wrqu->freq.m = ieee80211_wlan_frequencies[pcur_bss->Configuration.DSConfig-1] * 100000; */ wrqu->freq.m = rtw_ch2freq(pcur_bss->Configuration.DSConfig) * 100000; @@ -1104,7 +1104,7 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a, ; - if(_FAIL == rtw_pwr_wakeup(padapter)) { + if (_FAIL == rtw_pwr_wakeup(padapter)) { ret= -EPERM; goto exit; } @@ -1170,7 +1170,7 @@ static int rtw_wx_get_mode(struct net_device *dev, struct iw_request_info *a, else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) wrqu->mode = IW_MODE_ADHOC; - else if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) wrqu->mode = IW_MODE_MASTER; else wrqu->mode = IW_MODE_AUTO; @@ -1201,7 +1201,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev, /* overwrite PMKID */ for(j=0 ; jPMKIDList[j].Bssid, strIssueBssid, ETH_ALEN) ==true ) + if ( _rtw_memcmp( psecuritypriv->PMKIDList[j].Bssid, strIssueBssid, ETH_ALEN) ==true ) { /* BSSID is matched, the same AP => rewrite with new PMKID. */ DBG_871X( "[rtw_wx_set_pmkid] BSSID exists in the PMKList.\n" ); @@ -1214,7 +1214,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev, } } - if(!blInserted) { + if (!blInserted) { /* Find a new entry */ DBG_871X( "[rtw_wx_set_pmkid] Use the new entry index = %d for this PMKID.\n", psecuritypriv->PMKIDIndex ); @@ -1224,14 +1224,14 @@ static int rtw_wx_set_pmkid(struct net_device *dev, psecuritypriv->PMKIDList[ psecuritypriv->PMKIDIndex ].bUsed = true; psecuritypriv->PMKIDIndex++ ; - if(psecuritypriv->PMKIDIndex==16) + if (psecuritypriv->PMKIDIndex==16) psecuritypriv->PMKIDIndex =0; } } else if ( pPMK->cmd == IW_PMKSA_REMOVE ) { DBG_871X( "[rtw_wx_set_pmkid] IW_PMKSA_REMOVE!\n" ); intReturn = true; for(j=0 ; jPMKIDList[j].Bssid, strIssueBssid, ETH_ALEN) ==true ) + if ( _rtw_memcmp( psecuritypriv->PMKIDList[j].Bssid, strIssueBssid, ETH_ALEN) ==true ) { /* BSSID is matched, the same AP => Remove this PMKID information and reset it. */ memset( psecuritypriv->PMKIDList[ j ].Bssid, 0x00, ETH_ALEN ); psecuritypriv->PMKIDList[ j ].bUsed = false; @@ -1319,7 +1319,7 @@ static int rtw_wx_get_range(struct net_device *dev, for (i = 0, val = 0; i < MAX_CHANNEL_NUM; i++) { /* Include only legal frequencies for some countries */ - if(pmlmeext->channel_set[i].ChannelNum != 0) + if (pmlmeext->channel_set[i].ChannelNum != 0) { range->freq[val].i = pmlmeext->channel_set[i].ChannelNum; range->freq[val].m = rtw_ch2freq(pmlmeext->channel_set[i].ChannelNum) * 100000; @@ -1388,13 +1388,13 @@ static int rtw_wx_set_wap(struct net_device *dev, struct wlan_network *pnetwork = NULL; enum NDIS_802_11_AUTHENTICATION_MODE authmode; - if(_FAIL == rtw_pwr_wakeup(padapter)) + if (_FAIL == rtw_pwr_wakeup(padapter)) { ret= -1; goto exit; } - if(!padapter->bup){ + if (!padapter->bup){ ret = -1; goto exit; } @@ -1425,7 +1425,7 @@ static int rtw_wx_set_wap(struct net_device *dev, if ((_rtw_memcmp(dst_bssid, src_bssid, ETH_ALEN)) == true) { - if(!rtw_set_802_11_infrastructure_mode(padapter, pnetwork->network.InfrastructureMode)) + if (!rtw_set_802_11_infrastructure_mode(padapter, pnetwork->network.InfrastructureMode)) { ret = -1; spin_unlock_bh(&queue->lock); @@ -1497,7 +1497,7 @@ static int rtw_wx_set_mlme(struct net_device *dev, struct iw_mlme *mlme = (struct iw_mlme *) extra; - if(mlme==NULL) + if (mlme==NULL) return -1; DBG_871X("%s\n", __FUNCTION__); @@ -1508,11 +1508,11 @@ static int rtw_wx_set_mlme(struct net_device *dev, switch (mlme->cmd) { case IW_MLME_DEAUTH: - if(!rtw_set_802_11_disassociate(padapter)) + if (!rtw_set_802_11_disassociate(padapter)) ret = -1; break; case IW_MLME_DISASSOC: - if(!rtw_set_802_11_disassociate(padapter)) + if (!rtw_set_802_11_disassociate(padapter)) ret = -1; break; default: @@ -1541,7 +1541,7 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, #ifdef DBG_IOCTL DBG_871X("DBG_IOCTL %s:%d\n",__FUNCTION__, __LINE__); #endif - if(_FAIL == rtw_pwr_wakeup(padapter)) + if (_FAIL == rtw_pwr_wakeup(padapter)) { ret= -1; goto exit; @@ -1553,7 +1553,7 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, goto exit; } - if(!padapter->bup){ + if (!padapter->bup){ ret = -1; goto exit; } @@ -1641,7 +1641,7 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, else #endif - if( wrqu->data.length >= WEXT_CSCAN_HEADER_SIZE + if ( wrqu->data.length >= WEXT_CSCAN_HEADER_SIZE && _rtw_memcmp(extra, WEXT_CSCAN_HEADER, WEXT_CSCAN_HEADER_SIZE) == true ) { @@ -1657,14 +1657,14 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, switch(section) { case WEXT_CSCAN_SSID_SECTION: /* DBG_871X("WEXT_CSCAN_SSID_SECTION\n"); */ - if(len < 1) { + if (len < 1) { len = 0; break; } sec_len = *(pos++); len-=1; - if(sec_len>0 && sec_len<=len) { + if (sec_len>0 && sec_len<=len) { ssid[ssid_index].SsidLength = sec_len; memcpy(ssid[ssid_index].Ssid, pos, ssid[ssid_index].SsidLength); ssid_index++; @@ -1703,7 +1703,7 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, _status = rtw_set_802_11_bssid_list_scan(padapter, NULL, 0); } - if(_status == false) + if (_status == false) ret = -1; exit: @@ -1743,14 +1743,14 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, DBG_871X("DBG_IOCTL %s:%d\n",__FUNCTION__, __LINE__); #endif - if(adapter_to_pwrctl(padapter)->brfoffbyhw && padapter->bDriverStopped) + if (adapter_to_pwrctl(padapter)->brfoffbyhw && padapter->bDriverStopped) { ret = -EINVAL; goto exit; } #ifdef CONFIG_P2P - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { /* P2P is enabled */ if ( padapter->chip_type == RTL8192D ) @@ -1788,7 +1788,7 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, if (rtw_end_of_queue_search(phead,plist)== true) break; - if((stop - ev) < SCAN_ITEM_SIZE) { + if ((stop - ev) < SCAN_ITEM_SIZE) { ret = -E2BIG; break; } @@ -1796,7 +1796,7 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); /* report network only if the current channel set contains the channel to which this network belongs */ - if(rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, pnetwork->network.Configuration.DSConfig) >= 0 + if (rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, pnetwork->network.Configuration.DSConfig) >= 0 && true == rtw_validate_ssid(&(pnetwork->network.Ssid)) ) { @@ -1854,13 +1854,13 @@ static int rtw_wx_set_essid(struct net_device *dev, RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("+rtw_wx_set_essid: fw_state=0x%08x\n", get_fwstate(pmlmepriv))); - if(_FAIL == rtw_pwr_wakeup(padapter)) + if (_FAIL == rtw_pwr_wakeup(padapter)) { ret = -1; goto exit; } - if(!padapter->bup){ + if (!padapter->bup){ ret = -1; goto exit; } @@ -1874,7 +1874,7 @@ static int rtw_wx_set_essid(struct net_device *dev, goto exit; } - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { ret = -1; goto exit; } @@ -1887,7 +1887,7 @@ static int rtw_wx_set_essid(struct net_device *dev, /* We got the codes in "set_info" function of iwconfig source code. */ /* ========================================= */ /* wrq.u.essid.length = strlen(essid) + 1; */ - /* if(we_kernel_version > 20) */ + /* if (we_kernel_version > 20) */ /* wrq.u.essid.length--; */ /* ========================================= */ /* That means, if the WIRELESS_EXT less than or equal to 20, the correct ssid len should subtract 1. */ @@ -1897,7 +1897,7 @@ static int rtw_wx_set_essid(struct net_device *dev, len = (wrqu->essid.length < IW_ESSID_MAX_SIZE) ? wrqu->essid.length : IW_ESSID_MAX_SIZE; #endif - if( wrqu->essid.length != 33 ) + if ( wrqu->essid.length != 33 ) DBG_871X("ssid=%s, len=%d\n", extra, wrqu->essid.length); memset(&ndis_ssid, 0, sizeof(struct ndis_802_11_ssid)); @@ -1934,9 +1934,9 @@ static int rtw_wx_set_essid(struct net_device *dev, RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("rtw_wx_set_essid: find match, set infra mode\n")); - if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) { - if(pnetwork->network.InfrastructureMode != pmlmepriv->cur_network.network.InfrastructureMode) + if (pnetwork->network.InfrastructureMode != pmlmepriv->cur_network.network.InfrastructureMode) continue; } @@ -2026,7 +2026,7 @@ static int rtw_wx_set_rate(struct net_device *dev, RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,(" rtw_wx_set_rate\n")); RT_TRACE(_module_rtl871x_ioctl_os_c,_drv_info_,("target_rate = %d, fixed = %d\n",target_rate,fixed)); - if(target_rate == -1){ + if (target_rate == -1){ ratevalue = 11; goto set_rate; } @@ -2078,10 +2078,10 @@ set_rate: for(i=0; ibitrate.fixed = 0; /* no auto select */ @@ -2248,7 +2248,7 @@ static int rtw_wx_set_enc(struct net_device *dev, } /* set authentication mode */ - if(erq->flags & IW_ENCODE_OPEN) { + if (erq->flags & IW_ENCODE_OPEN) { DBG_871X("rtw_wx_set_enc():IW_ENCODE_OPEN\n"); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;/* Ndis802_11EncryptionDisabled; */ @@ -2258,7 +2258,7 @@ static int rtw_wx_set_enc(struct net_device *dev, padapter->securitypriv.dot118021XGrpPrivacy=_NO_PRIVACY_; authmode = Ndis802_11AuthModeOpen; padapter->securitypriv.ndisauthtype=authmode; - } else if(erq->flags & IW_ENCODE_RESTRICTED) { + } else if (erq->flags & IW_ENCODE_RESTRICTED) { DBG_871X("rtw_wx_set_enc():IW_ENCODE_RESTRICTED\n"); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; @@ -2287,7 +2287,7 @@ static int rtw_wx_set_enc(struct net_device *dev, } else { wep.KeyLength = 0 ; - if(keyindex_provided == 1)/* set key_id only, no given KeyMaterial(erq->length==0). */ + if (keyindex_provided == 1)/* set key_id only, no given KeyMaterial(erq->length==0). */ { padapter->securitypriv.dot11PrivacyKeyIndex = key; @@ -2312,7 +2312,7 @@ static int rtw_wx_set_enc(struct net_device *dev, memcpy(wep.KeyMaterial, keybuf, wep.KeyLength); if (rtw_set_802_11_add_wep(padapter, &wep) == false) { - if(rf_on == pwrpriv->rf_pwrstate ) + if (rf_on == pwrpriv->rf_pwrstate ) ret = -EOPNOTSUPP; goto exit; } @@ -2333,9 +2333,9 @@ static int rtw_wx_get_enc(struct net_device *dev, ; - if(check_fwstate(pmlmepriv, _FW_LINKED) != true) + if (check_fwstate(pmlmepriv, _FW_LINKED) != true) { - if(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) != true) + if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) != true) { erq->length = 0; erq->flags |= IW_ENCODE_DISABLED; @@ -2365,14 +2365,14 @@ static int rtw_wx_get_enc(struct net_device *dev, break; case Ndis802_11Encryption1Enabled: erq->length = padapter->securitypriv.dot11DefKeylen[key]; - if(erq->length) { + if (erq->length) { memcpy(keybuf, padapter->securitypriv.dot11DefKey[key].skey, padapter->securitypriv.dot11DefKeylen[key]); erq->flags |= IW_ENCODE_ENABLED; - if(padapter->securitypriv.ndisauthtype == Ndis802_11AuthModeOpen) + if (padapter->securitypriv.ndisauthtype == Ndis802_11AuthModeOpen) erq->flags |= IW_ENCODE_OPEN; - else if(padapter->securitypriv.ndisauthtype == Ndis802_11AuthModeShared) + else if (padapter->securitypriv.ndisauthtype == Ndis802_11AuthModeShared) erq->flags |= IW_ENCODE_RESTRICTED; } else { erq->length = 0; @@ -2467,13 +2467,13 @@ static int rtw_wx_set_auth(struct net_device *dev, * be set. */ - if(padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption1Enabled) + if (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption1Enabled) { break;/* it means init value, or using wep, ndisencryptstatus = Ndis802_11Encryption1Enabled, */ /* then it needn't reset it; */ } - if(param->value){ + if (param->value){ padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; padapter->securitypriv.dot11PrivacyAlgrthm=_NO_PRIVACY_; padapter->securitypriv.dot118021XGrpPrivacy=_NO_PRIVACY_; @@ -2490,7 +2490,7 @@ static int rtw_wx_set_auth(struct net_device *dev, /* * It's the starting point of a link layer connection using wpa_supplicant */ - if(check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { + if (check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { LeaveAllPowerSaveMode(padapter); rtw_disassoc_cmd(padapter, 500, false); DBG_871X("%s...call rtw_indicate_disconnect\n ",__FUNCTION__); @@ -2587,7 +2587,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, if (pext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) memcpy(param->u.crypt.seq, pext->rx_seq, 8); - if(pext->key_len) { + if (pext->key_len) { param->u.crypt.key_len = pext->key_len; /* memcpy(param + 1, pext + 1, pext->key_len); */ memcpy(param->u.crypt.key, pext + 1, pext->key_len); @@ -2601,7 +2601,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, ret = wpa_set_encryption(dev, param, param_len); - if(param) + if (param) { rtw_mfree((u8*)param, param_len); } @@ -2614,7 +2614,7 @@ static int rtw_wx_get_nick(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - if(extra) { + if (extra) { wrqu->data.length = 14; wrqu->data.flags = 1; memcpy(extra, "", 14); @@ -2773,7 +2773,7 @@ static int rtw_wx_set_channel_plan(struct net_device *dev, extern int rtw_channel_plan; u8 channel_plan_req = (u8) (*((int *)wrqu)); - if( _SUCCESS == rtw_set_chplan_cmd(padapter, channel_plan_req, 1) ) + if ( _SUCCESS == rtw_set_chplan_cmd(padapter, channel_plan_req, 1) ) DBG_871X("%s set channel_plan = 0x%02X\n", __func__, pmlmepriv->ChannelPlan); else return -EPERM; @@ -2818,7 +2818,7 @@ static int rtw_drvext_hdl(struct net_device *dev, struct iw_request_info *info, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct iw_point *p = &wrqu->data; - if( (!p->length) || (!p->pointer)){ + if ( (!p->length) || (!p->pointer)){ ret = -EINVAL; goto _rtw_drvext_hdl_exit; } @@ -2832,7 +2832,7 @@ static int rtw_drvext_hdl(struct net_device *dev, struct iw_request_info *info, goto _rtw_drvext_hdl_exit; } - if(bset)/* set info */ + if (bset)/* set info */ { if (copy_from_user(pparmbuf, p->pointer,len)) { rtw_mfree(pparmbuf, len); @@ -2883,7 +2883,7 @@ static int rtw_drvext_hdl(struct net_device *dev, struct iw_request_info *info, res = phandler->handler(&padapter->drvextpriv, bset, poidparam->data); - if(res==0) + if (res==0) { ret = 0; @@ -3093,7 +3093,7 @@ static int rtw_get_ap_info(struct net_device *dev, DBG_871X("+rtw_get_aplist_info\n"); - if((padapter->bDriverStopped) || (pdata==NULL)) + if ((padapter->bDriverStopped) || (pdata==NULL)) { ret= -EINVAL; goto exit; @@ -3103,16 +3103,16 @@ static int rtw_get_ap_info(struct net_device *dev, { rtw_msleep_os(30); cnt++; - if(cnt > 100) + if (cnt > 100) break; } /* pdata->length = 0; */ pdata->flags = 0; - if(pdata->length>=32) + if (pdata->length>=32) { - if(copy_from_user(data, pdata->pointer, 32)) + if (copy_from_user(data, pdata->pointer, 32)) { ret= -EINVAL; goto exit; @@ -3137,8 +3137,8 @@ static int rtw_get_ap_info(struct net_device *dev, pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); - /* if(hwaddr_aton_i(pdata->pointer, bssid)) */ - if(hwaddr_aton_i(data, bssid)) + /* if (hwaddr_aton_i(pdata->pointer, bssid)) */ + if (hwaddr_aton_i(data, bssid)) { DBG_871X("Invalid BSSID '%s'.\n", (u8*)data); spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); @@ -3146,19 +3146,19 @@ static int rtw_get_ap_info(struct net_device *dev, } - if(_rtw_memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN) == true)/* BSSID match, then check if supporting wpa/wpa2 */ + if (_rtw_memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN) == true)/* BSSID match, then check if supporting wpa/wpa2 */ { DBG_871X("BSSID:" MAC_FMT "\n", MAC_ARG(bssid)); pbuf = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength-12); - if(pbuf && (wpa_ielen>0)) + if (pbuf && (wpa_ielen>0)) { pdata->flags = 1; break; } pbuf = rtw_get_wpa2_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength-12); - if(pbuf && (wpa_ielen>0)) + if (pbuf && (wpa_ielen>0)) { pdata->flags = 2; break; @@ -3172,8 +3172,8 @@ static int rtw_get_ap_info(struct net_device *dev, spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); - if(pdata->length>=34) { - if(copy_to_user((u8 __user *)pdata->pointer+32, (u8*)&pdata->flags, 1)) { + if (pdata->length>=34) { + if (copy_to_user((u8 __user *)pdata->pointer+32, (u8*)&pdata->flags, 1)) { ret= -EINVAL; goto exit; } @@ -3195,14 +3195,14 @@ static int rtw_set_pid(struct net_device *dev, int *pdata = (int *)wrqu; int selector; - if((padapter->bDriverStopped) || (pdata==NULL)) + if ((padapter->bDriverStopped) || (pdata==NULL)) { ret= -EINVAL; goto exit; } selector = *pdata; - if(selector < 3 && selector >=0) { + if (selector < 3 && selector >=0) { padapter->pid[selector] = *(pdata+1); ui_pid[selector] = *(pdata+1); DBG_871X("%s set pid[%d]=%d\n", __FUNCTION__, selector ,padapter->pid[selector]); @@ -3228,7 +3228,7 @@ static int rtw_wps_start(struct net_device *dev, uintRet = copy_from_user( ( void* ) &u32wps_start, pdata->pointer, 4 ); - if((padapter->bDriverStopped) || (pdata==NULL)) + if ((padapter->bDriverStopped) || (pdata==NULL)) { ret= -EINVAL; goto exit; @@ -3273,28 +3273,28 @@ static int rtw_wext_p2p_enable(struct net_device *dev, struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; enum P2P_ROLE init_role = P2P_ROLE_DISABLE; - if(*extra == '0' ) + if (*extra == '0' ) init_role = P2P_ROLE_DISABLE; - else if(*extra == '1') + else if (*extra == '1') init_role = P2P_ROLE_DEVICE; - else if(*extra == '2') + else if (*extra == '2') init_role = P2P_ROLE_CLIENT; - else if(*extra == '3') + else if (*extra == '3') init_role = P2P_ROLE_GO; - if(_FAIL == rtw_p2p_enable(padapter, init_role)) + if (_FAIL == rtw_p2p_enable(padapter, init_role)) { ret = -EFAULT; goto exit; } /* set channel/bandwidth */ - if(init_role != P2P_ROLE_DISABLE) + if (init_role != P2P_ROLE_DISABLE) { u8 channel, ch_offset; u16 bwmode; - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_LISTEN)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_LISTEN)) { /* Stay at the listen state and wait for discovery. */ channel = pwdinfo->listen_channel; @@ -3448,7 +3448,7 @@ static int rtw_p2p_profilefound(struct net_device *dev, /* The upper application should pass the SSID to driver by using this rtw_p2p_profilefound function. */ - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { if ( extra[ 0 ] == '0' ) { @@ -4285,7 +4285,7 @@ static int rtw_p2p_invite_req(struct net_device *dev, return ret; } - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { DBG_871X( "[%s] WiFi Direct is disable!\n", __FUNCTION__ ); return ret; @@ -4457,7 +4457,7 @@ static int rtw_p2p_set_persistent(struct net_device *dev, DBG_871X( "[%s] data = %s\n", __FUNCTION__, extra ); - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { DBG_871X( "[%s] WiFi Direct is disable!\n", __FUNCTION__ ); return ret; @@ -4588,7 +4588,7 @@ static int rtw_p2p_set_pc(struct net_device *dev, DBG_871X( "[%s] data = %s\n", __FUNCTION__, extra ); - if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { DBG_871X( "[%s] WiFi Direct is disable!\n", __FUNCTION__ ); return ret; @@ -4779,9 +4779,9 @@ static int rtw_p2p_set_wfd_enable(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo= &(padapter->wdinfo); - if(*extra == '0' ) + if (*extra == '0' ) pwdinfo->wfd_info->wfd_enable = false; - else if(*extra == '1') + else if (*extra == '1') pwdinfo->wfd_info->wfd_enable = true; DBG_871X( "[%s] wfd_enable = %d\n", __FUNCTION__, pwdinfo->wfd_info->wfd_enable ); @@ -4800,12 +4800,12 @@ static int rtw_p2p_set_driver_iface(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct wifidirect_info *pwdinfo= &(padapter->wdinfo); - if(*extra == '1' ) + if (*extra == '1' ) { pwdinfo->driver_interface = DRIVER_WEXT; DBG_871X( "[%s] driver_interface = WEXT\n", __FUNCTION__); } - else if(*extra == '2') + else if (*extra == '2') { pwdinfo->driver_interface = DRIVER_CFG80211; DBG_871X( "[%s] driver_interface = CFG80211\n", __FUNCTION__); @@ -4829,7 +4829,7 @@ static int rtw_p2p_set_sa(struct net_device *dev, DBG_871X( "[%s] data = %s\n", __FUNCTION__, extra ); - if( 0 ) + if ( 0 ) { DBG_871X( "[%s] WiFi Direct is disable!\n", __FUNCTION__ ); return ret; @@ -4942,7 +4942,7 @@ static int rtw_p2p_prov_disc(struct net_device *dev, if (rtw_end_of_queue_search(phead,plist)== true) break; - if( uintPeerChannel != 0 ) + if ( uintPeerChannel != 0 ) break; pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); @@ -5039,11 +5039,11 @@ static int rtw_p2p_prov_disc(struct net_device *dev, rtw_p2p_set_pre_state(pwdinfo, rtw_p2p_state(pwdinfo)); rtw_p2p_set_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ); - if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT)) + if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT)) { memcpy( &pwdinfo->tx_prov_disc_info.ssid, &pnetwork->network.Ssid, sizeof( struct ndis_802_11_ssid ) ); } - else if(rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE) || rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) + else if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_DEVICE) || rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { memcpy( pwdinfo->tx_prov_disc_info.ssid.Ssid, pwdinfo->p2p_wildcard_ssid, P2P_WILDCARD_SSID_LEN ); pwdinfo->tx_prov_disc_info.ssid.SsidLength= P2P_WILDCARD_SSID_LEN; @@ -5365,7 +5365,7 @@ static int rtw_cta_test_start(struct net_device *dev, else padapter->in_cta_test = 0; - if(padapter->in_cta_test) + if (padapter->in_cta_test) { u32 v = rtw_read32(padapter, REG_RCR); v &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN );/* RCR_ADF */ @@ -5393,7 +5393,7 @@ static int rtw_rereg_nd_name(struct net_device *dev, struct rereg_nd_name_data *rereg_priv = &padapter->rereg_nd_name_priv; char new_ifname[IFNAMSIZ]; - if(rereg_priv->old_ifname[0] == 0) { + if (rereg_priv->old_ifname[0] == 0) { char *reg_ifname; reg_ifname = padapter->registrypriv.if2name; @@ -5401,23 +5401,23 @@ static int rtw_rereg_nd_name(struct net_device *dev, rereg_priv->old_ifname[IFNAMSIZ-1] = 0; } - if(wrqu->data.length > IFNAMSIZ) + if (wrqu->data.length > IFNAMSIZ) return -EFAULT; if ( copy_from_user(new_ifname, wrqu->data.pointer, IFNAMSIZ) ) { return -EFAULT; } - if( 0 == strcmp(rereg_priv->old_ifname, new_ifname) ) { + if ( 0 == strcmp(rereg_priv->old_ifname, new_ifname) ) { return ret; } DBG_871X("%s new_ifname:%s\n", __FUNCTION__, new_ifname); - if( 0 != (ret = rtw_change_ifname(padapter, new_ifname)) ) { + if ( 0 != (ret = rtw_change_ifname(padapter, new_ifname)) ) { goto exit; } - if(_rtw_memcmp(rereg_priv->old_ifname, "disable%d", 9) == true) { + if (_rtw_memcmp(rereg_priv->old_ifname, "disable%d", 9) == true) { padapter->ledpriv.bRegUseLed= rereg_priv->old_bRegUseLed; rtw_hal_sw_led_init(padapter); /* rtw_ips_mode_req(&padapter->pwrctrlpriv, rereg_priv->old_ips_mode); */ @@ -5426,7 +5426,7 @@ static int rtw_rereg_nd_name(struct net_device *dev, strncpy(rereg_priv->old_ifname, new_ifname, IFNAMSIZ); rereg_priv->old_ifname[IFNAMSIZ-1] = 0; - if(_rtw_memcmp(new_ifname, "disable%d", 9) == true) { + if (_rtw_memcmp(new_ifname, "disable%d", 9) == true) { DBG_871X("%s disable\n", __FUNCTION__); /* free network queue for Android's timming issue */ @@ -5449,15 +5449,15 @@ static void mac_reg_dump(struct adapter *padapter) printk("\n======= MAC REG =======\n"); for(i=0x0;i<0x300;i+=4) { - if(j%4==1) printk("0x%02x",i); + if (j%4==1) printk("0x%02x",i); printk(" 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) printk("\n"); + if ((j++)%4 == 0) printk("\n"); } for(i=0x400;i<0x800;i+=4) { - if(j%4==1) printk("0x%02x",i); + if (j%4==1) printk("0x%02x",i); printk(" 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) printk("\n"); + if ((j++)%4 == 0) printk("\n"); } } @@ -5467,10 +5467,10 @@ static void bb_reg_dump(struct adapter *padapter) printk("\n======= BB REG =======\n"); for(i=0x800;i<0x1000;i+=4) { - if(j%4==1) printk("0x%02x",i); + if (j%4==1) printk("0x%02x",i); printk(" 0x%08x ",rtw_read32(padapter,i)); - if((j++)%4 == 0) printk("\n"); + if ((j++)%4 == 0) printk("\n"); } } @@ -5482,7 +5482,7 @@ static void rf_reg_dump(struct adapter *padapter) rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); printk("\n======= RF REG =======\n"); - if((RF_1T2R == rf_type) ||(RF_1T1R ==rf_type )) + if ((RF_1T2R == rf_type) ||(RF_1T1R ==rf_type )) path_nums = 1; else path_nums = 2; @@ -5494,9 +5494,9 @@ static void rf_reg_dump(struct adapter *padapter) { /* value = PHY_QueryRFReg(padapter, (RF_RADIO_PATH_E)path,i, bMaskDWord); */ value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); - if(j%4==1) printk("0x%02x ",i); + if (j%4==1) printk("0x%02x ",i); printk(" 0x%08x ",value); - if((j++)%4==0) printk("\n"); + if ((j++)%4==0) printk("\n"); } } } @@ -5597,7 +5597,7 @@ static int rtw_dbg_port(struct net_device *dev, { struct xmit_frame *xmit_frame; - if((xmit_frame=rtw_IOL_accquire_xmit_frame(padapter)) == NULL) { + if ((xmit_frame=rtw_IOL_accquire_xmit_frame(padapter)) == NULL) { ret = -ENOMEM; break; } @@ -5605,7 +5605,7 @@ static int rtw_dbg_port(struct net_device *dev, rtw_IOL_append_LLT_cmd(xmit_frame, page_boundary); - if(_SUCCESS != rtw_IOL_exec_cmds_sync(padapter, xmit_frame, 500,0) ) + if (_SUCCESS != rtw_IOL_exec_cmds_sync(padapter, xmit_frame, 500,0) ) ret = -EPERM; } } @@ -5620,7 +5620,7 @@ static int rtw_dbg_port(struct net_device *dev, { struct xmit_frame *xmit_frame; - if((xmit_frame=rtw_IOL_accquire_xmit_frame(padapter)) == NULL) { + if ((xmit_frame=rtw_IOL_accquire_xmit_frame(padapter)) == NULL) { ret = -ENOMEM; break; } @@ -5631,7 +5631,7 @@ static int rtw_dbg_port(struct net_device *dev, rtw_IOL_append_WB_cmd(xmit_frame, reg, 0x08,0xff); rtw_IOL_append_DELAY_MS_cmd(xmit_frame, blink_delay_ms); } - if(_SUCCESS != rtw_IOL_exec_cmds_sync(padapter, xmit_frame, (blink_delay_ms*blink_num*2)+200,0) ) + if (_SUCCESS != rtw_IOL_exec_cmds_sync(padapter, xmit_frame, (blink_delay_ms*blink_num*2)+200,0) ) ret = -EPERM; } } @@ -5647,7 +5647,7 @@ static int rtw_dbg_port(struct net_device *dev, { struct xmit_frame *xmit_frame; - if((xmit_frame=rtw_IOL_accquire_xmit_frame(padapter)) == NULL) { + if ((xmit_frame=rtw_IOL_accquire_xmit_frame(padapter)) == NULL) { ret = -ENOMEM; break; } @@ -5655,11 +5655,11 @@ static int rtw_dbg_port(struct net_device *dev, for(i=0;inetwork.MacAddress); - if(psta) + if (psta) { int i; struct recv_reorder_ctrl *preorder_ctrl; @@ -5799,7 +5799,7 @@ static int rtw_dbg_port(struct net_device *dev, for(i=0;i<16;i++) { preorder_ctrl = &psta->recvreorder_ctrl[i]; - if(preorder_ctrl->enable) + if (preorder_ctrl->enable) { DBG_871X("tid=%d, indicate_seq=%d\n", i, preorder_ctrl->indicate_seq); } @@ -5861,7 +5861,7 @@ static int rtw_dbg_port(struct net_device *dev, plist = get_next(plist); - if(extra_arg == psta->aid) + if (extra_arg == psta->aid) { DBG_871X("sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->hwaddr)); DBG_871X("rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self); @@ -5886,7 +5886,7 @@ static int rtw_dbg_port(struct net_device *dev, for(j=0;j<16;j++) { preorder_ctrl = &psta->recvreorder_ctrl[j]; - if(preorder_ctrl->enable) + if (preorder_ctrl->enable) { DBG_871X("tid=%d, indicate_seq=%d\n", j, preorder_ctrl->indicate_seq); } @@ -5919,7 +5919,7 @@ static int rtw_dbg_port(struct net_device *dev, psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); plist = get_next(plist); - if(arg == 0xff){ + if (arg == 0xff){ psta->rx_bk_cnt =0; psta->rx_be_cnt =0; psta->rx_vo_cnt =0; @@ -5930,7 +5930,7 @@ static int rtw_dbg_port(struct net_device *dev, psta->tx_vi_cnt =0; } else{ - if(extra_arg == psta->mac_id) + if (extra_arg == psta->mac_id) { DBG_871X("=== sta's macaddr:" MAC_FMT "===\n", MAC_ARG(psta->hwaddr)); DBG_871X("rx_bk_cnt =%d\n", psta->rx_bk_cnt); @@ -5954,12 +5954,12 @@ static int rtw_dbg_port(struct net_device *dev, case 0x0c:/* dump rx/tx packet */ { - if(arg == 0){ + if (arg == 0){ DBG_871X("dump rx packet (%d)\n",extra_arg); /* pHalData->bDumpRxPkt =extra_arg; */ rtw_hal_set_def_var(padapter, HAL_DEF_DBG_DUMP_RXPKT, &(extra_arg)); } - else if(arg==1){ + else if (arg==1){ DBG_871X("dump tx packet (%d)\n",extra_arg); rtw_hal_set_def_var(padapter, HAL_DEF_DBG_DUMP_TXPKT, &(extra_arg)); } @@ -5967,7 +5967,7 @@ static int rtw_dbg_port(struct net_device *dev, break; case 0x0f: { - if(extra_arg == 0){ + if (extra_arg == 0){ DBG_871X("###### silent reset test.......#####\n"); rtw_hal_sreset_reset(padapter); } else { @@ -5997,7 +5997,7 @@ static int rtw_dbg_port(struct net_device *dev, struct registry_priv *pregpriv = &padapter->registrypriv; /* 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, 0x3: enable both 2.4g and 5g */ /* default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ */ - if( pregpriv && (extra_arg == 0 || extra_arg == 1|| extra_arg == 2 || extra_arg == 3)) + if ( pregpriv && (extra_arg == 0 || extra_arg == 1|| extra_arg == 2 || extra_arg == 3)) { pregpriv->rx_stbc= extra_arg; DBG_871X("set rx_stbc=%d\n",pregpriv->rx_stbc); @@ -6011,7 +6011,7 @@ static int rtw_dbg_port(struct net_device *dev, { struct registry_priv *pregpriv = &padapter->registrypriv; /* 0: disable, 0x1:enable (but wifi_spec should be 0), 0x2: force enable (don't care wifi_spec) */ - if( pregpriv && extra_arg >= 0 && extra_arg < 3 ) + if ( pregpriv && extra_arg >= 0 && extra_arg < 3 ) { pregpriv->ampdu_enable= extra_arg; DBG_871X("set ampdu_enable=%d\n",pregpriv->ampdu_enable); @@ -6030,7 +6030,7 @@ static int rtw_dbg_port(struct net_device *dev, break; case 0x16: { - if(arg == 0xff){ + if (arg == 0xff){ rtw_odm_dbg_comp_msg(padapter); } else{ @@ -6070,20 +6070,20 @@ static int rtw_dbg_port(struct net_device *dev, } case 0xaa: { - if(extra_arg> 0x13) extra_arg = 0xFF; + if (extra_arg> 0x13) extra_arg = 0xFF; DBG_871X("chang data rate to :0x%02x\n",extra_arg); padapter->fix_rate = extra_arg; } break; case 0xdd:/* registers dump , 0 for mac reg,1 for bb reg, 2 for rf reg */ { - if(extra_arg==0){ + if (extra_arg==0){ mac_reg_dump(padapter); } - else if(extra_arg==1){ + else if (extra_arg==1){ bb_reg_dump(padapter); } - else if(extra_arg==2){ + else if (extra_arg==2){ rf_reg_dump(padapter); } @@ -6094,7 +6094,7 @@ static int rtw_dbg_port(struct net_device *dev, { u32 odm_flag; - if(0xf==extra_arg){ + if (0xf==extra_arg){ rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DM_FUNC,&odm_flag); DBG_871X(" === DMFlag(0x%08x) ===\n",odm_flag); DBG_871X("extra_arg = 0 - disable all dynamic func\n"); @@ -6233,14 +6233,14 @@ static int wpa_mlme(struct net_device *dev, u32 command, u32 reason) { case IEEE_MLME_STA_DEAUTH: - if(!rtw_set_802_11_disassociate(padapter)) + if (!rtw_set_802_11_disassociate(padapter)) ret = -1; break; case IEEE_MLME_STA_DISASSOC: - if(!rtw_set_802_11_disassociate(padapter)) + if (!rtw_set_802_11_disassociate(padapter)) ret = -1; break; @@ -6334,7 +6334,7 @@ static u8 set_pairwise_key(struct adapter *padapter, struct sta_info *psta) } psetstakey_para = (struct set_stakey_parm*)rtw_zmalloc(sizeof(struct set_stakey_parm)); - if(psetstakey_para==NULL){ + if (psetstakey_para==NULL){ rtw_mfree((u8 *) ph2c, sizeof(struct cmd_obj)); res=_FAIL; goto exit; @@ -6369,12 +6369,12 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid) DBG_871X("%s\n", __FUNCTION__); pcmd = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); - if(pcmd==NULL){ + if (pcmd==NULL){ res= _FAIL; goto exit; } psetkeyparm=(struct setkey_parm*)rtw_zmalloc(sizeof(struct setkey_parm)); - if(psetkeyparm==NULL){ + if (psetkeyparm==NULL){ rtw_mfree((unsigned char *)pcmd, sizeof(struct cmd_obj)); res= _FAIL; goto exit; @@ -6482,7 +6482,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, else { psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if(!psta) + if (!psta) { /* ret = -EINVAL; */ DBG_871X("rtw_set_encryption(), sta has already been removed or never been added\n"); @@ -6509,7 +6509,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, DBG_871X("r871x_set_encryption, wep_key_idx=%d, len=%d\n", wep_key_idx, wep_key_len); - if((wep_key_idx >= WEP_KEYS) || (wep_key_len<=0)) + if ((wep_key_idx >= WEP_KEYS) || (wep_key_len<=0)) { ret = -EINVAL; goto exit; @@ -6521,7 +6521,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); pwep =(struct ndis_802_11_wep *)rtw_malloc(wep_total_len); - if(pwep == NULL){ + if (pwep == NULL){ DBG_871X(" r871x_set_encryption: pwep allocate fail !!!\n"); goto exit; } @@ -6537,7 +6537,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, memcpy(pwep->KeyMaterial, param->u.crypt.key, pwep->KeyLength); - if(param->u.crypt.set_tx) + if (param->u.crypt.set_tx) { DBG_871X("wep, set_tx=1\n"); @@ -6575,24 +6575,24 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, } - if(!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) /* group key */ + if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) /* group key */ { - if(param->u.crypt.set_tx ==1) + if (param->u.crypt.set_tx ==1) { - if(strcmp(param->u.crypt.alg, "WEP") == 0) + if (strcmp(param->u.crypt.alg, "WEP") == 0) { DBG_871X("%s, set group_key, WEP\n", __FUNCTION__); memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if(param->u.crypt.key_len==13) + if (param->u.crypt.key_len==13) { psecuritypriv->dot118021XGrpPrivacy = _WEP104_; } } - else if(strcmp(param->u.crypt.alg, "TKIP") == 0) + else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { DBG_871X("%s, set group_key, TKIP\n", __FUNCTION__); @@ -6608,7 +6608,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->busetkipkey = true; } - else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { DBG_871X("%s, set group_key, CCMP\n", __FUNCTION__); @@ -6632,7 +6632,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); pbcmc_sta=rtw_get_bcmc_stainfo(padapter); - if(pbcmc_sta) + if (pbcmc_sta) { pbcmc_sta->ieee8021x_blocked = false; pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ @@ -6644,25 +6644,25 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, } - if(psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) /* psk/802_1x */ + if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) /* psk/802_1x */ { - if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - if(param->u.crypt.set_tx ==1) + if (param->u.crypt.set_tx ==1) { memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - if(strcmp(param->u.crypt.alg, "WEP") == 0) + if (strcmp(param->u.crypt.alg, "WEP") == 0) { DBG_871X("%s, set pairwise key, WEP\n", __FUNCTION__); psta->dot118021XPrivacy = _WEP40_; - if(param->u.crypt.key_len==13) + if (param->u.crypt.key_len==13) { psta->dot118021XPrivacy = _WEP104_; } } - else if(strcmp(param->u.crypt.alg, "TKIP") == 0) + else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { DBG_871X("%s, set pairwise key, TKIP\n", __FUNCTION__); @@ -6676,7 +6676,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->busetkipkey = true; } - else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { DBG_871X("%s, set pairwise key, CCMP\n", __FUNCTION__); @@ -6697,17 +6697,17 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, } else/* group key??? */ { - if(strcmp(param->u.crypt.alg, "WEP") == 0) + if (strcmp(param->u.crypt.alg, "WEP") == 0) { memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if(param->u.crypt.key_len==13) + if (param->u.crypt.key_len==13) { psecuritypriv->dot118021XGrpPrivacy = _WEP104_; } } - else if(strcmp(param->u.crypt.alg, "TKIP") == 0) + else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { psecuritypriv->dot118021XGrpPrivacy = _TKIP_; @@ -6721,7 +6721,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->busetkipkey = true; } - else if(strcmp(param->u.crypt.alg, "CCMP") == 0) + else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { psecuritypriv->dot118021XGrpPrivacy = _AES_; @@ -6741,7 +6741,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); pbcmc_sta=rtw_get_bcmc_stainfo(padapter); - if(pbcmc_sta) + if (pbcmc_sta) { pbcmc_sta->ieee8021x_blocked = false; pbcmc_sta->dot118021XPrivacy= psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ @@ -6755,7 +6755,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, exit: - if(pwep) + if (pwep) { rtw_mfree((u8 *)pwep, wep_total_len); } @@ -6775,16 +6775,16 @@ static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int DBG_871X("%s, len=%d\n", __FUNCTION__, len); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) return -EINVAL; memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); - if((pstapriv->max_num_sta>NUM_STA) || (pstapriv->max_num_sta<=0)) + if ((pstapriv->max_num_sta>NUM_STA) || (pstapriv->max_num_sta<=0)) pstapriv->max_num_sta = NUM_STA; - if(rtw_check_beacon_data(padapter, pbuf, (len-12-2)) == _SUCCESS)/* 12 = param header, 2:no packed */ + if (rtw_check_beacon_data(padapter, pbuf, (len-12-2)) == _SUCCESS)/* 12 = param header, 2:no packed */ ret = 0; else ret = -EINVAL; @@ -6820,7 +6820,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) DBG_871X("rtw_add_sta(aid=%d)=" MAC_FMT "\n", param->u.add_sta.aid, MAC_ARG(param->sta_addr)); - if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) + if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) { return -EINVAL; } @@ -6833,7 +6833,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) } psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if(psta) + if (psta) { int flags = param->u.add_sta.flags; @@ -6841,17 +6841,17 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) memcpy(psta->bssrateset, param->u.add_sta.tx_supp_rates, 16); /* check wmm cap. */ - if(WLAN_STA_WME&flags) + if (WLAN_STA_WME&flags) psta->qos_option = 1; else psta->qos_option = 0; - if(pmlmepriv->qospriv.qos_option == 0) + if (pmlmepriv->qospriv.qos_option == 0) psta->qos_option = 0; /* chec 802.11n ht cap. */ - if(WLAN_STA_HT&flags) + if (WLAN_STA_HT&flags) { psta->htpriv.ht_option = true; psta->qos_option = 1; @@ -6862,7 +6862,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) psta->htpriv.ht_option = false; } - if(pmlmepriv->htpriv.ht_option == false) + if (pmlmepriv->htpriv.ht_option == false) psta->htpriv.ht_option = false; update_sta_info_apmode(padapter, psta); @@ -6887,7 +6887,7 @@ static int rtw_del_sta(struct net_device *dev, struct ieee_param *param) DBG_871X("rtw_del_sta=" MAC_FMT "\n", MAC_ARG(param->sta_addr)); - if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) + if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) { return -EINVAL; } @@ -6900,12 +6900,12 @@ static int rtw_del_sta(struct net_device *dev, struct ieee_param *param) } psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if(psta) + if (psta) { u8 updated; spin_lock_bh(&pstapriv->asoc_list_lock); - if(rtw_is_list_empty(&psta->asoc_list)==false) + if (rtw_is_list_empty(&psta->asoc_list)==false) { rtw_list_delete(&psta->asoc_list); pstapriv->asoc_list_cnt--; @@ -6942,7 +6942,7 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par DBG_871X("rtw_ioctl_get_sta_info, sta_addr: " MAC_FMT "\n", MAC_ARG(param_ex->sta_addr)); - if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) + if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) { return -EINVAL; } @@ -6955,7 +6955,7 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par } psta = rtw_get_stainfo(pstapriv, param_ex->sta_addr); - if(psta) + if (psta) { psta_data->aid = (u16)psta->aid; psta_data->capability = psta->capability; @@ -6999,7 +6999,7 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) DBG_871X("rtw_get_sta_wpaie, sta_addr: " MAC_FMT "\n", MAC_ARG(param->sta_addr)); - if(check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) + if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) { return -EINVAL; } @@ -7012,9 +7012,9 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) } psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if(psta) + if (psta) { - if((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == WLAN_EID_GENERIC)) + if ((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == WLAN_EID_GENERIC)) { int wpa_ie_len; int copy_len; @@ -7054,19 +7054,19 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, DBG_871X("%s, len=%d\n", __FUNCTION__, len); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) return -EINVAL; ie_len = len-12-2;/* 12 = param header, 2:no packed */ - if(pmlmepriv->wps_beacon_ie) + if (pmlmepriv->wps_beacon_ie) { rtw_mfree(pmlmepriv->wps_beacon_ie, pmlmepriv->wps_beacon_ie_len); pmlmepriv->wps_beacon_ie = NULL; } - if(ie_len>0) + if (ie_len>0) { pmlmepriv->wps_beacon_ie = rtw_malloc(ie_len); pmlmepriv->wps_beacon_ie_len = ie_len; @@ -7097,19 +7097,19 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par DBG_871X("%s, len=%d\n", __FUNCTION__, len); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) return -EINVAL; ie_len = len-12-2;/* 12 = param header, 2:no packed */ - if(pmlmepriv->wps_probe_resp_ie) + if (pmlmepriv->wps_probe_resp_ie) { rtw_mfree(pmlmepriv->wps_probe_resp_ie, pmlmepriv->wps_probe_resp_ie_len); pmlmepriv->wps_probe_resp_ie = NULL; } - if(ie_len>0) + if (ie_len>0) { pmlmepriv->wps_probe_resp_ie = rtw_malloc(ie_len); pmlmepriv->wps_probe_resp_ie_len = ie_len; @@ -7134,19 +7134,19 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par DBG_871X("%s, len=%d\n", __FUNCTION__, len); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) return -EINVAL; ie_len = len-12-2;/* 12 = param header, 2:no packed */ - if(pmlmepriv->wps_assoc_resp_ie) + if (pmlmepriv->wps_assoc_resp_ie) { rtw_mfree(pmlmepriv->wps_assoc_resp_ie, pmlmepriv->wps_assoc_resp_ie_len); pmlmepriv->wps_assoc_resp_ie = NULL; } - if(ie_len>0) + if (ie_len>0) { pmlmepriv->wps_assoc_resp_ie = rtw_malloc(ie_len); pmlmepriv->wps_assoc_resp_ie_len = ie_len; @@ -7176,7 +7176,7 @@ static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param, sint ssid_len; u8 ignore_broadcast_ssid; - if(check_fwstate(mlmepriv, WIFI_AP_STATE) != true) + if (check_fwstate(mlmepriv, WIFI_AP_STATE) != true) return -EPERM; if (param->u.bcn_ie.reserved[0] != 0xea) @@ -7212,7 +7212,7 @@ static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *p struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) return -EINVAL; if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && @@ -7234,7 +7234,7 @@ static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *para struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) return -EINVAL; if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && @@ -7256,7 +7256,7 @@ static int rtw_ioctl_set_macaddr_acl(struct net_device *dev, struct ieee_param * struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) return -EINVAL; rtw_set_macaddr_acl(padapter, param->u.mlme.command); @@ -7284,7 +7284,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) /* if (p->length < sizeof(struct ieee_param) || !p->pointer){ */ - if(!p->pointer){ + if (!p->pointer){ ret = -EINVAL; goto out; } @@ -7431,7 +7431,7 @@ static int rtw_wx_set_priv(struct net_device *dev, struct iw_point *dwrq = (struct iw_point*)awrq; /* RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_notice_, ("+rtw_wx_set_priv\n")); */ - if(dwrq->length == 0) + if (dwrq->length == 0) return -EFAULT; len = dwrq->length; @@ -7459,7 +7459,7 @@ static int rtw_wx_set_priv(struct net_device *dev, #endif /* added for wps2.0 @20110524 */ - if(dwrq->flags == 0x8766 && len > 8) + if (dwrq->flags == 0x8766 && len > 8) { u32 cp_sz; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -7467,14 +7467,14 @@ static int rtw_wx_set_priv(struct net_device *dev, int probereq_wpsie_len = len; u8 wps_oui[4]={0x0,0x50,0xf2,0x04}; - if((_VENDOR_SPECIFIC_IE_ == probereq_wpsie[0]) && + if ((_VENDOR_SPECIFIC_IE_ == probereq_wpsie[0]) && (_rtw_memcmp(&probereq_wpsie[2], wps_oui, 4) ==true)) { cp_sz = probereq_wpsie_len>MAX_WPS_IE_LEN ? MAX_WPS_IE_LEN:probereq_wpsie_len; /* memcpy(pmlmepriv->probereq_wpsie, probereq_wpsie, cp_sz); */ /* pmlmepriv->probereq_wpsie_len = cp_sz; */ - if(pmlmepriv->wps_probe_req_ie) + if (pmlmepriv->wps_probe_req_ie) { u32 free_len = pmlmepriv->wps_probe_req_ie_len; pmlmepriv->wps_probe_req_ie_len = 0; @@ -7499,7 +7499,7 @@ static int rtw_wx_set_priv(struct net_device *dev, } - if( len >= WEXT_CSCAN_HEADER_SIZE + if ( len >= WEXT_CSCAN_HEADER_SIZE && _rtw_memcmp(ext, WEXT_CSCAN_HEADER, WEXT_CSCAN_HEADER_SIZE) == true ){ ret = rtw_wx_set_scan(dev, info, awrq, ext); @@ -7523,7 +7523,7 @@ static int rtw_wx_set_priv(struct net_device *dev, struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct wlan_network *pcur_network = &pmlmepriv->cur_network; - if(check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { sprintf(ext, "%s rssi %d", pcur_network->network.Ssid.Ssid, padapter->recvpriv.rssi); } else { sprintf(ext, "OK"); @@ -7686,7 +7686,7 @@ static int rtw_mp_efuse_get(struct net_device *dev, } padapter->registrypriv.fw_iol = 0;/* 0:Disable, 1:enable, 2:by usb speed */ - if(strcmp(tmp[0], "status") == 0){ + if (strcmp(tmp[0], "status") == 0){ sprintf(extra, "Load File efuse=%s,Load File MAC=%s",(pEEPROM->bloadfile_fail_flag? "FAIL" : "OK"),(pEEPROM->bloadmac_fail_flag? "FAIL" : "OK")); goto exit; } diff --git a/os_dep/mlme_linux.c b/os_dep/mlme_linux.c index 609d5cf..84eb038 100644 --- a/os_dep/mlme_linux.c +++ b/os_dep/mlme_linux.c @@ -86,7 +86,7 @@ void rtw_os_indicate_connect(struct adapter *adapter) rtw_indicate_wx_assoc_event(adapter); netif_carrier_on(adapter->pnetdev); - if(adapter->pid[2] !=0) + if (adapter->pid[2] !=0) rtw_signal_process(adapter->pid[2], SIGALRM); } @@ -108,7 +108,7 @@ void rtw_reset_securitypriv( struct adapter *adapter ) spin_lock_bh(&adapter->security_key_mutex); - if(adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)/* 802.1x */ + if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)/* 802.1x */ { /* Added by Albert 2009/02/18 */ /* We have to backup the PMK information for WiFi PMK Caching test item. */ @@ -142,7 +142,7 @@ void rtw_reset_securitypriv( struct adapter *adapter ) } else /* reset values in securitypriv */ { - /* if(adapter->mlmepriv.fw_state & WIFI_STATION_STATE) */ + /* if (adapter->mlmepriv.fw_state & WIFI_STATION_STATE) */ /* */ struct security_priv *psec_priv=&adapter->securitypriv; @@ -182,7 +182,7 @@ void rtw_report_sec_ie(struct adapter *adapter,u8 authmode,u8 *sec_ie) RT_TRACE(_module_mlme_osdep_c_,_drv_info_,("+rtw_report_sec_ie, authmode=%d\n", authmode)); buff = NULL; - if(authmode==_WPA_IE_ID_) { + if (authmode==_WPA_IE_ID_) { RT_TRACE(_module_mlme_osdep_c_,_drv_info_,("rtw_report_sec_ie, authmode=%d\n", authmode)); buff = rtw_malloc(IW_CUSTOM_MAX); @@ -208,7 +208,7 @@ void rtw_report_sec_ie(struct adapter *adapter,u8 authmode,u8 *sec_ie) wrqu.data.length = (wrqu.data.lengthstapriv; - if(psta==NULL) + if (psta==NULL) return; - if(psta->aid > NUM_STA) + if (psta->aid > NUM_STA) return; - if(pstapriv->sta_aid[psta->aid - 1] != psta) + if (pstapriv->sta_aid[psta->aid - 1] != psta) return; @@ -304,13 +304,13 @@ void rtw_indicate_sta_disassoc_event(struct adapter *padapter, struct sta_info * union iwreq_data wrqu; struct sta_priv *pstapriv = &padapter->stapriv; - if(psta==NULL) + if (psta==NULL) return; - if(psta->aid > NUM_STA) + if (psta->aid > NUM_STA) return; - if(pstapriv->sta_aid[psta->aid - 1] != psta) + if (pstapriv->sta_aid[psta->aid - 1] != psta) return; @@ -342,7 +342,7 @@ static int mgnt_netdev_open(struct net_device *pnetdev) init_usb_anchor(&phostapdpriv->anchored); - if(!rtw_netif_queue_stopped(pnetdev)) + if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_start_queue(pnetdev); else rtw_netif_wake_queue(pnetdev); @@ -419,7 +419,7 @@ int hostapd_mode_init(struct adapter *padapter) pnetdev->watchdog_timeo = HZ; /* 1 second timeout */ - if(dev_alloc_name(pnetdev,"mgnt.wlan%d") < 0) + if (dev_alloc_name(pnetdev,"mgnt.wlan%d") < 0) DBG_871X("hostapd_mode_init(): dev_alloc_name, fail!\n"); mac[0]=0x00; @@ -438,7 +438,7 @@ int hostapd_mode_init(struct adapter *padapter) /* Tell the network stack we exist */ if (register_netdev(pnetdev) != 0) { DBG_871X("hostapd_mode_init(): register_netdev fail!\n"); - if(pnetdev) + if (pnetdev) rtw_free_netdev(pnetdev); } return 0; diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 4f5dba5..486bb1b 100644 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -358,7 +358,7 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p) struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct sockaddr *addr = p; - if(padapter->bup == false) + if (padapter->bup == false) { /* DBG_871X("r8711_net_set_mac_address(), MAC=%x:%x:%x:%x:%x:%x\n", addr->sa_data[0], addr->sa_data[1], addr->sa_data[2], addr->sa_data[3], */ /* addr->sa_data[4], addr->sa_data[5]); */ @@ -435,7 +435,7 @@ static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb skb->priority = rtw_classify8021d(skb); - if(pmlmepriv->acm_mask != 0) + if (pmlmepriv->acm_mask != 0) { skb->priority = qos_acm(pmlmepriv->acm_mask, skb->priority); } @@ -500,7 +500,7 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) struct adapter *TargetAdapter = NULL; struct net *devnet = NULL; - if(padapter->bDongle == 1) + if (padapter->bDongle == 1) { #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) TargetNetdev = dev_get_by_name("wlan0"); @@ -512,7 +512,7 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) #endif TargetNetdev = dev_get_by_name(devnet, "wlan0"); #endif - if(TargetNetdev) { + if (TargetNetdev) { DBG_871X("Force onboard module driver disappear !!!\n"); TargetAdapter = rtw_netdev_priv(TargetNetdev); TargetAdapter->DriverState = DRIVER_DISAPPEAR; @@ -524,7 +524,7 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) dev_put(TargetNetdev); unregister_netdev(TargetNetdev); - if(TargetAdapter->chip_type == padapter->chip_type) + if (TargetAdapter->chip_type == padapter->chip_type) rtw_proc_remove_one(TargetNetdev); padapter->DriverState = DRIVER_REPLACE_DONGLE; @@ -532,7 +532,7 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) } #endif - if(dev_alloc_name(pnetdev, ifname) < 0) + if (dev_alloc_name(pnetdev, ifname) < 0) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("dev_alloc_name, fail!\n")); } @@ -550,7 +550,7 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter) RT_TRACE(_module_os_intfs_c_,_drv_info_,("+init_net_dev\n")); - if(old_padapter != NULL) + if (old_padapter != NULL) pnetdev = rtw_alloc_etherdev_with_old_priv(sizeof(struct adapter), (void *)old_padapter); else pnetdev = rtw_alloc_etherdev(sizeof(struct adapter)); @@ -597,7 +597,7 @@ u32 rtw_start_drv_threads(struct adapter *padapter) RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_start_drv_threads\n")); padapter->cmdThread = kthread_run(rtw_cmd_thread, padapter, "RTW_CMD_THREAD"); - if(IS_ERR(padapter->cmdThread)) + if (IS_ERR(padapter->cmdThread)) _status = _FAIL; else _rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema); /* wait for cmd_thread to run */ @@ -623,7 +623,7 @@ void rtw_unregister_netdevs(struct dvobj_priv *dvobj) pnetdev = padapter->pnetdev; - if((padapter->DriverState != DRIVER_DISAPPEAR) && pnetdev) { + if ((padapter->DriverState != DRIVER_DISAPPEAR) && pnetdev) { unregister_netdev(pnetdev); /* will call netdev_close() */ rtw_proc_remove_one(pnetdev); @@ -791,26 +791,26 @@ u8 rtw_init_drv_sw(struct adapter *padapter) reset_global_wifidirect_info(padapter); rtw_init_cfg80211_wifidirect_info(padapter); #ifdef CONFIG_P2P - if(rtw_init_wifi_display_info(padapter) == _FAIL) + if (rtw_init_wifi_display_info(padapter) == _FAIL) RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init init_wifi_display_info\n")); #endif #endif /* CONFIG_P2P */ - if(init_mlme_ext_priv(padapter) == _FAIL) + if (init_mlme_ext_priv(padapter) == _FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init mlme_ext_priv\n")); ret8=_FAIL; goto exit; } - if(_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) + if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) { DBG_871X("Can't _rtw_init_xmit_priv\n"); ret8=_FAIL; goto exit; } - if(_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) + if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { DBG_871X("Can't _rtw_init_recv_priv\n"); ret8=_FAIL; @@ -824,7 +824,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter) /* _init_timer(&(padapter->securitypriv.tkip_timer), padapter->pifp, rtw_use_tkipkey_handler, padapter); */ - if(_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) + if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) { DBG_871X("Can't _rtw_init_sta_priv\n"); ret8=_FAIL; @@ -904,7 +904,7 @@ u8 rtw_free_drv_sw(struct adapter *padapter) #ifdef CONFIG_P2P { struct wifidirect_info *pwdinfo = &padapter->wdinfo; - if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { _cancel_timer_ex( &pwdinfo->find_phase_timer ); _cancel_timer_ex( &pwdinfo->restore_p2p_state_timer ); @@ -947,13 +947,13 @@ u8 rtw_free_drv_sw(struct adapter *padapter) RT_TRACE(_module_os_intfs_c_,_drv_info_,("<==rtw_free_drv_sw\n")); /* free the old_pnetdev */ - if(padapter->rereg_nd_name_priv.old_pnetdev) { + if (padapter->rereg_nd_name_priv.old_pnetdev) { free_netdev(padapter->rereg_nd_name_priv.old_pnetdev); padapter->rereg_nd_name_priv.old_pnetdev = NULL; } /* clear pbuddy_adapter to avoid access wrong pointer. */ - if(padapter->pbuddy_adapter != NULL) { + if (padapter->pbuddy_adapter != NULL) { padapter->pbuddy_adapter->pbuddy_adapter = NULL; } @@ -972,7 +972,7 @@ void netdev_br_init(struct net_device *netdev) rcu_read_lock(); #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) */ - /* if(check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) */ + /* if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) */ { /* struct net_bridge *br = netdev->br_port->br;->dev->dev_addr; */ #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) @@ -1035,7 +1035,7 @@ static int _rtw_drv_register_netdev(struct adapter *padapter, char *name) error_register_netdev: - if(padapter->iface_id > IFACE_ID0) + if (padapter->iface_id > IFACE_ID0) { rtw_free_drv_sw(padapter); @@ -1050,24 +1050,24 @@ int rtw_drv_register_netdev(struct adapter *if1) int i, status = _SUCCESS; struct dvobj_priv *dvobj = if1->dvobj; - if(dvobj->iface_nums < IFACE_ID_MAX) + if (dvobj->iface_nums < IFACE_ID_MAX) { for(i=0; iiface_nums; i++) { struct adapter *padapter = dvobj->padapters[i]; - if(padapter) + if (padapter) { char *name; - if(padapter->iface_id == IFACE_ID0) + if (padapter->iface_id == IFACE_ID0) name = if1->registrypriv.ifname; - else if(padapter->iface_id == IFACE_ID1) + else if (padapter->iface_id == IFACE_ID1) name = if1->registrypriv.if2name; else name = "wlan%d"; - if((status = _rtw_drv_register_netdev(padapter, name)) != _SUCCESS) { + if ((status = _rtw_drv_register_netdev(padapter, name)) != _SUCCESS) { break; } } @@ -1086,12 +1086,12 @@ int _netdev_open(struct net_device *pnetdev) RT_TRACE(_module_os_intfs_c_,_drv_info_,("+871x_drv - dev_open\n")); DBG_871X("+871x_drv - drv_open, bup=%d\n", padapter->bup); - if(pwrctrlpriv->ps_flag == true){ + if (pwrctrlpriv->ps_flag == true){ padapter->net_closed = false; goto netdev_open_normal_process; } - if(padapter->bup == false) + if (padapter->bup == false) { padapter->bDriverStopped = false; padapter->bSurpriseRemoved = false; @@ -1107,7 +1107,7 @@ int _netdev_open(struct net_device *pnetdev) DBG_871X("MAC Address = "MAC_FMT"\n", MAC_ARG(pnetdev->dev_addr)); status=rtw_start_drv_threads(padapter); - if(status ==_FAIL) + if (status ==_FAIL) { DBG_871X("Initialize driver software resource Failed!\n"); goto netdev_open_error; @@ -1117,7 +1117,7 @@ int _netdev_open(struct net_device *pnetdev) init_drvext(padapter); #endif - if(padapter->intf_start) + if (padapter->intf_start) { padapter->intf_start(padapter); } @@ -1139,7 +1139,7 @@ int _netdev_open(struct net_device *pnetdev) rtw_set_pwr_state_check_timer(pwrctrlpriv); /* netif_carrier_on(pnetdev);call this func when rtw_joinbss_event_callback return success */ - if(!rtw_netif_queue_stopped(pnetdev)) + if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_start_queue(pnetdev); else rtw_netif_wake_queue(pnetdev); @@ -1198,7 +1198,7 @@ static int ips_netdrv_open(struct adapter *padapter) goto netdev_open_error; } - if(padapter->intf_start) + if (padapter->intf_start) padapter->intf_start(padapter); rtw_set_pwr_state_check_timer(adapter_to_pwrctl(padapter)); @@ -1253,13 +1253,13 @@ void rtw_ips_dev_unload(struct adapter *padapter) rtw_hal_set_hwreg(padapter, HW_VAR_FIFO_CLEARN_UP, NULL); - if(padapter->intf_stop) + if (padapter->intf_stop) { padapter->intf_stop(padapter); } /* s5. */ - if(padapter->bSurpriseRemoved == false) + if (padapter->bSurpriseRemoved == false) { rtw_hal_deinit(padapter); } @@ -1285,19 +1285,19 @@ static int netdev_close(struct net_device *pnetdev) RT_TRACE(_module_os_intfs_c_,_drv_info_,("+871x_drv - drv_close\n")); - if(adapter_to_pwrctl(padapter)->bInternalAutoSuspend == true) + if (adapter_to_pwrctl(padapter)->bInternalAutoSuspend == true) { /* rtw_pwr_wakeup(padapter); */ - if(adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off) + if (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off) adapter_to_pwrctl(padapter)->ps_flag = true; } padapter->net_closed = true; - if(adapter_to_pwrctl(padapter)->rf_pwrstate == rf_on){ + if (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_on){ DBG_871X("(2)871x_drv - drv_close, bup=%d, hw_init_completed=%d\n", padapter->bup, padapter->hw_init_completed); /* s1. */ - if(pnetdev) + if (pnetdev) { if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_stop_queue(pnetdev); @@ -1498,7 +1498,7 @@ restart: memset(&rt_info, 0, sizeof(struct route_info)); parse_routes(h, &rt_info); - if(!rt_info.dst_addr.s_addr && rt_info.gateway.s_addr && rt_info.dev_index) + if (!rt_info.dst_addr.s_addr && rt_info.gateway.s_addr && rt_info.dev_index) { *gw_addr = rt_info.gateway.s_addr; *gw_index = rt_info.dev_index; @@ -1574,7 +1574,7 @@ static int get_defaultgw(u32 *ip_addr ,char mac[]) route_dump(ip_addr, &gw_index); - if( !(*ip_addr) || !gw_index ) + if ( !(*ip_addr) || !gw_index ) { /* DBG_871X("No default GW\n"); */ return -1; @@ -1582,13 +1582,13 @@ static int get_defaultgw(u32 *ip_addr ,char mac[]) gw_dev = dev_get_by_index(&init_net, gw_index); - if(gw_dev == NULL) + if (gw_dev == NULL) { /* DBG_871X("get Oif Device Fail\n"); */ return -1; } - if(!arp_query(mac, *ip_addr, gw_dev)) + if (!arp_query(mac, *ip_addr, gw_dev)) { /* DBG_871X( "arp query failed\n"); */ dev_put(gw_dev); @@ -1609,7 +1609,7 @@ int rtw_gw_addr_query(struct adapter *padapter) int res; res = get_defaultgw(&gw_addr, gw_mac); - if(!res) + if (!res) { pmlmepriv->gw_ip[0] = gw_addr&0xff; pmlmepriv->gw_ip[1] = (gw_addr&0xff00)>>8; @@ -1637,12 +1637,12 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); rtw_cancel_all_timer(padapter); - if(pnetdev){ + if (pnetdev){ netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); } - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) && rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) && rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { DBG_871X("%s %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n",__FUNCTION__, pmlmepriv->cur_network.network.Ssid.Ssid, @@ -1652,17 +1652,17 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) rtw_set_roaming(padapter, 1); } - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) { rtw_disassoc_cmd(padapter, 0, false); } #ifdef CONFIG_AP_MODE - else if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) + else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { rtw_sta_flush(padapter); } #endif - if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) ){ + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) ){ /* s2-2. indicate disconnect to os */ rtw_indicate_disconnect(padapter); } @@ -1672,11 +1672,11 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) /* s2-4. */ #ifdef CONFIG_AUTOSUSPEND - if(is_primary_adapter(padapter) && (!adapter_to_pwrctl(padapter)->bInternalAutoSuspend )) + if (is_primary_adapter(padapter) && (!adapter_to_pwrctl(padapter)->bInternalAutoSuspend )) #endif rtw_free_network_queue(padapter, true); - if(check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) rtw_indicate_scan_done(padapter, 1); DBG_871X("==> "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); @@ -1715,7 +1715,7 @@ int rtw_resume_common(struct adapter *padapter) pwrpriv->bkeepfwalive = false; DBG_871X("bkeepfwalive(%x)\n",pwrpriv->bkeepfwalive); - if(pm_netdev_open(pnetdev,true) != 0) { + if (pm_netdev_open(pnetdev,true) != 0) { DBG_871X("%s ==> pm_netdev_open failed\n",__FUNCTION__); ret = -1; return ret; diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index a3bec2f..11b4d2c 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -35,7 +35,7 @@ * @return: one of RTW_STATUS_CODE */ inline int RTW_STATUS_CODE(int error_code){ - if(error_code >=0) + if (error_code >=0) return _SUCCESS; switch(error_code) { @@ -52,15 +52,15 @@ u32 rtw_atoi(u8* s) int num=0,flag=0; int i; for(i=0;i<=strlen(s);i++) { - if(s[i] >= '0' && s[i] <= '9') + if (s[i] >= '0' && s[i] <= '9') num = num * 10 + s[i] -'0'; - else if(s[0] == '-' && i==0) + else if (s[0] == '-' && i==0) flag =1; else break; } - if(flag == 1) + if (flag == 1) num = num * -1; return num; @@ -235,7 +235,7 @@ void rtw_mstat_update(const enum mstat_f flags, const MSTAT_STATUS status, u32 s int i; /* initialization */ - if(!update_time) { + if (!update_time) { for(i=0;i=153 && sz<=306) */ + /* if (sz>=153 && sz<=306) */ /* DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); */ - /* if((sz)>4096) */ + /* if ((sz)>4096) */ /* DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); */ p=_rtw_malloc((sz)); @@ -358,10 +358,10 @@ inline u8* dbg_rtw_zmalloc(u32 sz, const enum mstat_f flags, const char *func, c { u8 *p; - /* if(sz>=153 && sz<=306) */ + /* if (sz>=153 && sz<=306) */ /* DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); */ - /* if((sz)>4096) */ + /* if ((sz)>4096) */ /* DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); */ p = _rtw_zmalloc((sz)); @@ -377,10 +377,10 @@ inline u8* dbg_rtw_zmalloc(u32 sz, const enum mstat_f flags, const char *func, c inline void dbg_rtw_mfree(u8 *pbuf, u32 sz, const enum mstat_f flags, const char *func, const int line) { - /* if(sz>=153 && sz<=306) */ + /* if (sz>=153 && sz<=306) */ /* DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d)\n", func, line, __FUNCTION__, (sz)); */ - /* if((sz)>4096) */ + /* if ((sz)>4096) */ /* DBG_871X("DBG_MEM_ALLOC %s:%d %s(%p,%d)\n", func, line, __FUNCTION__, (pbuf), (sz)); */ _rtw_mfree((pbuf), (sz)); @@ -399,10 +399,10 @@ inline struct sk_buff * dbg_rtw_skb_alloc(unsigned int size, const enum mstat_f skb = _rtw_skb_alloc(size); - if(skb) + if (skb) truesize = skb->truesize; - if(!skb || truesize < size /*|| size > 4096*/) + if (!skb || truesize < size /*|| size > 4096*/) DBG_871X("DBG_MEM_ALLOC %s:%d %s(%d), skb:%p, truesize=%u\n", func, line, __FUNCTION__, size, skb, truesize); rtw_mstat_update( @@ -418,7 +418,7 @@ inline void dbg_rtw_skb_free(struct sk_buff *skb, const enum mstat_f flags, cons { unsigned int truesize = skb->truesize; - /* if(truesize > 4096) */ + /* if (truesize > 4096) */ /* DBG_871X("DBG_MEM_ALLOC %s:%d %s, truesize=%u\n", func, line, __FUNCTION__, truesize); */ _rtw_skb_free(skb); @@ -437,10 +437,10 @@ inline struct sk_buff *dbg_rtw_skb_copy(const struct sk_buff *skb, const enum ms unsigned int cp_truesize = 0; skb_cp = _rtw_skb_copy(skb); - if(skb_cp) + if (skb_cp) cp_truesize = skb_cp->truesize; - if(!skb_cp || cp_truesize != truesize /*||cp_truesize > 4096*/) + if (!skb_cp || cp_truesize != truesize /*||cp_truesize > 4096*/) DBG_871X("DBG_MEM_ALLOC %s:%d %s(%u), skb_cp:%p, cp_truesize=%u\n", func, line, __FUNCTION__, truesize, skb_cp, cp_truesize); rtw_mstat_update( @@ -459,10 +459,10 @@ inline struct sk_buff *dbg_rtw_skb_clone(struct sk_buff *skb, const enum mstat_f unsigned int cl_truesize = 0; skb_cl = _rtw_skb_clone(skb); - if(skb_cl) + if (skb_cl) cl_truesize = skb_cl->truesize; - if(!skb_cl || cl_truesize != truesize /*|| cl_truesize > 4096*/) + if (!skb_cl || cl_truesize != truesize /*|| cl_truesize > 4096*/) DBG_871X("DBG_MEM_ALLOC %s:%d %s(%u), skb_cl:%p, cl_truesize=%u\n", func, line, __FUNCTION__, truesize, skb_cl, cl_truesize); rtw_mstat_update( @@ -479,7 +479,7 @@ inline int dbg_rtw_netif_rx(struct net_device * ndev, struct sk_buff *skb, cons int ret; unsigned int truesize = skb->truesize; - /* if(truesize > 4096) */ + /* if (truesize > 4096) */ /* DBG_871X("DBG_MEM_ALLOC %s:%d %s, truesize=%u\n", func, line, __FUNCTION__, truesize); */ ret = _rtw_netif_rx(ndev, skb); @@ -536,7 +536,7 @@ void* rtw_malloc2d(int h, int w, int size) int j; void **a = (void **) rtw_zmalloc( h*sizeof(void *) + h*w*size ); - if(a == NULL) + if (a == NULL) { DBG_871X("%s: alloc memory fail!\n", __FUNCTION__); return NULL; @@ -892,7 +892,7 @@ static int openFile(struct file **fpp, char *path, int flag, int mode) struct file *fp; fp=filp_open(path, flag, mode); - if(IS_ERR(fp)) { + if (IS_ERR(fp)) { *fpp=NULL; return PTR_ERR(fp); } @@ -922,9 +922,9 @@ static int readFile(struct file *fp,char *buf,int len) while(sumf_op->read(fp,(char __user *)buf+sum,len-sum, &fp->f_pos); - if(rlen>0) + if (rlen>0) sum+=rlen; - else if(0 != rlen) + else if (0 != rlen) return rlen; else break; @@ -943,9 +943,9 @@ static int writeFile(struct file *fp,char *buf,int len) while(sumf_op->write(fp,(char __user *)buf+sum,len-sum, &fp->f_pos); - if(wlen>0) + if (wlen>0) sum+=wlen; - else if(0 != wlen) + else if (0 != wlen) return wlen; else break; @@ -968,13 +968,13 @@ static int isFileReadable(char *path) char buf; fp=filp_open(path, O_RDONLY, 0); - if(IS_ERR(fp)) { + if (IS_ERR(fp)) { ret = PTR_ERR(fp); } else { oldfs = get_fs(); set_fs(get_ds()); - if(1!=readFile(fp, &buf, 1)) + if (1!=readFile(fp, &buf, 1)) ret = PTR_ERR(fp); set_fs(oldfs); @@ -996,8 +996,8 @@ static int retriveFromFile(char *path, u8* buf, u32 sz) mm_segment_t oldfs; struct file *fp; - if(path && buf) { - if( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ){ + if (path && buf) { + if ( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ){ DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp); oldfs = get_fs(); set_fs(get_ds()); @@ -1030,8 +1030,8 @@ static int storeToFile(char *path, u8* buf, u32 sz) mm_segment_t oldfs; struct file *fp; - if(path && buf) { - if( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) { + if (path && buf) { + if ( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) { DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp); oldfs = get_fs(); set_fs(get_ds()); @@ -1058,7 +1058,7 @@ static int storeToFile(char *path, u8* buf, u32 sz) */ int rtw_is_file_readable(char *path) { - if(isFileReadable(path) == 0) + if (isFileReadable(path) == 0) return true; else return false; @@ -1142,12 +1142,12 @@ void rtw_free_netdev(struct net_device * netdev) { struct rtw_netdev_priv_indicator *pnpi; - if(!netdev) + if (!netdev) goto RETURN; pnpi = netdev_priv(netdev); - if(!pnpi->priv) + if (!pnpi->priv) goto RETURN; rtw_vmfree(pnpi->priv, pnpi->sizeof_priv); @@ -1168,20 +1168,20 @@ int rtw_change_ifname(struct adapter *padapter, const char *ifname) struct rereg_nd_name_data *rereg_priv; int ret; - if(!padapter) + if (!padapter) goto error; cur_pnetdev = padapter->pnetdev; rereg_priv = &padapter->rereg_nd_name_priv; /* free the old_pnetdev */ - if(rereg_priv->old_pnetdev) { + if (rereg_priv->old_pnetdev) { free_netdev(rereg_priv->old_pnetdev); rereg_priv->old_pnetdev = NULL; } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)) - if(!rtnl_is_locked()) + if (!rtnl_is_locked()) unregister_netdev(cur_pnetdev); else #endif @@ -1204,7 +1204,7 @@ int rtw_change_ifname(struct adapter *padapter, const char *ifname) memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)) - if(!rtnl_is_locked()) + if (!rtnl_is_locked()) ret = register_netdev(pnetdev); else #endif diff --git a/os_dep/recv_linux.c b/os_dep/recv_linux.c index f56e8f5..d77823c 100644 --- a/os_dep/recv_linux.c +++ b/os_dep/recv_linux.c @@ -58,7 +58,7 @@ void rtw_os_recv_resource_free(struct recv_priv *precvpriv) for(i=0; i < NR_RECVFRAME; i++) { - if(precvframe->u.hdr.pkt) + if (precvframe->u.hdr.pkt) { rtw_skb_free(precvframe->u.hdr.pkt);/* free skb by driver */ precvframe->u.hdr.pkt = NULL; @@ -79,7 +79,7 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter, struct recv_buf *pre precvbuf->irp_pending = false; precvbuf->purb = usb_alloc_urb(0, GFP_KERNEL); - if(precvbuf->purb == NULL){ + if (precvbuf->purb == NULL){ res = _FAIL; } @@ -103,9 +103,9 @@ int rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *prec { int ret = _SUCCESS; - if(precvbuf->purb) + if (precvbuf->purb) usb_free_urb(precvbuf->purb); - if(precvbuf->pskb) + if (precvbuf->pskb) rtw_skb_free(precvbuf->pskb); return ret; @@ -120,12 +120,12 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter,u8 bgroup) struct security_priv *psecuritypriv = &padapter->securitypriv; u32 cur_time = 0; - if( psecuritypriv->last_mic_err_time == 0 ) { + if ( psecuritypriv->last_mic_err_time == 0 ) { psecuritypriv->last_mic_err_time = rtw_get_current_time(); } else { cur_time = rtw_get_current_time(); - if( cur_time - psecuritypriv->last_mic_err_time < 60*HZ ) { + if ( cur_time - psecuritypriv->last_mic_err_time < 60*HZ ) { psecuritypriv->btkip_countermeasure = true; psecuritypriv->last_mic_err_time = 0; psecuritypriv->btkip_countermeasure_time = cur_time; @@ -174,7 +174,7 @@ void rtw_hostapd_mlme_rx(struct adapter *padapter, union recv_frame *precv_frame skb->len = precv_frame->u.hdr.len; /* pskb_copy = rtw_skb_copy(skb); */ -/* if(skb == NULL) goto _exit; */ +/* if (skb == NULL) goto _exit; */ skb->dev = pmgnt_netdev; skb->ip_summed = CHECKSUM_NONE; @@ -214,7 +214,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame if (!precv_frame) goto _recv_indicatepkt_drop; skb = precv_frame->u.hdr.pkt; - if(skb == NULL) + if (skb == NULL) { RT_TRACE(_module_recv_osdep_c_,_drv_err_,("rtw_recv_indicatepkt():skb==NULL something wrong!!!!\n")); goto _recv_indicatepkt_drop; @@ -232,7 +232,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame RT_TRACE(_module_recv_osdep_c_,_drv_info_,("\n skb->head=%p skb->data=%p skb->tail=%p skb->end=%p skb->len=%d\n", skb->head, skb->data, skb->tail, skb->end, skb->len)); - if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { struct sk_buff *pskb2=NULL; struct sta_info *psta = NULL; @@ -242,11 +242,11 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame /* DBG_871X("bmcast=%d\n", bmcast); */ - if(_rtw_memcmp(pattrib->dst, myid(&padapter->eeprompriv), ETH_ALEN)==false) + if (_rtw_memcmp(pattrib->dst, myid(&padapter->eeprompriv), ETH_ALEN)==false) { /* DBG_871X("not ap psta=%p, addr=%pM\n", psta, pattrib->dst); */ - if(bmcast) + if (bmcast) { psta = rtw_get_bcmc_stainfo(padapter); pskb2 = rtw_skb_clone(skb); @@ -254,7 +254,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame psta = rtw_get_stainfo(pstapriv, pattrib->dst); } - if(psta) + if (psta) { struct net_device *pnetdev= (struct net_device*)padapter->pnetdev; @@ -273,7 +273,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame _rtw_xmit_entry(skb, pnetdev); - if(bmcast) + if (bmcast) skb = pskb2; else goto _recv_indicatepkt_end; @@ -298,7 +298,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame rcu_read_unlock(); #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */ - if( br_port && (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) ) + if ( br_port && (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == true) ) { int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb); if (nat25_handle_frame(padapter, skb) == -1) { @@ -319,14 +319,14 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; int bmcast = IS_MCAST(pattrib->dst); - if(bmcast) + if (bmcast) { psta = rtw_get_bcmc_stainfo(padapter); } else { psta = rtw_get_stainfo(pstapriv, pattrib->src); } - if(psta) + if (psta) { switch(pattrib->priority) { @@ -369,7 +369,7 @@ _recv_indicatepkt_end: _recv_indicatepkt_drop: /* enqueue back to free_recv_queue */ - if(precv_frame) + if (precv_frame) rtw_free_recvframe(precv_frame, pfree_recv_queue); return _FAIL; @@ -390,7 +390,7 @@ void rtw_os_read_port(struct adapter *padapter, struct recv_buf *precvbuf) precvbuf->pskb = NULL; precvbuf->reuse = false; - if(precvbuf->irp_pending == false) + if (precvbuf->irp_pending == false) { rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf); } diff --git a/os_dep/rtw_android.c b/os_dep/rtw_android.c index 28d6834..f4a1152 100644 --- a/os_dep/rtw_android.c +++ b/os_dep/rtw_android.c @@ -231,7 +231,7 @@ int rtw_android_cmdstr_to_num(char *cmdstr) if (!strncasecmp(cmdstr, android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num]))) #else - if(0 == strnicmp(cmdstr, android_wifi_cmd_str[cmd_num], + if (0 == strnicmp(cmdstr, android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num]))) #endif break; @@ -246,7 +246,7 @@ static int rtw_android_get_rssi(struct net_device *net, char *command, int total struct wlan_network *pcur_network = &pmlmepriv->cur_network; int bytes_written = 0; - if(check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { bytes_written += snprintf(&command[bytes_written], total_len, "%s rssi %d", pcur_network->network.Ssid.Ssid, padapter->recvpriv.rssi); } @@ -470,7 +470,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) /* wpa_cli driver wfd-enable */ pwfd_info = &padapter->wfd_info; - if( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) + if ( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) pwfd_info->wfd_enable = true; break; case ANDROID_WIFI_CMD_WFD_DISABLE: @@ -479,7 +479,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) /* wpa_cli driver wfd-disable */ pwfd_info = &padapter->wfd_info; - if( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) + if ( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) pwfd_info->wfd_enable = false; break; case ANDROID_WIFI_CMD_WFD_SET_TCPPORT: @@ -488,7 +488,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) /* wpa_cli driver wfd-set-tcpport = 554 */ pwfd_info = &padapter->wfd_info; - if( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) + if ( padapter->wdinfo.driver_interface == DRIVER_CFG80211 ) pwfd_info->rtsp_ctrlport = (u16)get_int_from_command(priv_cmd.buf); break; case ANDROID_WIFI_CMD_WFD_SET_MAX_TPUT: diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index 0b85588..cfc2f8b 100644 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -234,7 +234,7 @@ static u8 rtw_deinit_intf_priv(struct dvobj_priv *dvobj) { u8 rst = _SUCCESS; - if(dvobj->usb_vendor_req_buf) + if (dvobj->usb_vendor_req_buf) rtw_mfree(dvobj->usb_alloc_vendor_req_buf, MAX_USB_IO_CTL_SIZE); _rtw_mutex_free(&dvobj->usb_vendor_req_mutex); @@ -415,7 +415,7 @@ static void usb_intf_stop(struct adapter *padapter) RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+usb_intf_stop\n")); /* disabel_hw_interrupt */ - if(padapter->bSurpriseRemoved == false) + if (padapter->bSurpriseRemoved == false) { /* device still exists, so driver can do i/o operation */ /* TODO: */ @@ -440,7 +440,7 @@ void rtw_dev_unload(struct adapter *padapter) u8 val8; RT_TRACE(_module_hci_intfs_c_,_drv_err_,("+rtw_dev_unload\n")); - if(padapter->bup == true) + if (padapter->bup == true) { DBG_871X("===> rtw_dev_unload\n"); @@ -449,18 +449,18 @@ void rtw_dev_unload(struct adapter *padapter) rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP); /* s3. */ - if(padapter->intf_stop) + if (padapter->intf_stop) { padapter->intf_stop(padapter); } /* s4. */ - if(!adapter_to_pwrctl(padapter)->bInternalAutoSuspend ) + if (!adapter_to_pwrctl(padapter)->bInternalAutoSuspend ) rtw_stop_drv_threads(padapter); /* s5. */ - if(padapter->bSurpriseRemoved == false) + if (padapter->bSurpriseRemoved == false) { rtw_hal_deinit(padapter); padapter->bSurpriseRemoved = true; @@ -490,7 +490,7 @@ static void process_spec_devid(const struct usb_device_id *pdid) pid = specific_device_id_tbl[i].idProduct; flags = specific_device_id_tbl[i].flags; - if((pdid->idVendor==vid) && (pdid->idProduct==pid) && (flags&SPEC_DEV_ID_DISABLE_HT)) + if ((pdid->idVendor==vid) && (pdid->idProduct==pid) && (flags&SPEC_DEV_ID_DISABLE_HT)) { rtw_ht_enable = 0; rtw_cbw40_enable = 0; @@ -505,7 +505,7 @@ int rtw_hw_suspend(struct adapter *padapter ) struct usb_interface *pusb_intf = adapter_to_dvobj(padapter)->pusbintf; struct net_device *pnetdev = padapter->pnetdev; - if((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved)) + if ((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved)) { DBG_871X("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved); @@ -518,7 +518,7 @@ int rtw_hw_suspend(struct adapter *padapter ) _enter_pwrlock(&pwrpriv->lock); pwrpriv->bips_processing = true; /* s1. */ - if(pnetdev) + if (pnetdev) { netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); @@ -531,7 +531,7 @@ int rtw_hw_suspend(struct adapter *padapter ) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - if(check_fwstate(pmlmepriv, _FW_LINKED)) + if (check_fwstate(pmlmepriv, _FW_LINKED)) { _clr_fwstate_(pmlmepriv, _FW_LINKED); @@ -569,7 +569,7 @@ int rtw_hw_resume(struct adapter *padapter) struct usb_interface *pusb_intf; struct net_device *pnetdev; - if(padapter)/* system resume */ + if (padapter)/* system resume */ { pwrpriv = adapter_to_pwrctl(padapter); pusb_intf = adapter_to_dvobj(padapter)->pusbintf; @@ -579,7 +579,7 @@ int rtw_hw_resume(struct adapter *padapter) pwrpriv->bips_processing = true; rtw_reset_drv_sw(padapter); - if(pm_netdev_open(pnetdev,false) != 0) { + if (pm_netdev_open(pnetdev,false) != 0) { _exit_pwrlock(&pwrpriv->lock); goto error_exit; } @@ -587,7 +587,7 @@ int rtw_hw_resume(struct adapter *padapter) netif_device_attach(pnetdev); netif_carrier_on(pnetdev); - if(!rtw_netif_queue_stopped(pnetdev)) + if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_start_queue(pnetdev); else rtw_netif_wake_queue(pnetdev); @@ -627,25 +627,25 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); - if(!padapter->bup){ + if (!padapter->bup){ u8 bMacPwrCtrlOn = false; rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); - if(bMacPwrCtrlOn) + if (bMacPwrCtrlOn) rtw_hal_power_off(padapter); } - if((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved)) + if ((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved)) { DBG_871X("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved); goto exit; } - if(pwrpriv->bInternalAutoSuspend ) + if (pwrpriv->bInternalAutoSuspend ) { #ifdef CONFIG_AUTOSUSPEND /* The FW command register update must after MAC and FW init ready. */ - if((padapter->bFWReady) && (pwrpriv->bHWPwrPindetect ) && (padapter->registrypriv.usbss_enable )) + if ((padapter->bFWReady) && (pwrpriv->bHWPwrPindetect ) && (padapter->registrypriv.usbss_enable )) { u8 bOpen = true; rtw_interface_ps_func(padapter,HAL_USB_SELECT_SUSPEND,&bOpen); @@ -679,7 +679,7 @@ static int rtw_resume(struct usb_interface *pusb_intf) struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(dvobj); int ret = 0; - if(pwrpriv->bInternalAutoSuspend ){ + if (pwrpriv->bInternalAutoSuspend ){ ret = rtw_resume_process(padapter); } else { if (rtw_is_earlysuspend_registered(pwrpriv)) { @@ -706,7 +706,7 @@ int rtw_resume_process(struct adapter *padapter) DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); - if(padapter) { + if (padapter) { pnetdev= padapter->pnetdev; pwrpriv = adapter_to_pwrctl(padapter); } else { @@ -725,7 +725,7 @@ int rtw_resume_process(struct adapter *padapter) #endif DBG_871X("pwrpriv->bAutoResume (%x)\n",pwrpriv->bAutoResume ); - if( true == pwrpriv->bAutoResume ){ + if ( true == pwrpriv->bAutoResume ){ pwrpriv->bInternalAutoSuspend = false; pwrpriv->bAutoResume=false; DBG_871X("pwrpriv->bAutoResume (%x) pwrpriv->bInternalAutoSuspend(%x)\n",pwrpriv->bAutoResume,pwrpriv->bInternalAutoSuspend ); @@ -735,18 +735,18 @@ int rtw_resume_process(struct adapter *padapter) #endif /* ifdef CONFIG_BT_COEXIST */ - if(rtw_resume_common(padapter)!= 0) { + if (rtw_resume_common(padapter)!= 0) { DBG_871X("%s rtw_resume_common failed\n",__FUNCTION__); _exit_pwrlock(&pwrpriv->lock); goto exit; } #ifdef CONFIG_AUTOSUSPEND - if(pwrpriv->bInternalAutoSuspend ) + if (pwrpriv->bInternalAutoSuspend ) { #ifdef CONFIG_AUTOSUSPEND /* The FW command register update must after MAC and FW init ready. */ - if((padapter->bFWReady) && (pwrpriv->bHWPwrPindetect) && (padapter->registrypriv.usbss_enable )) + if ((padapter->bFWReady) && (pwrpriv->bHWPwrPindetect) && (padapter->registrypriv.usbss_enable )) { u8 bOpen = false; rtw_interface_ps_func(padapter,HAL_USB_SELECT_SUSPEND,&bOpen); @@ -754,7 +754,7 @@ int rtw_resume_process(struct adapter *padapter) #endif #ifdef CONFIG_BT_COEXIST DBG_871X("pwrpriv->bAutoResume (%x)\n",pwrpriv->bAutoResume ); - if( true == pwrpriv->bAutoResume ){ + if ( true == pwrpriv->bAutoResume ){ pwrpriv->bInternalAutoSuspend = false; pwrpriv->bAutoResume=false; DBG_871X("pwrpriv->bAutoResume (%x) pwrpriv->bInternalAutoSuspend(%x)\n",pwrpriv->bAutoResume,pwrpriv->bInternalAutoSuspend ); @@ -768,7 +768,7 @@ int rtw_resume_process(struct adapter *padapter) #endif _exit_pwrlock(&pwrpriv->lock); - if( padapter->pid[1]!=0) { + if ( padapter->pid[1]!=0) { DBG_871X("pid[1]:%d\n",padapter->pid[1]); rtw_signal_process(padapter->pid[1], SIGUSR2); } @@ -793,7 +793,7 @@ void autosuspend_enter(struct adapter* padapter) pwrpriv->bInternalAutoSuspend = true; pwrpriv->bips_processing = true; - if(rf_off == pwrpriv->change_rfpwrstate ) + if (rf_off == pwrpriv->change_rfpwrstate ) { #ifndef CONFIG_BT_COEXIST #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) @@ -810,7 +810,7 @@ void autosuspend_enter(struct adapter* padapter) usb_autosuspend_device(dvobj->pusbdev, 1); #endif #else /* ifndef CONFIG_BT_COEXIST */ - if(1==pwrpriv->autopm_cnt){ + if (1==pwrpriv->autopm_cnt){ #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) usb_enable_autosuspend(dvobj->pusbdev); #else @@ -849,7 +849,7 @@ int autoresume_enter(struct adapter* padapter) DBG_871X("====> autoresume_enter\n"); - if(rf_off == pwrpriv->rf_pwrstate ) + if (rf_off == pwrpriv->rf_pwrstate ) { pwrpriv->ps_flag = false; #ifndef CONFIG_BT_COEXIST @@ -873,7 +873,7 @@ int autoresume_enter(struct adapter* padapter) #endif #else /* ifndef CONFIG_BT_COEXIST */ pwrpriv->bAutoResume=true; - if(0==pwrpriv->autopm_cnt){ + if (0==pwrpriv->autopm_cnt){ #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) if (usb_autopm_get_interface(dvobj->pusbintf) < 0) { @@ -940,13 +940,13 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, if (rtw_handle_dualmac(padapter, 1) != _SUCCESS) goto free_adapter; - if((pnetdev = rtw_init_netdev(padapter)) == NULL) { + if ((pnetdev = rtw_init_netdev(padapter)) == NULL) { goto handle_dualmac; } SET_NETDEV_DEV(pnetdev, dvobj_to_dev(dvobj)); padapter = rtw_netdev_priv(pnetdev); - if(rtw_wdev_alloc(padapter, dvobj_to_dev(dvobj)) != 0) { + if (rtw_wdev_alloc(padapter, dvobj_to_dev(dvobj)) != 0) { goto handle_dualmac; } @@ -969,14 +969,14 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, rtw_hal_read_chip_info(padapter); /* step 5. */ - if(rtw_init_drv_sw(padapter) ==_FAIL) { + if (rtw_init_drv_sw(padapter) ==_FAIL) { RT_TRACE(_module_hci_intfs_c_,_drv_err_,("Initialize driver software resource Failed!\n")); goto free_hal_data; } #ifdef CONFIG_PM #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)) - if(adapter_to_pwrctl(padapter)->bSupportRemoteWakeup) + if (adapter_to_pwrctl(padapter)->bSupportRemoteWakeup) { dvobj->pusbdev->do_remote_wakeup=1; pusb_intf->needs_remote_wakeup = 1; @@ -988,9 +988,9 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, #endif #ifdef CONFIG_AUTOSUSPEND - if( padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE ) + if ( padapter->registrypriv.power_mgnt != PS_MODE_ACTIVE ) { - if(padapter->registrypriv.usbss_enable ){ /* autosuspend (2s delay) */ + if (padapter->registrypriv.usbss_enable ){ /* autosuspend (2s delay) */ #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,38)) dvobj->pusbdev->dev.power.autosuspend_delay = 0 * HZ;/* 15 * HZ; idle-delay time */ #else @@ -1038,10 +1038,10 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, status = _SUCCESS; free_hal_data: - if(status != _SUCCESS && padapter->HalData) + if (status != _SUCCESS && padapter->HalData) kfree(padapter->HalData); free_wdev: - if(status != _SUCCESS) { + if (status != _SUCCESS) { rtw_wdev_unregister(padapter->rtw_wdev); rtw_wdev_free(padapter->rtw_wdev); } @@ -1066,7 +1066,7 @@ static void rtw_usb_if1_deinit(struct adapter *if1) struct mlme_priv *pmlmepriv= &if1->mlmepriv; struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(if1); - if(check_fwstate(pmlmepriv, _FW_LINKED)) + if (check_fwstate(pmlmepriv, _FW_LINKED)) rtw_disassoc_cmd(if1, 0, false); @@ -1084,13 +1084,13 @@ static void rtw_usb_if1_deinit(struct adapter *if1) rtw_handle_dualmac(if1, 0); - if(if1->rtw_wdev) { + if (if1->rtw_wdev) { /* rtw_wdev_unregister(if1->rtw_wdev); */ rtw_wdev_free(if1->rtw_wdev); } #ifdef CONFIG_BT_COEXIST - if(1 == pwrctl->autopm_cnt){ + if (1 == pwrctl->autopm_cnt){ #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,33)) usb_autopm_put_interface(adapter_to_dvobj(if1)->pusbintf); #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,20)) @@ -1104,7 +1104,7 @@ static void rtw_usb_if1_deinit(struct adapter *if1) rtw_free_drv_sw(if1); - if(pnetdev) + if (pnetdev) rtw_free_netdev(pnetdev); } @@ -1234,13 +1234,13 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device rtw_sw_export=if1; #endif - if(ui_pid[1]!=0) { + if (ui_pid[1]!=0) { DBG_871X("ui_pid[1]:%d\n",ui_pid[1]); rtw_signal_process(ui_pid[1], SIGUSR2); } /* dev_alloc_name && register_netdev */ - if((status = rtw_drv_register_netdev(if1)) != _SUCCESS) { + if ((status = rtw_drv_register_netdev(if1)) != _SUCCESS) { goto free_if2; } @@ -1281,7 +1281,7 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf) dvobj->processing_dev_remove = true; rtw_unregister_netdevs(dvobj); - if(usb_drv->drv_registered == true) + if (usb_drv->drv_registered == true) { /* DBG_871X("r871xu_dev_remove():padapter->bSurpriseRemoved == true\n"); */ padapter->bSurpriseRemoved = true; diff --git a/os_dep/usb_ops_linux.c b/os_dep/usb_ops_linux.c index 55bc62e..5b01b5c 100644 --- a/os_dep/usb_ops_linux.c +++ b/os_dep/usb_ops_linux.c @@ -190,14 +190,14 @@ static void usb_bulkout_zero_complete(struct urb *purb, struct pt_regs *regs) /* DBG_8192C("+usb_bulkout_zero_complete\n"); */ - if(pcontext) + if (pcontext) { - if(pcontext->pbuf) + if (pcontext->pbuf) { rtw_mfree(pcontext->pbuf, sizeof(int)); } - if(pcontext->purb && (pcontext->purb==purb)) + if (pcontext->purb && (pcontext->purb==purb)) { usb_free_urb(pcontext->purb); } @@ -223,7 +223,7 @@ static u32 usb_bulkout_zero(struct intf_hdl *pintfhdl, u32 addr) /* DBG_871X("%s\n", __func__); */ - if((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||(dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx)) + if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||(dvobj_to_pwrctl(pdvobj)->pnp_bstop_trx)) { return _FAIL; } @@ -340,7 +340,7 @@ static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) } - if(padapter->bSurpriseRemoved || padapter->bDriverStopped ||padapter->bWritePortCancel) + if (padapter->bSurpriseRemoved || padapter->bDriverStopped ||padapter->bWritePortCancel) { RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)", padapter->bDriverStopped, padapter->bSurpriseRemoved)); DBG_8192C("%s(): TX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bWritePortCancel(%d) pxmitbuf->ext_tag(%x)\n", @@ -355,7 +355,7 @@ static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) } else { RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete : purb->status(%d) != 0\n", purb->status)); DBG_871X("###=> urb_write_port_complete status(%d)\n",purb->status); - if((purb->status==-EPIPE)||(purb->status==-EPROTO)) + if ((purb->status==-EPIPE)||(purb->status==-EPROTO)) { /* usb_clear_halt(pusbdev, purb->pipe); */ /* msleep(10); */ @@ -402,7 +402,7 @@ check_completion: rtw_free_xmitbuf(pxmitpriv, pxmitbuf); - /* if(rtw_txframes_pending(padapter)) */ + /* if (rtw_txframes_pending(padapter)) */ { tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); } @@ -475,15 +475,15 @@ u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) int bmcast = IS_MCAST(pattrib->dst); u8 agg_num = 1; - if(pxmitframe->agg_num>1) + if (pxmitframe->agg_num>1) agg_num = pxmitframe->agg_num; - if(bmcast) + if (bmcast) psta = rtw_get_bcmc_stainfo(padapter); else psta = rtw_get_stainfo(pstapriv, pattrib->dst); - if(psta) { + if (psta) { switch(pattrib->priority) { case 1: case 2: @@ -553,7 +553,7 @@ u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) /* Commented by Albert 2009/10/13 */ /* We add the URB_ZERO_PACKET flag to urb so that the host will send the zero packet automatically. */ /* - if(bwritezero == true) + if (bwritezero == true) { usb_bulkout_zero(pintfhdl, addr); } @@ -591,7 +591,7 @@ void usb_write_port_cancel(struct intf_hdl *pintfhdl) pxmitbuf = (struct xmit_buf*)padapter->xmitpriv.pxmit_extbuf; for (i = 0; i < NR_XMIT_EXTBUFF; i++) { for (j=0; j<8; j++) { - if(pxmitbuf->pxmit_urb[j]) { + if (pxmitbuf->pxmit_urb[j]) { usb_kill_urb(pxmitbuf->pxmit_urb[j]); } } diff --git a/os_dep/xmit_linux.c b/os_dep/xmit_linux.c index bd815be..a141cb1 100644 --- a/os_dep/xmit_linux.c +++ b/os_dep/xmit_linux.c @@ -89,7 +89,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb for(i=0; i<8; i++) { pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL); - if(pxmitbuf->pxmit_urb[i] == NULL) { + if (pxmitbuf->pxmit_urb[i] == NULL) { DBG_871X("pxmitbuf->pxmit_urb[i]==NULL"); return _FAIL; } @@ -107,14 +107,14 @@ void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitb for(i=0; i<8; i++) { - if(pxmitbuf->pxmit_urb[i]) + if (pxmitbuf->pxmit_urb[i]) { /* usb_kill_urb(pxmitbuf->pxmit_urb[i]); */ usb_free_urb(pxmitbuf->pxmit_urb[i]); } } - if(pxmitbuf->pallocated_buf) + if (pxmitbuf->pallocated_buf) rtw_mfree(pxmitbuf->pallocated_buf, free_sz); } @@ -128,13 +128,13 @@ void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt) queue = skb_get_queue_mapping(pkt); if (padapter->registrypriv.wifi_spec) { - if(__netif_subqueue_stopped(padapter->pnetdev, queue) && + if (__netif_subqueue_stopped(padapter->pnetdev, queue) && (pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD)) { netif_wake_subqueue(padapter->pnetdev, queue); } } else { - if(__netif_subqueue_stopped(padapter->pnetdev, queue)) + if (__netif_subqueue_stopped(padapter->pnetdev, queue)) netif_wake_subqueue(padapter->pnetdev, queue); } #else @@ -147,7 +147,7 @@ void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt) void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe) { - if(pxframe->pkt) + if (pxframe->pkt) rtw_os_pkt_complete(padapter, pxframe->pkt); pxframe->pkt = NULL; @@ -160,14 +160,14 @@ void rtw_os_xmit_schedule(struct adapter *padapter) unsigned long irqL; struct xmit_priv *pxmitpriv; - if(!padapter) + if (!padapter) return; pxmitpriv = &padapter->xmitpriv; spin_lock_bh(&pxmitpriv->lock); - if(rtw_txframes_pending(padapter)) + if (rtw_txframes_pending(padapter)) tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); spin_unlock_bh(&pxmitpriv->lock); @@ -187,13 +187,13 @@ static void rtw_check_xmit_resource(struct adapter *padapter, struct sk_buff *pk netif_stop_subqueue(padapter->pnetdev, queue); } } else { - if(pxmitpriv->free_xmitframe_cnt<=4) { + if (pxmitpriv->free_xmitframe_cnt<=4) { if (!netif_tx_queue_stopped(netdev_get_tx_queue(padapter->pnetdev, queue))) netif_stop_subqueue(padapter->pnetdev, queue); } } #else - if(pxmitpriv->free_xmitframe_cnt<=4) + if (pxmitpriv->free_xmitframe_cnt<=4) { if (!rtw_netif_queue_stopped(padapter->pnetdev)) rtw_netif_stop_queue(padapter->pnetdev); @@ -235,7 +235,7 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) for (i = 0; i < chk_alive_num; i++) { psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]); - if(!(psta->state &_FW_LINKED)) + if (!(psta->state &_FW_LINKED)) continue; /* avoid come from STA1 and send back STA1 */