Staging: rtl8723bs: core: Fix coccinelle warning
v2 cover Staging: rtl8723bs: core: Fix coccinelle warning
Fix coccinelle "WARNING: Comparison to bool" and other minor issues reported by checkpatch.pl.
Georgiana Chelu (2):
Staging: rtl8723bs: core: Remove boolean comparison
Staging: rtl8723bs: core: Code clean up
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 68 +++++++++++++-------------- 1 file changed, 33 insertions(+), 35 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/2 Staging: rtl8723bs: core: Remove boolean comparison
Remove comparison to bool in order to improve
the clearness of the code.
Issue found using coccinelle script.
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 64 +++++++++++++-------------- 1 file changed, 32 insertions(+), 32 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +32 -32
@@ -510,7 +510,7 @@ void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext)if (!padapter)return ; -if (padapter->bDriverStopped == true) { +if (padapter->bDriverStopped) {del_timer_sync (&pmlmeext->survey_timer);del_timer_sync (&pmlmeext->link_timer);/* del_timer_sync(&pmlmeext->ADDBA_timer); */
@@ -582,7 +582,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 )) ptable->func = &OnAuth;else ptable->func = &OnAuthClient;
@@ -637,8 +637,8 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame)/* DBG_871X("+OnProbeReq\n"); */ #ifdef CONFIG_AUTO_AP_MODE -if (check_fwstate (pmlmepriv, _FW_LINKED) == true && - pmlmepriv->cur_network.join_res == true) { +if (check_fwstate (pmlmepriv, _FW_LINKED) && + pmlmepriv->cur_network.join_res) {struct sta_info *psta;u8 *mac_addr, *peer_addr;struct sta_priv *pstapriv = &padapter->stapriv;
@@ -752,7 +752,7 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame)/* check (wildcard) SSID */ if (p !=NULL ) { -if (is_valid_p2p_probereq == true) +if (is_valid_p2p_probereq) goto _issue_probersp; if ((ielen != 0 && false == !memcmp((void *)(p+2), (void *)cur->Ssid.Ssid, cur->Ssid.SsidLength))
@@ -761,8 +761,8 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame)return _SUCCESS; _issue_probersp: -if (((check_fwstate (pmlmepriv, _FW_LINKED) == true && - pmlmepriv->cur_network.join_res == true)) ||check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE )) { +if ((check_fwstate (pmlmepriv, _FW_LINKED) && + pmlmepriv->cur_network.join_res) ||check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE )) {/* DBG_871X("+issue_probersp during ap mode\n"); */ issue_probersp (padapter,get_sa (pframe), is_valid_p2p_probereq); }
@@ -1773,7 +1773,7 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame)DBG_871X ("%s Reason code(%d)\n" , __func__, reason); -if (check_fwstate (pmlmepriv,WIFI_AP_STATE ) == true) { +if (check_fwstate (pmlmepriv,WIFI_AP_STATE )) {struct sta_info *psta;struct sta_priv *pstapriv = &padapter->stapriv;
@@ -1848,7 +1848,7 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame)DBG_871X ("%s Reason code(%d)\n" , __func__, reason); -if (check_fwstate (pmlmepriv,WIFI_AP_STATE ) == true) { +if (check_fwstate (pmlmepriv,WIFI_AP_STATE )) {struct sta_info *psta;struct sta_priv *pstapriv = &padapter->stapriv;
@@ -1976,7 +1976,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) {issue_action_BA (padapter, addr,RTW_WLAN_ACTION_ADDBA_RESP ,0 ); }else {issue_action_BA (padapter, addr,RTW_WLAN_ACTION_ADDBA_RESP ,37 );/* reject ADDBA Req */
@@ -2350,8 +2350,8 @@ void update_mgntframe_attrib_addr(struct adapter *padapter, struct xmit_frame *pvoid dump_mgntframe (struct adapter *padapter,struct xmit_frame *pmgntframe) { -if (padapter->bSurpriseRemoved == true || - padapter->bDriverStopped == true) { +if (padapter->bSurpriseRemoved || + padapter->bDriverStopped) {rtw_free_xmitbuf (&padapter->xmitpriv, pmgntframe->pxmitbuf);rtw_free_xmitframe (&padapter->xmitpriv, pmgntframe);return ;
@@ -2368,8 +2368,8 @@ s32 dump_mgntframe_and_wait(struct adapter *padapter, struct xmit_frame *pmgntfrstruct xmit_buf *pxmitbuf = pmgntframe->pxmitbuf;struct submit_ctx sctx; -if (padapter->bSurpriseRemoved == true || - padapter->bDriverStopped == true) { +if (padapter->bSurpriseRemoved || + padapter->bDriverStopped) {rtw_free_xmitbuf (&padapter->xmitpriv, pmgntframe->pxmitbuf);rtw_free_xmitframe (&padapter->xmitpriv, pmgntframe);return ret;
@@ -2397,8 +2397,8 @@ s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmgu32 timeout_ms =500 ;/* 500ms */ struct xmit_priv *pxmitpriv = &padapter->xmitpriv; -if (padapter->bSurpriseRemoved == true || - padapter->bDriverStopped == true) { +if (padapter->bSurpriseRemoved || + padapter->bDriverStopped) {rtw_free_xmitbuf (&padapter->xmitpriv, pmgntframe->pxmitbuf);rtw_free_xmitframe (&padapter->xmitpriv, pmgntframe);return -1 ;
@@ -3394,7 +3394,7 @@ void issue_assocreq(struct adapter *padapter) pframe =rtw_set_ie (pframe,EID_WPA2 , pIE->Length, pIE->data, &(pattrib->pktlen));break ;case EID_HTCapability: -if (padapter->mlmepriv.htpriv.ht_option == true) { +if (padapter->mlmepriv.htpriv.ht_option) {if (!(is_ap_in_tkip (padapter))) {memcpy (&(pmlmeinfo->HT_caps), pIE->data,sizeof (struct HT_caps_element )); pframe =rtw_set_ie (pframe, EID_HTCapability, pIE->Length, (u8 *)(&(pmlmeinfo->HT_caps)), &(pattrib->pktlen));
@@ -3403,7 +3403,7 @@ void issue_assocreq(struct adapter *padapter)break ;case EID_EXTCapability: -if (padapter->mlmepriv.htpriv.ht_option == true) +if (padapter->mlmepriv.htpriv.ht_option) pframe =rtw_set_ie (pframe, EID_EXTCapability, pIE->Length, pIE->data, &(pattrib->pktlen));break ;default :
@@ -4219,7 +4219,7 @@ unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr)if (initiator ==0 ) {/* recipient */ for (tid =0 ; tid <MAXTID ; tid++) { -if (psta->recvreorder_ctrl[tid].enable == true) { +if (psta->recvreorder_ctrl[tid].enable) {DBG_871X ("rx agg disable tid(%d)\n" , tid);issue_action_BA (padapter, addr,RTW_WLAN_ACTION_DELBA , (((tid <<1 ) | initiator)&0x1F )); psta->recvreorder_ctrl[tid].enable = false;
@@ -4408,7 +4408,7 @@ void site_survey(struct adapter *padapter)Restore_DM_Func_Flag (padapter);/* Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, true); */ -if (is_client_associated_to_ap (padapter) == true) +if (is_client_associated_to_ap (padapter))issue_nulldata (padapter,NULL ,0 ,3 ,500 ); val8 =0 ;/* survey done */
@@ -5445,7 +5445,7 @@ static void rtw_mlmeext_disconnect(struct adapter *padapter) pmlmeinfo->state =WIFI_FW_NULL_STATE ;if (state_backup ==WIFI_FW_STATION_STATE ) { -if (rtw_port_switch_chk (padapter) == true) { +if (rtw_port_switch_chk (padapter)) {rtw_hal_set_hwreg (padapter,HW_VAR_PORT_SWITCH ,NULL ); {struct adapter *port0_iface =dvobj_get_port0_adapter (adapter_to_dvobj (padapter));
@@ -5534,7 +5534,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res)rtw_hal_macid_wakeup (padapter, psta->mac_id); } -if (rtw_port_switch_chk (padapter) == true) +if (rtw_port_switch_chk (padapter))rtw_hal_set_hwreg (padapter,HW_VAR_PORT_SWITCH ,NULL ); join_type =2 ;
@@ -5659,7 +5659,7 @@ void _linked_info_dump(struct adapter *padapter) }for (i =0 ; i <NUM_STA ; i++) { -if (pdvobj->macid[i] == true) { +if (pdvobj->macid[i]) {if (i !=1 )/* skip bc/mc sta */ /* tx info ============ */ rtw_hal_get_def_var (padapter,HW_DEF_RA_INFO_DUMP , &i);
@@ -5842,7 +5842,7 @@ void survey_timer_hdl(struct adapter *padapter) pmlmeext->sitesurvey_res.channel_idx++; } -if (pmlmeext->scan_abort == true) { +if (pmlmeext->scan_abort) { { pmlmeext->sitesurvey_res.channel_idx = pmlmeext->sitesurvey_res.ch_num; DBG_871X("%s idx:%d\n", __func__
@@ -5933,7 +5933,7 @@ void addba_timer_hdl(struct sta_info *psta) phtpriv = &psta->htpriv; -if ((phtpriv->ht_option == true) && (phtpriv->ampdu_enable == true)) { +if (phtpriv->ht_option && phtpriv->ampdu_enable) {if (phtpriv->candidate_tid_bitmap) phtpriv->candidate_tid_bitmap =0x0 ;
@@ -5946,7 +5946,7 @@ void sa_query_timer_hdl(struct adapter *padapter)/* disconnect */ spin_lock_bh (&pmlmepriv->lock); -if (check_fwstate (pmlmepriv, _FW_LINKED) == true) { +if (check_fwstate (pmlmepriv, _FW_LINKED)) {rtw_disassoc_cmd (padapter,0 , true);rtw_indicate_disconnect (padapter);rtw_free_assoc_resources (padapter,1 );
@@ -6084,7 +6084,7 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf)rtw_auto_ap_start_beacon (padapter);#endif -if (rtw_port_switch_chk (padapter) == true) { +if (rtw_port_switch_chk (padapter)) {rtw_hal_set_hwreg (padapter,HW_VAR_PORT_SWITCH ,NULL );if (psetop->mode == Ndis802_11APMode)
@@ -6358,7 +6358,7 @@ static int rtw_scan_ch_decision(struct adapter *padapter, struct rtw_ieee80211_c set_idx =rtw_ch_set_search_ch (pmlmeext->channel_set, in[i].hw_value);if (in[i].hw_value && !(in[i].flags &RTW_IEEE80211_CHAN_DISABLED ) && set_idx >=0 - &&rtw_mlme_band_check (padapter, in[i].hw_value) == true + &&rtw_mlme_band_check (padapter, in[i].hw_value) ) {if (j >= out_num) { DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" out_num:%u not enough\n",
@@ -6383,7 +6383,7 @@ static int rtw_scan_ch_decision(struct adapter *padapter, struct rtw_ieee80211_cDBG_871X (FUNC_ADPT_FMT " ch:%u\n" ,FUNC_ADPT_ARG (padapter), pmlmeext->channel_set[i].ChannelNum); -if (rtw_mlme_band_check (padapter, pmlmeext->channel_set[i].ChannelNum) == true) { +if (rtw_mlme_band_check (padapter, pmlmeext->channel_set[i].ChannelNum)) {if (j >= out_num) { DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" out_num:%u not enough\n",
@@ -6435,7 +6435,7 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf) pmlmeext->sitesurvey_res.scan_mode = pparm->scan_mode;/* issue null data if associating to the AP */ -if (is_client_associated_to_ap (padapter) == true) { +if (is_client_associated_to_ap (padapter)) { pmlmeext->sitesurvey_res.state =SCAN_TXNULL ;issue_nulldata (padapter,NULL ,1 ,3 ,500 );
@@ -6767,7 +6767,7 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned char *pbuf) pxmitframe->attrib.triggered =1 ; -if (xmitframe_hiq_filter (pxmitframe) == true) +if (xmitframe_hiq_filter (pxmitframe)) pxmitframe->attrib.qsel =0x11 ;/* HIQ */ rtw_hal_xmitframe_enqueue (padapter, pxmitframe);
@@ -6809,7 +6809,7 @@ int rtw_chk_start_clnt_join(struct adapter *padapter, u8 *ch, u8 *bw, u8 *offset connect_allow = false; } -if (connect_allow == true) { +if (connect_allow) {DBG_871X ("start_join_set_ch_bw: ch =%d, bwmode =%d, ch_offset =%d\n" , cur_ch, cur_bw, cur_ch_offset); *ch = cur_ch; *bw = cur_bw;
Signature · 1 line
2.7.4
PATCH v2 2/2 Staging: rtl8723bs: core: Code clean up
In reply to Georgiana CheluClean the code to improve the coding style.
Fix minor issues reported by checkpatch.pl:
* CHECK: Alignment should match open parenthesis
* CHECK: Logical continuations should be on the previous line
* WARNING: line over 80 characters
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +11 -13
@@ -638,7 +638,7 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame)#ifdef CONFIG_AUTO_AP_MODE if (check_fwstate (pmlmepriv, _FW_LINKED) && - pmlmepriv->cur_network.join_res) { + pmlmepriv->cur_network.join_res) {struct sta_info *psta;u8 *mac_addr, *peer_addr;struct sta_priv *pstapriv = &padapter->stapriv;
@@ -761,8 +761,9 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame)return _SUCCESS; _issue_probersp: -if ((check_fwstate (pmlmepriv, _FW_LINKED) && - pmlmepriv->cur_network.join_res) ||check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE )) { +if ((check_fwstate (pmlmepriv, _FW_LINKED) && + pmlmepriv->cur_network.join_res) || +check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE )) {/* DBG_871X("+issue_probersp during ap mode\n"); */ issue_probersp (padapter,get_sa (pframe), is_valid_p2p_probereq); }
@@ -2350,8 +2351,7 @@ void update_mgntframe_attrib_addr(struct adapter *padapter, struct xmit_frame *pvoid dump_mgntframe (struct adapter *padapter,struct xmit_frame *pmgntframe) { -if (padapter->bSurpriseRemoved || - padapter->bDriverStopped) { +if (padapter->bSurpriseRemoved || padapter->bDriverStopped) {rtw_free_xmitbuf (&padapter->xmitpriv, pmgntframe->pxmitbuf);rtw_free_xmitframe (&padapter->xmitpriv, pmgntframe);return ;
@@ -2368,8 +2368,7 @@ s32 dump_mgntframe_and_wait(struct adapter *padapter, struct xmit_frame *pmgntfrstruct xmit_buf *pxmitbuf = pmgntframe->pxmitbuf;struct submit_ctx sctx; -if (padapter->bSurpriseRemoved || - padapter->bDriverStopped) { +if (padapter->bSurpriseRemoved || padapter->bDriverStopped) {rtw_free_xmitbuf (&padapter->xmitpriv, pmgntframe->pxmitbuf);rtw_free_xmitframe (&padapter->xmitpriv, pmgntframe);return ret;
@@ -2397,8 +2396,7 @@ s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmgu32 timeout_ms =500 ;/* 500ms */ struct xmit_priv *pxmitpriv = &padapter->xmitpriv; -if (padapter->bSurpriseRemoved || - padapter->bDriverStopped) { +if (padapter->bSurpriseRemoved || padapter->bDriverStopped) {rtw_free_xmitbuf (&padapter->xmitpriv, pmgntframe->pxmitbuf);rtw_free_xmitframe (&padapter->xmitpriv, pmgntframe);return -1 ;
@@ -6356,10 +6354,10 @@ static int rtw_scan_ch_decision(struct adapter *padapter, struct rtw_ieee80211_cDBG_871X (FUNC_ADPT_FMT " " CHAN_FMT "\n" ,FUNC_ADPT_ARG (padapter),CHAN_ARG (&in[i])); set_idx =rtw_ch_set_search_ch (pmlmeext->channel_set, in[i].hw_value); -if (in[i].hw_value && !(in[i].flags &RTW_IEEE80211_CHAN_DISABLED ) - && set_idx >=0 - &&rtw_mlme_band_check (padapter, in[i].hw_value) - ) { +if (in[i].hw_value && + !(in[i].flags &RTW_IEEE80211_CHAN_DISABLED ) && + set_idx >=0 && +rtw_mlme_band_check (padapter, in[i].hw_value)) {if (j >= out_num) {DBG_871X_LEVEL (_drv_always_,FUNC_ADPT_FMT " out_num:%u not enough\n" ,FUNC_ADPT_ARG (padapter), out_num);
Signature · 1 line
2.7.4
Greg Kroah-Hartman
maintainerRe: [PATCH v2 2/2] Staging: rtl8723bs: core: Code clean up
Quoted 6 lines · Georgiana Chelu
Clean the code to improve the coding style.
Fix minor issues reported by checkpatch.pl:
* CHECK: Alignment should match open parenthesis
* CHECK: Logical continuations should be on the previous line
* WARNING: line over 80 characters
That's a lot of different things to be doing all in one patch. Please break this up into "one type of thing" per patch.
And no, "fix all coding style issues" is not "one thing" :)
thanks,
greg k-h
Re: [PATCH v2 2/2] Staging: rtl8723bs: core: Code clean up
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Georgiana Chelu
Clean the code to improve the coding style.
Fix minor issues reported by checkpatch.pl:
* CHECK: Alignment should match open parenthesis
* CHECK: Logical continuations should be on the previous line
* WARNING: line over 80 characters
Quoted 5 lines
That's a lot of different things to be doing all in one patch. Please break this up into "one type of thing" per patch.
And no, "fix all coding style issues" is not "one thing" :)
I will resend the patchset! Thank you!
Is the << "one type of thing" per patch>> requirement because it is easy to follow the same change in a patch?
Have a nice day,
Georgiana
Quoted 3 lines
thanks,
greg k-h
Re: [PATCH v2 2/2] Staging: rtl8723bs: core: Code clean up
Quoted 10 lines · Georgiana Chelu
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Georgiana Chelu
Clean the code to improve the coding style.
Fix minor issues reported by checkpatch.pl:
* CHECK: Alignment should match open parenthesis
* CHECK: Logical continuations should be on the previous line
* WARNING: line over 80 characters
Quoted 8 lines
Quoted 5 lines
That's a lot of different things to be doing all in one patch. Please break this up into "one type of thing" per patch.
And no, "fix all coding style issues" is not "one thing" :)
I will resend the patchset! Thank you!
Is the << "one type of thing" per patch>> required
Quoted 8 lines
because it is easy to follow the same change in a patch?
Have a nice day,
GeorgianaQuoted 3 lines
thanks,
greg k-h
Re: [Outreachy kernel] Re: [PATCH v2 2/2] Staging: rtl8723bs: core: Code clean up
Quoted 15 lines · Georgiana Chelu
Quoted 13 lines · Georgiana Chelu
Quoted 11 lines · Greg Kroah-Hartman
Quoted 6 lines · Georgiana Chelu
Clean the code to improve the coding style.
Fix minor issues reported by checkpatch.pl:
* CHECK: Alignment should match open parenthesis
* CHECK: Logical continuations should be on the previous line
* WARNING: line over 80 charactersThat's a lot of different things to be doing all in one patch. Please break this up into "one type of thing" per patch.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
And no, "fix all coding style issues" is not "one thing" :)
I will resend the patchset! Thank you!
Is the << "one type of thing" per patch>> required
Quoted 1 line
because it is easy to follow the same change in a patch?
It makes reviewing easier, and also it could be that someone will later find that one of the kinds of changes you did is incorrect, so it is easier to undo if it is by itself.
julia
Quoted 15 lines
Quoted 7 lines
Have a nice day,
GeorgianaQuoted 3 lines
thanks,
greg k-h
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CALta04zFwGkrmWOzB%2BguhMfo3OE2uFJYdOT5fp38OG_2si112Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.