Commit e49fa0b7 authored by John Oldman's avatar John Oldman Committed by Greg Kroah-Hartman

staging: rtl8723bs: Using comparison to true is error prone

clear below issues reported by checkpatch.pl:

CHECK: Using comparison to false is error prone
CHECK: Using comparison to true is error pron
Signed-off-by: default avatarJohn Oldman <john.oldman@polehill.co.uk>
Link: https://lore.kernel.org/r/20200707114128.30312-1-john.oldman@polehill.co.ukSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eab439be
...@@ -313,7 +313,7 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p) ...@@ -313,7 +313,7 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p)
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
struct sockaddr *addr = p; struct sockaddr *addr = p;
if (padapter->bup == false) { if (!padapter->bup) {
/* 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], */ /* 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]); */ /* addr->sa_data[4], addr->sa_data[5]); */
memcpy(padapter->eeprompriv.mac_addr, addr->sa_data, ETH_ALEN); memcpy(padapter->eeprompriv.mac_addr, addr->sa_data, ETH_ALEN);
...@@ -897,12 +897,12 @@ int _netdev_open(struct net_device *pnetdev) ...@@ -897,12 +897,12 @@ int _netdev_open(struct net_device *pnetdev)
padapter->netif_up = true; padapter->netif_up = true;
if (pwrctrlpriv->ps_flag == true) { if (pwrctrlpriv->ps_flag) {
padapter->net_closed = false; padapter->net_closed = false;
goto netdev_open_normal_process; goto netdev_open_normal_process;
} }
if (padapter->bup == false) { if (!padapter->bup) {
padapter->bDriverStopped = false; padapter->bDriverStopped = false;
padapter->bSurpriseRemoved = false; padapter->bSurpriseRemoved = false;
padapter->bCardDisableWOHSM = false; padapter->bCardDisableWOHSM = false;
...@@ -964,7 +964,7 @@ int netdev_open(struct net_device *pnetdev) ...@@ -964,7 +964,7 @@ int netdev_open(struct net_device *pnetdev)
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
if (pwrctrlpriv->bInSuspend == true) { if (pwrctrlpriv->bInSuspend) {
DBG_871X("+871x_drv - drv_open, bInSuspend =%d\n", pwrctrlpriv->bInSuspend); DBG_871X("+871x_drv - drv_open, bInSuspend =%d\n", pwrctrlpriv->bInSuspend);
return 0; return 0;
} }
...@@ -1041,7 +1041,7 @@ void rtw_ips_dev_unload(struct adapter *padapter) ...@@ -1041,7 +1041,7 @@ void rtw_ips_dev_unload(struct adapter *padapter)
DBG_871X("====> %s...\n", __func__); DBG_871X("====> %s...\n", __func__);
if (padapter->bSurpriseRemoved == false) if (!padapter->bSurpriseRemoved)
rtw_hal_deinit(padapter); rtw_hal_deinit(padapter);
} }
...@@ -1052,7 +1052,7 @@ static int pm_netdev_open(struct net_device *pnetdev, u8 bnormal) ...@@ -1052,7 +1052,7 @@ static int pm_netdev_open(struct net_device *pnetdev, u8 bnormal)
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
if (true == bnormal) { if (bnormal) {
if (mutex_lock_interruptible(&(adapter_to_dvobj(padapter)->hw_init_mutex)) == 0) { if (mutex_lock_interruptible(&(adapter_to_dvobj(padapter)->hw_init_mutex)) == 0) {
status = _netdev_open(pnetdev); status = _netdev_open(pnetdev);
mutex_unlock(&(adapter_to_dvobj(padapter)->hw_init_mutex)); mutex_unlock(&(adapter_to_dvobj(padapter)->hw_init_mutex));
...@@ -1071,7 +1071,7 @@ static int netdev_close(struct net_device *pnetdev) ...@@ -1071,7 +1071,7 @@ static int netdev_close(struct net_device *pnetdev)
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+871x_drv - drv_close\n")); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+871x_drv - drv_close\n"));
if (pwrctl->bInternalAutoSuspend == true) { if (pwrctl->bInternalAutoSuspend) {
/* rtw_pwr_wakeup(padapter); */ /* rtw_pwr_wakeup(padapter); */
if (pwrctl->rf_pwrstate == rf_off) if (pwrctl->rf_pwrstate == rf_off)
pwrctl->ps_flag = true; pwrctl->ps_flag = true;
...@@ -1134,7 +1134,7 @@ void rtw_dev_unload(struct adapter *padapter) ...@@ -1134,7 +1134,7 @@ void rtw_dev_unload(struct adapter *padapter)
RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("+%s\n", __func__)); RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("+%s\n", __func__));
if (padapter->bup == true) { if (padapter->bup) {
DBG_871X("===> %s\n", __func__); DBG_871X("===> %s\n", __func__);
padapter->bDriverStopped = true; padapter->bDriverStopped = true;
...@@ -1149,7 +1149,7 @@ void rtw_dev_unload(struct adapter *padapter) ...@@ -1149,7 +1149,7 @@ void rtw_dev_unload(struct adapter *padapter)
if (!pwrctl->bInternalAutoSuspend) if (!pwrctl->bInternalAutoSuspend)
rtw_stop_drv_threads(padapter); rtw_stop_drv_threads(padapter);
while (atomic_read(&(pcmdpriv->cmdthd_running)) == true) { while (atomic_read(&pcmdpriv->cmdthd_running)) {
if (cnt > 5) { if (cnt > 5) {
DBG_871X("stop cmdthd timeout\n"); DBG_871X("stop cmdthd timeout\n");
break; break;
...@@ -1163,7 +1163,8 @@ void rtw_dev_unload(struct adapter *padapter) ...@@ -1163,7 +1163,8 @@ void rtw_dev_unload(struct adapter *padapter)
RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("@ %s: stop thread complete!\n", __func__)); RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("@ %s: stop thread complete!\n", __func__));
/* check the status of IPS */ /* check the status of IPS */
if (rtw_hal_check_ips_status(padapter) == true || pwrctl->rf_pwrstate == rf_off) { /* check HW status and SW state */ if (rtw_hal_check_ips_status(padapter) || pwrctl->rf_pwrstate == rf_off) {
/* check HW status and SW state */
DBG_871X_LEVEL(_drv_always_, "%s: driver in IPS-FWLPS\n", __func__); DBG_871X_LEVEL(_drv_always_, "%s: driver in IPS-FWLPS\n", __func__);
pdbgpriv->dbg_dev_unload_inIPS_cnt++; pdbgpriv->dbg_dev_unload_inIPS_cnt++;
LeaveAllPowerSaveMode(padapter); LeaveAllPowerSaveMode(padapter);
...@@ -1171,11 +1172,10 @@ void rtw_dev_unload(struct adapter *padapter) ...@@ -1171,11 +1172,10 @@ void rtw_dev_unload(struct adapter *padapter)
DBG_871X_LEVEL(_drv_always_, "%s: driver not in IPS\n", __func__); DBG_871X_LEVEL(_drv_always_, "%s: driver not in IPS\n", __func__);
} }
if (padapter->bSurpriseRemoved == false) { if (!padapter->bSurpriseRemoved) {
hal_btcoex_IpsNotify(padapter, pwrctl->ips_mode_req); hal_btcoex_IpsNotify(padapter, pwrctl->ips_mode_req);
#ifdef CONFIG_WOWLAN #ifdef CONFIG_WOWLAN
if (pwrctl->bSupportRemoteWakeup == true && if (pwrctl->bSupportRemoteWakeup && pwrctl->wowlan_mode) {
pwrctl->wowlan_mode == true) {
DBG_871X_LEVEL(_drv_always_, "%s bSupportRemoteWakeup ==true do not run rtw_hal_deinit()\n", __func__); DBG_871X_LEVEL(_drv_always_, "%s bSupportRemoteWakeup ==true do not run rtw_hal_deinit()\n", __func__);
} }
else else
...@@ -1235,7 +1235,7 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) ...@@ -1235,7 +1235,7 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter)
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
rtw_indicate_scan_done(padapter, 1); rtw_indicate_scan_done(padapter, 1);
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) { if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
DBG_871X_LEVEL(_drv_always_, "%s: fw_under_linking\n", __func__); DBG_871X_LEVEL(_drv_always_, "%s: fw_under_linking\n", __func__);
rtw_indicate_disconnect(padapter); rtw_indicate_disconnect(padapter);
} }
...@@ -1259,7 +1259,7 @@ void rtw_suspend_wow(struct adapter *padapter) ...@@ -1259,7 +1259,7 @@ void rtw_suspend_wow(struct adapter *padapter)
DBG_871X("wowlan_mode: %d\n", pwrpriv->wowlan_mode); DBG_871X("wowlan_mode: %d\n", pwrpriv->wowlan_mode);
DBG_871X("wowlan_pno_enable: %d\n", pwrpriv->wowlan_pno_enable); DBG_871X("wowlan_pno_enable: %d\n", pwrpriv->wowlan_pno_enable);
if (pwrpriv->wowlan_mode == true) { if (pwrpriv->wowlan_mode) {
if (pnetdev) if (pnetdev)
rtw_netif_stop_queue(pnetdev); rtw_netif_stop_queue(pnetdev);
/* 1. stop thread */ /* 1. stop thread */
...@@ -1283,8 +1283,7 @@ void rtw_suspend_wow(struct adapter *padapter) ...@@ -1283,8 +1283,7 @@ void rtw_suspend_wow(struct adapter *padapter)
poidparam.subcode = WOWLAN_ENABLE; poidparam.subcode = WOWLAN_ENABLE;
padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam); padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam);
if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) {
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) {
&& check_fwstate(pmlmepriv, _FW_LINKED)) {
DBG_871X("%s %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n", __func__, DBG_871X("%s %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n", __func__,
pmlmepriv->cur_network.network.Ssid.Ssid, pmlmepriv->cur_network.network.Ssid.Ssid,
MAC_ARG(pmlmepriv->cur_network.network.MacAddress), MAC_ARG(pmlmepriv->cur_network.network.MacAddress),
...@@ -1297,7 +1296,7 @@ void rtw_suspend_wow(struct adapter *padapter) ...@@ -1297,7 +1296,7 @@ void rtw_suspend_wow(struct adapter *padapter)
DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__);
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) { if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) {
DBG_871X_LEVEL(_drv_always_, "%s: fw_under_survey\n", __func__); DBG_871X_LEVEL(_drv_always_, "%s: fw_under_survey\n", __func__);
rtw_indicate_scan_done(padapter, 1); rtw_indicate_scan_done(padapter, 1);
clr_fwstate(pmlmepriv, _FW_UNDER_SURVEY); clr_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
...@@ -1313,8 +1312,7 @@ void rtw_suspend_wow(struct adapter *padapter) ...@@ -1313,8 +1312,7 @@ void rtw_suspend_wow(struct adapter *padapter)
DBG_871X_LEVEL(_drv_always_, "%s: pno: %d\n", __func__, pwrpriv->wowlan_pno_enable); DBG_871X_LEVEL(_drv_always_, "%s: pno: %d\n", __func__, pwrpriv->wowlan_pno_enable);
else else
rtw_set_ps_mode(padapter, PS_MODE_DTIM, 0, 0, "WOWLAN"); rtw_set_ps_mode(padapter, PS_MODE_DTIM, 0, 0, "WOWLAN");
} } else {
else {
DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode);
} }
DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter));
...@@ -1385,10 +1383,8 @@ static void rtw_suspend_normal(struct adapter *padapter) ...@@ -1385,10 +1383,8 @@ static void rtw_suspend_normal(struct adapter *padapter)
rtw_suspend_free_assoc_resource(padapter); rtw_suspend_free_assoc_resource(padapter);
if ((rtw_hal_check_ips_status(padapter) == true) if ((rtw_hal_check_ips_status(padapter)) || (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off))
|| (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off)) {
DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR #### driver in IPS ####ERROR###!!!\n", __func__); DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR #### driver in IPS ####ERROR###!!!\n", __func__);
}
rtw_dev_unload(padapter); rtw_dev_unload(padapter);
...@@ -1415,7 +1411,7 @@ int rtw_suspend_common(struct adapter *padapter) ...@@ -1415,7 +1411,7 @@ int rtw_suspend_common(struct adapter *padapter)
pwrpriv->bInSuspend = true; pwrpriv->bInSuspend = true;
while (pwrpriv->bips_processing == true) while (pwrpriv->bips_processing)
msleep(1); msleep(1);
if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) { if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) {
...@@ -1433,24 +1429,24 @@ int rtw_suspend_common(struct adapter *padapter) ...@@ -1433,24 +1429,24 @@ int rtw_suspend_common(struct adapter *padapter)
rtw_stop_cmd_thread(padapter); rtw_stop_cmd_thread(padapter);
/* wait for the latest FW to remove this condition. */ /* wait for the latest FW to remove this condition. */
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
hal_btcoex_SuspendNotify(padapter, 0); hal_btcoex_SuspendNotify(padapter, 0);
DBG_871X("WIFI_AP_STATE\n"); DBG_871X("WIFI_AP_STATE\n");
} else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { } else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
hal_btcoex_SuspendNotify(padapter, 1); hal_btcoex_SuspendNotify(padapter, 1);
DBG_871X("STATION\n"); DBG_871X("STATION\n");
} }
rtw_ps_deny_cancel(padapter, PS_DENY_SUSPEND); rtw_ps_deny_cancel(padapter, PS_DENY_SUSPEND);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
#ifdef CONFIG_WOWLAN #ifdef CONFIG_WOWLAN
if (check_fwstate(pmlmepriv, _FW_LINKED)) if (check_fwstate(pmlmepriv, _FW_LINKED))
pwrpriv->wowlan_mode = true; pwrpriv->wowlan_mode = true;
else if (pwrpriv->wowlan_pno_enable == true) else if (pwrpriv->wowlan_pno_enable)
pwrpriv->wowlan_mode |= pwrpriv->wowlan_pno_enable; pwrpriv->wowlan_mode |= pwrpriv->wowlan_pno_enable;
if (pwrpriv->wowlan_mode == true) if (pwrpriv->wowlan_mode)
rtw_suspend_wow(padapter); rtw_suspend_wow(padapter);
else else
rtw_suspend_normal(padapter); rtw_suspend_normal(padapter);
...@@ -1458,7 +1454,7 @@ int rtw_suspend_common(struct adapter *padapter) ...@@ -1458,7 +1454,7 @@ int rtw_suspend_common(struct adapter *padapter)
#else /* CONFIG_WOWLAN */ #else /* CONFIG_WOWLAN */
rtw_suspend_normal(padapter); rtw_suspend_normal(padapter);
#endif /* CONFIG_WOWLAN */ #endif /* CONFIG_WOWLAN */
} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
#ifdef CONFIG_AP_WOWLAN #ifdef CONFIG_AP_WOWLAN
rtw_suspend_ap_wow(padapter); rtw_suspend_ap_wow(padapter);
#else #else
...@@ -1513,7 +1509,7 @@ int rtw_resume_process_wow(struct adapter *padapter) ...@@ -1513,7 +1509,7 @@ int rtw_resume_process_wow(struct adapter *padapter)
pwrpriv->pno_in_resume = true; pwrpriv->pno_in_resume = true;
#endif #endif
if (pwrpriv->wowlan_mode == true) { if (pwrpriv->wowlan_mode) {
rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN");
pwrpriv->bFwCurrentInPSMode = false; pwrpriv->bFwCurrentInPSMode = false;
...@@ -1553,8 +1549,7 @@ int rtw_resume_process_wow(struct adapter *padapter) ...@@ -1553,8 +1549,7 @@ int rtw_resume_process_wow(struct adapter *padapter)
else else
rtw_netif_wake_queue(pnetdev); rtw_netif_wake_queue(pnetdev);
} }
} } else {
else {
DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode);
} }
...@@ -1584,7 +1579,7 @@ int rtw_resume_process_wow(struct adapter *padapter) ...@@ -1584,7 +1579,7 @@ int rtw_resume_process_wow(struct adapter *padapter)
} }
} }
if (pwrpriv->wowlan_mode == true) { if (pwrpriv->wowlan_mode) {
pwrpriv->bips_processing = false; pwrpriv->bips_processing = false;
_set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000);
} else { } else {
...@@ -1730,7 +1725,6 @@ static int rtw_resume_process_normal(struct adapter *padapter) ...@@ -1730,7 +1725,6 @@ static int rtw_resume_process_normal(struct adapter *padapter)
rtw_signal_process(padapter->pid[1], SIGUSR2); rtw_signal_process(padapter->pid[1], SIGUSR2);
} }
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
DBG_871X(FUNC_ADPT_FMT " fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); DBG_871X(FUNC_ADPT_FMT " fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv));
...@@ -1762,9 +1756,9 @@ int rtw_resume_common(struct adapter *padapter) ...@@ -1762,9 +1756,9 @@ int rtw_resume_common(struct adapter *padapter)
DBG_871X_LEVEL(_drv_always_, "resume start\n"); DBG_871X_LEVEL(_drv_always_, "resume start\n");
DBG_871X("==> %s (%s:%d)\n", __func__, current->comm, current->pid); DBG_871X("==> %s (%s:%d)\n", __func__, current->comm, current->pid);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
#ifdef CONFIG_WOWLAN #ifdef CONFIG_WOWLAN
if (pwrpriv->wowlan_mode == true) if (pwrpriv->wowlan_mode)
rtw_resume_process_wow(padapter); rtw_resume_process_wow(padapter);
else else
rtw_resume_process_normal(padapter); rtw_resume_process_normal(padapter);
...@@ -1772,7 +1766,7 @@ int rtw_resume_common(struct adapter *padapter) ...@@ -1772,7 +1766,7 @@ int rtw_resume_common(struct adapter *padapter)
rtw_resume_process_normal(padapter); rtw_resume_process_normal(padapter);
#endif #endif
} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
#ifdef CONFIG_AP_WOWLAN #ifdef CONFIG_AP_WOWLAN
rtw_resume_process_ap_wow(padapter); rtw_resume_process_ap_wow(padapter);
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment