staging: rtl8723bs: place constants on the right side of tests
PATCH 1/2 staging: rtl8723bs: place constants on the right side of tests
In reply to a message not in the archiveAdhere to Linux kernel coding style.
Reported by checkpatch:
WARNING: Comparisons should place the constant on the right side of the test
Signed-off-by Sevinj Aghayeva <[email protected]>
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +17 -17
@@ -308,11 +308,11 @@ static void init_channel_list(struct adapter *padapter, struct rt_channel_info *if (!has_channel (channel_set, chanset_size, ch))continue ; -if ((0 == padapter->registrypriv.ht_enable) && (8 == o->inc)) +if ((padapter->registrypriv.ht_enable ==0 ) && (o->inc ==8 ))continue ; -if ((0 < (padapter->registrypriv.bw_mode &0xf0 )) && - ((BW40MINUS == o->bw) || (BW40PLUS == o->bw))) +if (((padapter->registrypriv.bw_mode &0xf0 ) >0 ) && + ((o->bw ==BW40MINUS ) || (o->bw ==BW40PLUS )))continue ;if (!reg) {
@@ -342,7 +342,7 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct rt_cif (is_supported_24g (padapter->registrypriv.wireless_mode)) { b2_4GBand = true; -if (RT_CHANNEL_DOMAIN_REALTEK_DEFINE == ChannelPlan) +if (ChannelPlan ==RT_CHANNEL_DOMAIN_REALTEK_DEFINE ) Index2G =RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE .Index2G;else Index2G = RTW_ChannelPlanMap[ChannelPlan].Index2G;
@@ -352,14 +352,14 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct rt_cfor (index =0 ; index < RTW_ChannelPlan2G[Index2G].Len; index++) { channel_set[chanset_size].ChannelNum = RTW_ChannelPlan2G[Index2G].Channel[index]; -if ((RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN == ChannelPlan) ||/* Channel 1~11 is active, and 12~14 is passive */ - (RT_CHANNEL_DOMAIN_GLOBAL_NULL == ChannelPlan)) { +if ((ChannelPlan ==RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN ) ||/* Channel 1~11 is active, and 12~14 is passive */ + (ChannelPlan ==RT_CHANNEL_DOMAIN_GLOBAL_NULL )) {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 )) channel_set[chanset_size].ScanType =SCAN_PASSIVE ; - }else if (RT_CHANNEL_DOMAIN_WORLD_WIDE_13 == ChannelPlan || -RT_CHANNEL_DOMAIN_2G_WORLD == Index2G) {/* channel 12~13, passive scan */ + }else if (ChannelPlan ==RT_CHANNEL_DOMAIN_WORLD_WIDE_13 || + Index2G ==RT_CHANNEL_DOMAIN_2G_WORLD ) {/* channel 12~13, passive scan */ if (channel_set[chanset_size].ChannelNum <=11 ) channel_set[chanset_size].ScanType =SCAN_ACTIVE ;else
@@ -1326,7 +1326,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 ) && (WLAN_STATUS_SUCCESS == status)) { +if (pstat && (pstat->state &WIFI_FW_ASSOC_SUCCESS ) && (status ==WLAN_STATUS_SUCCESS )) {/* 1 bss_cap_update & sta_info_update */ bss_cap_update_on_sta_join (padapter, pstat);sta_info_update (padapter, pstat);
@@ -1514,7 +1514,7 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame) (pmlmeinfo->state & WIFI_FW_ASSOC_STATE)) {if (reason ==WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA ) { ignore_received_deauth =1 ; - }else if (WLAN_REASON_PREV_AUTH_NOT_VALID == reason) { + }else if (reason ==WLAN_REASON_PREV_AUTH_NOT_VALID ) {/* TODO: 802.11r */ ignore_received_deauth =1 ; }
@@ -1525,7 +1525,7 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame) reason,GetAddr3Ptr (pframe), ignore_received_deauth); -if (0 == ignore_received_deauth) +if (ignore_received_deauth ==0 )receive_disconnect (padapter,GetAddr3Ptr (pframe), reason); } pmlmepriv->LinkDetectInfo.bBusyTraffic = false;
@@ -3536,13 +3536,13 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned chrtw_hal_get_def_var (padapter,HW_VAR_MAX_RX_AMPDU_FACTOR , &max_rx_ampdu_factor); -if (IEEE80211_HT_MAX_AMPDU_64K == max_rx_ampdu_factor) +if (max_rx_ampdu_factor ==IEEE80211_HT_MAX_AMPDU_64K ) BA_para_set = ((le16_to_cpu (pmlmeinfo->ADDBA_req.BA_para_set) &0x3f ) |0x1000 );/* 64 buffer size */ -else if (IEEE80211_HT_MAX_AMPDU_32K == max_rx_ampdu_factor) +else if (max_rx_ampdu_factor ==IEEE80211_HT_MAX_AMPDU_32K ) BA_para_set = ((le16_to_cpu (pmlmeinfo->ADDBA_req.BA_para_set) &0x3f ) |0x0800 );/* 32 buffer size */ -else if (IEEE80211_HT_MAX_AMPDU_16K == max_rx_ampdu_factor) +else if (max_rx_ampdu_factor ==IEEE80211_HT_MAX_AMPDU_16K ) BA_para_set = ((le16_to_cpu (pmlmeinfo->ADDBA_req.BA_para_set) &0x3f ) |0x0400 );/* 16 buffer size */ -else if (IEEE80211_HT_MAX_AMPDU_8K == max_rx_ampdu_factor) +else if (max_rx_ampdu_factor ==IEEE80211_HT_MAX_AMPDU_8K ) 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 */
@@ -5065,7 +5065,7 @@ void linked_status_chk(struct adapter *padapter)if (pmlmeinfo->FW_sta_info[i].status ==1 ) { psta = pmlmeinfo->FW_sta_info[i].psta; -if (NULL == psta) +if (psta ==NULL )continue ;if (pmlmeinfo->FW_sta_info[i].rx_pkt ==sta_rx_pkts (psta)) {
@@ -6049,7 +6049,7 @@ u8 run_in_thread_hdl(struct adapter *padapter, u8 *pbuf)struct RunInThread_param *p; -if (NULL == pbuf) +if (pbuf ==NULL )return H2C_PARAMETERS_ERROR ; p = (struct RunInThread_param *)pbuf;
Signature · 1 line
2.25.1
PATCH 2/2 staging: rtl8723bs: remove redundant else branches
In reply to a message not in the archiveAdhere to Linux kernel coding style.
Reported by checkpatch:
WARNING: else is not generally useful after a break or return
Signed-off-by Sevinj Aghayeva <[email protected]>
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 63 +++++++++---------- 1 file changed, 30 insertions(+), 33 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +30 -33
@@ -907,10 +907,9 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_framset_link_timer (pmlmeext,REAUTH_TO );return _SUCCESS; - }else { -/* open system */ - go2asoc =1 ; } +/* open system */ + go2asoc =1 ; }else if (seq ==4 ) {if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared) go2asoc =1 ;
@@ -1467,6 +1466,7 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame)struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);u8 *pframe = precv_frame->u.hdr.rx_data; +int ignore_received_deauth =0 ;/* check A3 */ if (memcmp (GetAddr3Ptr (pframe),get_my_bssid (&pmlmeinfo->network),ETH_ALEN ))
@@ -1502,32 +1502,31 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame)return _SUCCESS; - }else { -int ignore_received_deauth =0 ; - -/* Commented by Albert 20130604 */ -/* Before sending the auth frame to start the STA/GC mode connection with AP/GO, */ -/* we will send the deauth first. */ -/* However, the Win8.1 with BRCM Wi-Fi will send the deauth with reason code 6 to us after receieving our deauth. */ -/* Added the following code to avoid this case. */ -if ((pmlmeinfo->state &WIFI_FW_AUTH_STATE ) || - (pmlmeinfo->state &WIFI_FW_ASSOC_STATE )) { -if (reason ==WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA ) { - ignore_received_deauth =1 ; - }else if (reason ==WLAN_REASON_PREV_AUTH_NOT_VALID ) { -/* TODO: 802.11r */ - ignore_received_deauth =1 ; - } + } + +/* Commented by Albert 20130604 */ +/* Before sending the auth frame to start the STA/GC mode connection with AP/GO, */ +/* we will send the deauth first. */ +/* However, the Win8.1 with BRCM Wi-Fi will send the deauth with reason code 6 to us after receieving our deauth. */ +/* Added the following code to avoid this case. */ +if ((pmlmeinfo->state &WIFI_FW_AUTH_STATE ) || + (pmlmeinfo->state &WIFI_FW_ASSOC_STATE )) { +if (reason ==WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA ) { + ignore_received_deauth =1 ; + }else if (reason ==WLAN_REASON_PREV_AUTH_NOT_VALID ) { +/* TODO: 802.11r */ + ignore_received_deauth =1 ; } + } -netdev_dbg (padapter->pnetdev, -"sta recv deauth reason code(%d) sta:%pM, ignore = %d\n" , - reason,GetAddr3Ptr (pframe), - ignore_received_deauth); +netdev_dbg (padapter->pnetdev, +"sta recv deauth reason code(%d) sta:%pM, ignore = %d\n" , + reason,GetAddr3Ptr (pframe), + ignore_received_deauth); + +if (ignore_received_deauth ==0 ) +receive_disconnect (padapter,GetAddr3Ptr (pframe), reason); -if (ignore_received_deauth ==0 ) -receive_disconnect (padapter,GetAddr3Ptr (pframe), reason); - } pmlmepriv->LinkDetectInfo.bBusyTraffic = false;return _SUCCESS;
@@ -1574,16 +1573,14 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame) }return _SUCCESS; - }else { -netdev_dbg (padapter->pnetdev, -"sta recv disassoc reason code(%d) sta:%pM\n" , - reason,GetAddr3Ptr (pframe)); - -receive_disconnect (padapter,GetAddr3Ptr (pframe), reason); } +netdev_dbg (padapter->pnetdev, +"sta recv disassoc reason code(%d) sta:%pM\n" , + reason,GetAddr3Ptr (pframe)); + +receive_disconnect (padapter,GetAddr3Ptr (pframe), reason); pmlmepriv->LinkDetectInfo.bBusyTraffic = false;return _SUCCESS; - }unsigned int OnAtim (struct adapter *padapter,union recv_frame *precv_frame)
Signature · 1 line
2.25.1