staging: rtl8723bs: remove comparisons to boolean literals
PATCH v3 1/1 staging: rtl8723bs: remove comparisons to boolean literals
Remove comparisons to true and false as they are error prone. Use the idiomatic C forms instead
v3: Fix inverted logic for ht_option checks
--- drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/staging/rtl8723bs/core/rtw_wlan_util.c +8 -9
@@ -236,7 +236,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)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));
@@ -340,7 +340,6 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne center_ch =rtw_get_center_ch (channel, bwmode, channel_offset); -/* set Channel */ if (mutex_lock_interruptible (&(adapter_to_dvobj (padapter)->setch_mutex)))return ;
@@ -847,7 +846,7 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_80211_var_if (!pIE)return ; -if (phtpriv->ht_option == false) +if (!phtpriv->ht_option)return ;if (pIE->length >sizeof (struct HT_info_element ))
@@ -892,7 +891,7 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_80211_var_ pmlmeinfo->bwmode_updated = false; } -if (true == pmlmeinfo->bwmode_updated) { +if (pmlmeinfo->bwmode_updated) {struct sta_info *psta;struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network);struct sta_priv *pstapriv = &padapter->stapriv;
@@ -931,7 +930,7 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE)if (!pIE)return ; -if (phtpriv->ht_option == false) +if (!phtpriv->ht_option)return ; pmlmeinfo->HT_caps_enable =1 ;
@@ -994,7 +993,7 @@ void HT_info_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE)if (!pIE)return ; -if (phtpriv->ht_option == false) +if (!phtpriv->ht_option)return ;if (pIE->length >sizeof (struct HT_info_element ))
@@ -1689,7 +1688,7 @@ void adaptive_early_32k(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len) pmlmeext->bcn_delay_cnt[delay_ms]++;/* pmlmeext->bcn_delay_ratio[delay_ms] = (pmlmeext->bcn_delay_cnt[delay_ms] * 100) /pmlmeext->bcn_cnt; */ /* dump for adaptive_early_32k */ -if (pmlmeext->bcn_cnt >100 && (pmlmeext->adaptive_tsf_done == true)) { +if (pmlmeext->bcn_cnt >100 && (pmlmeext->adaptive_tsf_done)) {u8 ratio_20_delay, ratio_80_delay;u8 DrvBcnEarly, DrvBcnTimeOut;
@@ -1737,7 +1736,7 @@ void rtw_alloc_macid(struct adapter *padapter, struct sta_info *psta)spin_lock_bh (&pdvobj->lock);for (i =0 ; i <NUM_STA ; i++) { -if (pdvobj->macid[i] == false) { +if (!pdvobj->macid[i]) { pdvobj->macid[i] = true;break ; }
@@ -1762,7 +1761,7 @@ void rtw_release_macid(struct adapter *padapter, struct sta_info *psta)spin_lock_bh (&pdvobj->lock);if (psta->mac_id <NUM_STA && psta->mac_id !=1 ) { -if (pdvobj->macid[psta->mac_id] == true) { +if (pdvobj->macid[psta->mac_id]) { pdvobj->macid[psta->mac_id] = false; psta->mac_id =NUM_STA ; }
Signature · 1 line
2.54.0
Greg Kroah-Hartman
maintainerQuoted 4 lines · William Elder
Remove comparisons to true and false as they are error prone. Use the idiomatic C forms instead
v3: Fix inverted logic for
ht_optionchecks
This goes below the --- line, as the documentation asks, right?
Also, what happened in v2? Always include all of the information.
thanks,
greg k-h
PATCH v4 1/1 staging: rtl8723bs: remove comparisons to boolean literals
Remove comparisons to true and false as they are error prone. Use the idiomatic C forms instead. Removed a stray blank line
---
v4: Per Greg's request, included all patch revisions and moved the
version notes below the --- line
v3: Fix inverted logic for ht_option checks
v2: No changes, resent v1 as a mistake
v1: Fix redundant boolean comparisons and introduce inverted logic on false conditions and removed a stray blank line
drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/staging/rtl8723bs/core/rtw_wlan_util.c +8 -9
@@ -236,7 +236,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)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));
@@ -340,7 +340,6 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne center_ch =rtw_get_center_ch (channel, bwmode, channel_offset); -/* set Channel */ if (mutex_lock_interruptible (&(adapter_to_dvobj (padapter)->setch_mutex)))return ;
@@ -847,7 +846,7 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_80211_var_if (!pIE)return ; -if (phtpriv->ht_option == false) +if (!phtpriv->ht_option)return ;if (pIE->length >sizeof (struct HT_info_element ))
@@ -892,7 +891,7 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_80211_var_ pmlmeinfo->bwmode_updated = false; } -if (true == pmlmeinfo->bwmode_updated) { +if (pmlmeinfo->bwmode_updated) {struct sta_info *psta;struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network);struct sta_priv *pstapriv = &padapter->stapriv;
@@ -931,7 +930,7 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE)if (!pIE)return ; -if (phtpriv->ht_option == false) +if (!phtpriv->ht_option)return ; pmlmeinfo->HT_caps_enable =1 ;
@@ -994,7 +993,7 @@ void HT_info_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE)if (!pIE)return ; -if (phtpriv->ht_option == false) +if (!phtpriv->ht_option)return ;if (pIE->length >sizeof (struct HT_info_element ))
@@ -1689,7 +1688,7 @@ void adaptive_early_32k(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len) pmlmeext->bcn_delay_cnt[delay_ms]++;/* pmlmeext->bcn_delay_ratio[delay_ms] = (pmlmeext->bcn_delay_cnt[delay_ms] * 100) /pmlmeext->bcn_cnt; */ /* dump for adaptive_early_32k */ -if (pmlmeext->bcn_cnt >100 && (pmlmeext->adaptive_tsf_done == true)) { +if (pmlmeext->bcn_cnt >100 && (pmlmeext->adaptive_tsf_done)) {u8 ratio_20_delay, ratio_80_delay;u8 DrvBcnEarly, DrvBcnTimeOut;
@@ -1737,7 +1736,7 @@ void rtw_alloc_macid(struct adapter *padapter, struct sta_info *psta)spin_lock_bh (&pdvobj->lock);for (i =0 ; i <NUM_STA ; i++) { -if (pdvobj->macid[i] == false) { +if (!pdvobj->macid[i]) { pdvobj->macid[i] = true;break ; }
@@ -1762,7 +1761,7 @@ void rtw_release_macid(struct adapter *padapter, struct sta_info *psta)spin_lock_bh (&pdvobj->lock);if (psta->mac_id <NUM_STA && psta->mac_id !=1 ) { -if (pdvobj->macid[psta->mac_id] == true) { +if (pdvobj->macid[psta->mac_id]) { pdvobj->macid[psta->mac_id] = false; psta->mac_id =NUM_STA ; }
Signature · 1 line
2.54.0
Quoted 2 lines · William Elder
Remove comparisons to true and false as they are error prone. Use the idiomatic C forms instead. Removed a stray blank line
Don't mix "Removed a stray blank line" into unrelated changes.
Quoted 9 lines
Signed-off-by William Elder <[email protected]>---
v4: Per Greg's request, included all patch revisions and moved the
version notes below the --- line
v3: Fix inverted logic forht_optionchecks
v2: No changes, resent v1 as a mistake
v1: Fix redundant boolean comparisons and introduce inverted logic on false conditions and removed a stray blank line
Please work against the latest staging-devel tree.
regards,
dan carpenter
Quoted 1 line
Please work against the latest staging-devel tree.
I am no longer continuing development on the patch, as the patch is against an out-of-date tree.
Best,
William Elder