mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
staging:r8188eu: replace enum WIFI_STATUS_CODE with native kernel definitions
Driver and kernel definitions are equal. Avoid code duplication, improve readability. Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20210131080618.25184-1-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d267cfb062
commit
6ee9e6ee5c
2 changed files with 22 additions and 36 deletions
|
@ -779,7 +779,7 @@ static void issue_auth(struct adapter *padapter, struct sta_info *psta,
|
|||
/* setting auth algo number */
|
||||
val16 = (u16)psta->authalg;
|
||||
|
||||
if (status != _STATS_SUCCESSFUL_)
|
||||
if (status != WLAN_STATUS_SUCCESS)
|
||||
val16 = 0;
|
||||
|
||||
if (val16) {
|
||||
|
@ -2675,13 +2675,13 @@ static unsigned int OnAuth(struct adapter *padapter,
|
|||
DBG_88E("auth rejected due to bad alg [alg=%d, auth_mib=%d] %02X%02X%02X%02X%02X%02X\n",
|
||||
algorithm, auth_mode, sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]);
|
||||
|
||||
status = _STATS_NO_SUPP_ALG_;
|
||||
status = WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
|
||||
|
||||
goto auth_fail;
|
||||
}
|
||||
|
||||
if (!rtw_access_ctrl(padapter, sa)) {
|
||||
status = _STATS_UNABLE_HANDLE_STA_;
|
||||
status = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
|
||||
goto auth_fail;
|
||||
}
|
||||
|
||||
|
@ -2692,7 +2692,7 @@ static unsigned int OnAuth(struct adapter *padapter,
|
|||
pstat = rtw_alloc_stainfo(pstapriv, sa);
|
||||
if (!pstat) {
|
||||
DBG_88E(" Exceed the upper limit of supported clients...\n");
|
||||
status = _STATS_UNABLE_HANDLE_STA_;
|
||||
status = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
|
||||
goto auth_fail;
|
||||
}
|
||||
|
||||
|
@ -2724,7 +2724,7 @@ static unsigned int OnAuth(struct adapter *padapter,
|
|||
if ((pstat->auth_seq + 1) != seq) {
|
||||
DBG_88E("(1)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n",
|
||||
seq, pstat->auth_seq + 1);
|
||||
status = _STATS_OUT_OF_AUTH_SEQ_;
|
||||
status = WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION;
|
||||
goto auth_fail;
|
||||
}
|
||||
|
||||
|
@ -2737,7 +2737,7 @@ static unsigned int OnAuth(struct adapter *padapter,
|
|||
} else {
|
||||
DBG_88E("(2)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n",
|
||||
seq, pstat->auth_seq + 1);
|
||||
status = _STATS_OUT_OF_AUTH_SEQ_;
|
||||
status = WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION;
|
||||
goto auth_fail;
|
||||
}
|
||||
} else { /* shared system or auto authentication */
|
||||
|
@ -2757,7 +2757,7 @@ static unsigned int OnAuth(struct adapter *padapter,
|
|||
|
||||
if (!p || ie_len <= 0) {
|
||||
DBG_88E("auth rejected because challenge failure!(1)\n");
|
||||
status = _STATS_CHALLENGE_FAIL_;
|
||||
status = WLAN_STATUS_CHALLENGE_FAIL;
|
||||
goto auth_fail;
|
||||
}
|
||||
|
||||
|
@ -2768,13 +2768,13 @@ static unsigned int OnAuth(struct adapter *padapter,
|
|||
pstat->expire_to = pstapriv->assoc_to;
|
||||
} else {
|
||||
DBG_88E("auth rejected because challenge failure!\n");
|
||||
status = _STATS_CHALLENGE_FAIL_;
|
||||
status = WLAN_STATUS_CHALLENGE_FAIL;
|
||||
goto auth_fail;
|
||||
}
|
||||
} else {
|
||||
DBG_88E("(3)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n",
|
||||
seq, pstat->auth_seq + 1);
|
||||
status = _STATS_OUT_OF_AUTH_SEQ_;
|
||||
status = WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION;
|
||||
goto auth_fail;
|
||||
}
|
||||
}
|
||||
|
@ -2782,7 +2782,7 @@ static unsigned int OnAuth(struct adapter *padapter,
|
|||
/* Now, we are going to issue_auth... */
|
||||
pstat->auth_seq = seq + 1;
|
||||
|
||||
issue_auth(padapter, pstat, (unsigned short)(_STATS_SUCCESSFUL_));
|
||||
issue_auth(padapter, pstat, (unsigned short)(WLAN_STATUS_SUCCESS));
|
||||
|
||||
if (pstat->state & WIFI_FW_AUTH_SUCCESS)
|
||||
pstat->auth_seq = 0;
|
||||
|
@ -2892,7 +2892,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
|
|||
int i, wpa_ie_len, left;
|
||||
unsigned char supportRate[16];
|
||||
int supportRateNum;
|
||||
unsigned short status = _STATS_SUCCESSFUL_;
|
||||
unsigned short status = WLAN_STATUS_SUCCESS;
|
||||
unsigned short frame_type, ie_offset = 0;
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
|
@ -2953,7 +2953,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
|
|||
!elems.ssid) {
|
||||
DBG_88E("STA %pM sent invalid association request\n",
|
||||
pstat->hwaddr);
|
||||
status = _STATS_FAILURE_;
|
||||
status = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
goto OnAssocReqFail;
|
||||
}
|
||||
|
||||
|
@ -2964,18 +2964,18 @@ static unsigned int OnAssocReq(struct adapter *padapter,
|
|||
|
||||
if (!p || ie_len == 0) {
|
||||
/* broadcast ssid, however it is not allowed in assocreq */
|
||||
status = _STATS_FAILURE_;
|
||||
status = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
goto OnAssocReqFail;
|
||||
} else {
|
||||
/* check if ssid match */
|
||||
if (memcmp((void *)(p + 2), cur->ssid.ssid, cur->ssid.ssid_length))
|
||||
status = _STATS_FAILURE_;
|
||||
status = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
|
||||
if (ie_len != cur->ssid.ssid_length)
|
||||
status = _STATS_FAILURE_;
|
||||
status = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
}
|
||||
|
||||
if (status != _STATS_SUCCESSFUL_)
|
||||
if (status != WLAN_STATUS_SUCCESS)
|
||||
goto OnAssocReqFail;
|
||||
|
||||
/* check if the supported rate is ok */
|
||||
|
@ -2986,7 +2986,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
|
|||
/* memcpy(supportRate, AP_BSSRATE, AP_BSSRATE_LEN); */
|
||||
/* supportRateNum = AP_BSSRATE_LEN; */
|
||||
|
||||
status = _STATS_FAILURE_;
|
||||
status = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
goto OnAssocReqFail;
|
||||
} else {
|
||||
memcpy(supportRate, p + 2, ie_len);
|
||||
|
@ -3066,7 +3066,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
|
|||
wpa_ie_len = 0;
|
||||
}
|
||||
|
||||
if (status != _STATS_SUCCESSFUL_)
|
||||
if (status != WLAN_STATUS_SUCCESS)
|
||||
goto OnAssocReqFail;
|
||||
|
||||
pstat->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS);
|
||||
|
@ -3097,7 +3097,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
|
|||
if (!selected_registrar) {
|
||||
DBG_88E("selected_registrar is false , or AP is not ready to do WPS\n");
|
||||
|
||||
status = _STATS_UNABLE_HANDLE_STA_;
|
||||
status = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
|
||||
|
||||
goto OnAssocReqFail;
|
||||
}
|
||||
|
@ -3198,7 +3198,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
|
|||
pstat->flags &= ~WLAN_STA_HT;
|
||||
}
|
||||
if ((!pmlmepriv->htpriv.ht_option) && (pstat->flags & WLAN_STA_HT)) {
|
||||
status = _STATS_FAILURE_;
|
||||
status = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
goto OnAssocReqFail;
|
||||
}
|
||||
|
||||
|
@ -3225,7 +3225,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
|
|||
else
|
||||
pstat->flags &= ~WLAN_STA_SHORT_PREAMBLE;
|
||||
|
||||
if (status != _STATS_SUCCESSFUL_)
|
||||
if (status != WLAN_STATUS_SUCCESS)
|
||||
goto OnAssocReqFail;
|
||||
|
||||
/* TODO: identify_proprietary_vendor_ie(); */
|
||||
|
@ -3276,7 +3276,7 @@ static unsigned int OnAssocReq(struct adapter *padapter,
|
|||
spin_unlock_bh(&pstapriv->asoc_list_lock);
|
||||
|
||||
/* now the station is qualified to join our BSS... */
|
||||
if ((pstat->state & WIFI_FW_ASSOC_SUCCESS) && (status == _STATS_SUCCESSFUL_)) {
|
||||
if ((pstat->state & WIFI_FW_ASSOC_SUCCESS) && (status == WLAN_STATUS_SUCCESS)) {
|
||||
/* 1 bss_cap_update & sta_info_update */
|
||||
bss_cap_update_on_sta_join(padapter, pstat);
|
||||
sta_info_update(padapter, pstat);
|
||||
|
|
|
@ -74,20 +74,6 @@ enum WIFI_FRAME_SUBTYPE {
|
|||
WIFI_QOS_DATA_NULL = (BIT(6) | WIFI_QOS_DATA_TYPE),
|
||||
};
|
||||
|
||||
enum WIFI_STATUS_CODE {
|
||||
_STATS_SUCCESSFUL_ = 0,
|
||||
_STATS_FAILURE_ = 1,
|
||||
_STATS_CAP_FAIL_ = 10,
|
||||
_STATS_NO_ASOC_ = 11,
|
||||
_STATS_OTHER_ = 12,
|
||||
_STATS_NO_SUPP_ALG_ = 13,
|
||||
_STATS_OUT_OF_AUTH_SEQ_ = 14,
|
||||
_STATS_CHALLENGE_FAIL_ = 15,
|
||||
_STATS_AUTH_TIMEOUT_ = 16,
|
||||
_STATS_UNABLE_HANDLE_STA_ = 17,
|
||||
_STATS_RATE_FAIL_ = 18,
|
||||
};
|
||||
|
||||
enum WIFI_REG_DOMAIN {
|
||||
DOMAIN_FCC = 1,
|
||||
DOMAIN_IC = 2,
|
||||
|
|
Loading…
Reference in a new issue