]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Staging: rtl8723bs: core: Remove boolean comparison
authorGeorgiana Chelu <georgiana.chelu93@gmail.com>
Fri, 22 Sep 2017 15:04:51 +0000 (08:04 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Sep 2017 07:41:54 +0000 (09:41 +0200)
Remove comparison to bool in order to improve
the clearness of the code.

Issue found using coccinelle script.

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c

index 99ed52bd19100fe5919898e659caa71e0b1517ec..6c59fafeb769f9f6ffe88f1367884beb6674e17c 100644 (file)
@@ -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 *p
 
 void 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 *pmgntfr
        struct 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 *pmg
        u32 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_c
 
                        DBG_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;