mirror of
https://github.com/torvalds/linux.git
synced 2026-07-29 18:51:21 +02:00
staging: rtl8723bs: os_dep: simplify boolean comparisons
Simplify boolean comparisons to improve readability and conform to the Linux kernel coding style. Signed-off-by: Andrei Khomenkov <khomenkov@mailbox.org> Link: https://patch.msgid.link/20260427175846.23470-4-khomenkov@mailbox.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
577ae917d4
commit
fa74eafdce
|
|
@ -275,7 +275,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
|
|||
notify_timestamp = ktime_to_us(ktime_get_boottime());
|
||||
|
||||
/* We've set wiphy's signal_type as CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) */
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED) == true &&
|
||||
if (check_fwstate(pmlmepriv, _FW_LINKED) &&
|
||||
is_same_network(&pmlmepriv->cur_network.network, &pnetwork->network, 0)) {
|
||||
notify_signal = 100 * translate_percentage_to_dbm(padapter->recvpriv.signal_strength);/* dbm */
|
||||
} else {
|
||||
|
|
@ -372,7 +372,7 @@ void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter)
|
|||
struct wlan_bssid_ex *pnetwork = &(padapter->mlmeextpriv.mlmext_info.network);
|
||||
struct wlan_network *scanned = pmlmepriv->cur_network_scanned;
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
|
||||
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
|
||||
memcpy(&cur_network->network, pnetwork, sizeof(struct wlan_bssid_ex));
|
||||
rtw_cfg80211_inform_bss(padapter, cur_network);
|
||||
} else {
|
||||
|
|
@ -410,7 +410,7 @@ void rtw_cfg80211_indicate_connect(struct adapter *padapter)
|
|||
return;
|
||||
}
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
|
||||
return;
|
||||
|
||||
{
|
||||
|
|
@ -479,7 +479,7 @@ void rtw_cfg80211_indicate_disconnect(struct adapter *padapter)
|
|||
return;
|
||||
}
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
|
||||
return;
|
||||
|
||||
if (!padapter->mlmepriv.not_indic_disco) {
|
||||
|
|
@ -768,7 +768,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
|
|||
struct sta_info *psta, *pbcmc_sta;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == true) { /* sta mode */
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE)) { /* sta mode */
|
||||
psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv));
|
||||
if (psta) {
|
||||
/* Jeff: don't disable ieee8021x_blocked while clearing key */
|
||||
|
|
@ -892,15 +892,15 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct wireless_dev *wdev,
|
|||
memcpy(param->u.crypt.key, (u8 *)params->key, params->key_len);
|
||||
}
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) {
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
|
||||
ret = rtw_cfg80211_set_encryption(ndev, param, param_len);
|
||||
} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
|
||||
} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
|
||||
if (mac_addr)
|
||||
memcpy(param->sta_addr, mac_addr, ETH_ALEN);
|
||||
|
||||
ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len);
|
||||
} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true
|
||||
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
|
||||
} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)
|
||||
|| check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
|
||||
ret = rtw_cfg80211_set_encryption(ndev, param, param_len);
|
||||
}
|
||||
|
||||
|
|
@ -1033,7 +1033,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
|
|||
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
|
||||
int ret = 0;
|
||||
|
||||
if (adapter_to_dvobj(padapter)->processing_dev_remove == true) {
|
||||
if (adapter_to_dvobj(padapter)->processing_dev_remove) {
|
||||
ret = -EPERM;
|
||||
goto exit;
|
||||
}
|
||||
|
|
@ -1074,7 +1074,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
|
|||
|
||||
rtw_wdev->iftype = type;
|
||||
|
||||
if (rtw_set_802_11_infrastructure_mode(padapter, networkType) == false) {
|
||||
if (!rtw_set_802_11_infrastructure_mode(padapter, networkType)) {
|
||||
rtw_wdev->iftype = old_type;
|
||||
ret = -EPERM;
|
||||
goto exit;
|
||||
|
|
@ -1209,8 +1209,8 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
|
|||
pwdev_priv->scan_request = request;
|
||||
spin_unlock_bh(&pwdev_priv->scan_req_lock);
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
|
||||
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS | _FW_UNDER_SURVEY | _FW_UNDER_LINKING) == true) {
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
|
||||
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS | _FW_UNDER_SURVEY | _FW_UNDER_LINKING)) {
|
||||
need_indicate_scan_done = true;
|
||||
goto check_need_indicate_scan_done;
|
||||
}
|
||||
|
|
@ -1225,10 +1225,10 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
|
|||
if (request->ie && request->ie_len > 0)
|
||||
rtw_cfg80211_set_probe_req_wpsp2pie(padapter, (u8 *)request->ie, request->ie_len);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) {
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) {
|
||||
need_indicate_scan_done = true;
|
||||
goto check_need_indicate_scan_done;
|
||||
} else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) {
|
||||
} else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
|
||||
ret = -EBUSY;
|
||||
goto check_need_indicate_scan_done;
|
||||
}
|
||||
|
|
@ -1284,7 +1284,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
|
|||
}
|
||||
spin_unlock_bh(&pmlmepriv->lock);
|
||||
|
||||
if (_status == false)
|
||||
if (!_status)
|
||||
ret = -1;
|
||||
|
||||
check_need_indicate_scan_done:
|
||||
|
|
@ -1584,7 +1584,7 @@ static int cfg80211_rtw_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
|
|||
ret = rtw_cfg80211_set_auth_type(psecuritypriv, NL80211_AUTHTYPE_OPEN_SYSTEM);
|
||||
rtw_set_802_11_authentication_mode(padapter, psecuritypriv->ndisauthtype);
|
||||
|
||||
if (rtw_set_802_11_ssid(padapter, &ndis_ssid) == false) {
|
||||
if (!rtw_set_802_11_ssid(padapter, &ndis_ssid)) {
|
||||
ret = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
|
@ -1610,7 +1610,7 @@ static int cfg80211_rtw_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
|
|||
|
||||
rtw_wdev->iftype = NL80211_IFTYPE_STATION;
|
||||
|
||||
if (rtw_set_802_11_infrastructure_mode(padapter, Ndis802_11Infrastructure) == false) {
|
||||
if (!rtw_set_802_11_infrastructure_mode(padapter, Ndis802_11Infrastructure)) {
|
||||
rtw_wdev->iftype = old_type;
|
||||
ret = -EPERM;
|
||||
goto leave_ibss;
|
||||
|
|
@ -1634,7 +1634,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
|
|||
|
||||
padapter->mlmepriv.not_indic_disco = true;
|
||||
|
||||
if (adapter_wdev_data(padapter)->block == true) {
|
||||
if (adapter_wdev_data(padapter)->block) {
|
||||
ret = -EBUSY;
|
||||
goto exit;
|
||||
}
|
||||
|
|
@ -1664,11 +1664,11 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
|
|||
ndis_ssid.ssid_length = sme->ssid_len;
|
||||
memcpy(ndis_ssid.ssid, (u8 *)sme->ssid, sme->ssid_len);
|
||||
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) {
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
|
||||
ret = -EBUSY;
|
||||
goto exit;
|
||||
}
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
|
||||
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
|
||||
rtw_scan_abort(padapter);
|
||||
|
||||
psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled;
|
||||
|
|
@ -1761,7 +1761,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
|
|||
|
||||
/* rtw_set_802_11_encryption_mode(padapter, padapter->securitypriv.ndisencryptstatus); */
|
||||
|
||||
if (rtw_set_802_11_connect(padapter, (u8 *)sme->bssid, &ndis_ssid) == false) {
|
||||
if (!rtw_set_802_11_connect(padapter, (u8 *)sme->bssid, &ndis_ssid)) {
|
||||
ret = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
|
@ -2067,7 +2067,7 @@ static netdev_tx_t rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struc
|
|||
u32 len = skb->len;
|
||||
u8 category, action;
|
||||
|
||||
if (rtw_action_frame_parse(buf, len, &category, &action) == false)
|
||||
if (!rtw_action_frame_parse(buf, len, &category, &action))
|
||||
goto fail;
|
||||
|
||||
/* starting alloc mgmt frame to dump it */
|
||||
|
|
@ -2249,7 +2249,7 @@ static int rtw_add_beacon(struct adapter *adapter, const u8 *head, size_t head_l
|
|||
uint len, wps_ielen = 0;
|
||||
struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
|
||||
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
|
||||
if (!check_fwstate(pmlmepriv, WIFI_AP_STATE))
|
||||
return -EINVAL;
|
||||
|
||||
if (head_len < 24)
|
||||
|
|
@ -2343,7 +2343,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy,
|
|||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
const u8 *mac = params->mac;
|
||||
|
||||
if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true)
|
||||
if (!check_fwstate(pmlmepriv, _FW_LINKED | WIFI_AP_STATE))
|
||||
return -EINVAL;
|
||||
|
||||
if (!mac) {
|
||||
|
|
@ -2549,7 +2549,7 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
|
|||
/* indicate ack before issue frame to avoid racing with rsp frame */
|
||||
rtw_cfg80211_mgmt_tx_status(padapter, *cookie, buf, len, ack, GFP_KERNEL);
|
||||
|
||||
if (rtw_action_frame_parse(buf, len, &category, &action) == false)
|
||||
if (!rtw_action_frame_parse(buf, len, &category, &action))
|
||||
goto exit;
|
||||
|
||||
rtw_ps_deny(padapter, PS_DENY_MGNT_TX);
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err)
|
|||
if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
|
||||
padapter->bSurpriseRemoved = true;
|
||||
|
||||
if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
|
||||
if (rtw_inc_and_chk_continual_io_error(psdiodev)) {
|
||||
padapter->bSurpriseRemoved = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -300,7 +300,7 @@ void sd_write32(struct intf_hdl *pintfhdl, u32 addr, u32 v, s32 *err)
|
|||
if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
|
||||
padapter->bSurpriseRemoved = true;
|
||||
|
||||
if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
|
||||
if (rtw_inc_and_chk_continual_io_error(psdiodev)) {
|
||||
padapter->bSurpriseRemoved = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ void _rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev)
|
|||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
s32 res = 0;
|
||||
|
||||
if (rtw_if_up(padapter) == false)
|
||||
if (!rtw_if_up(padapter))
|
||||
goto drop_packet;
|
||||
|
||||
rtw_check_xmit_resource(padapter, pkt);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user