Small code cleanup

This commit is contained in:
kimocoder 2022-03-05 02:57:48 +01:00
parent 2f52f84096
commit 37e27f9165
2 changed files with 1 additions and 73 deletions

View File

@ -32,7 +32,6 @@
extern int rtw_ht_enable;
#endif
#define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV+30)
#define SCAN_ITEM_SIZE 768
@ -120,18 +119,14 @@ static void indicate_wx_custom_event(_adapter *padapter, char *msg)
#ifndef CONFIG_IOCTL_CFG80211
wireless_send_event(padapter->pnetdev, IWEVCUSTOM, &wrqu, buff);
#endif
rtw_mfree(buff, IW_CUSTOM_MAX + 1);
}
static void request_wps_pbc_event(_adapter *padapter)
{
u8 *buff, *p;
union iwreq_data wrqu;
buff = rtw_malloc(IW_CUSTOM_MAX);
if (!buff)
return;
@ -169,7 +164,6 @@ void rtw_request_wps_pbc_event(_adapter *padapter)
kobject_hotplug(&padapter->pnetdev->class_dev.kobj, KOBJ_NET_PBC);
#endif
#else
if (padapter->pid[0] == 0) {
/* 0 is the default value and it means the application monitors the HW PBC doesn't privde its pid to driver. */
return;
@ -178,7 +172,6 @@ void rtw_request_wps_pbc_event(_adapter *padapter)
rtw_signal_process(padapter->pid[0], SIGUSR1);
#endif
rtw_led_control(padapter, LED_CTL_START_WPS_BOTTON);
}
#endif/* #ifdef CONFIG_SUPPORT_HW_WPS_PBC */
@ -195,7 +188,6 @@ void indicate_wx_scan_complete_event(_adapter *padapter)
#endif
}
void rtw_indicate_wx_assoc_event(_adapter *padapter)
{
union iwreq_data wrqu;
@ -573,7 +565,6 @@ static inline char *iwe_stream_wpa_wpa2_process(_adapter *padapter,
u8 *p;
sint out_len = 0;
if (pbuf) {
p = pbuf;
@ -681,7 +672,6 @@ static inline char *iwe_stream_wapi_process(_adapter *padapter,
RTW_INFO("rtw_wx_get_scan: %s ", pnetwork->network.Ssid.Ssid);
RTW_INFO("rtw_wx_get_scan: ssid = %d ", wapi_len);
if (wapi_len > 0) {
p = buf_wapi;
/* _rtw_memset(buf_wapi, 0, MAX_WAPI_IE_LEN*2); */
@ -874,8 +864,6 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
#endif /* CONFIG_P2P */
param->u.crypt.err = 0;
param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0';
@ -1037,8 +1025,6 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
#endif
exit:
return ret;
}
@ -1193,7 +1179,6 @@ static int rtw_set_wpa_ie(_adapter *padapter, char *pie, unsigned short ielen)
* || check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == _TRUE) */
rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr);
exit:
if (buf)
@ -1216,8 +1201,6 @@ static int rtw_wx_get_name(struct net_device *dev,
WLAN_BSSID_EX *pcur_bss = &pmlmepriv->cur_network.network;
NDIS_802_11_RATES_EX *prates = NULL;
if (check_fwstate(pmlmepriv, _FW_LINKED | WIFI_ADHOC_MASTER_STATE) == _TRUE) {
/* parsing HT_CAP_IE */
if( is_supported_ht(padapter->registrypriv.wireless_mode)&&(padapter->registrypriv.ht_enable)) {
@ -1271,8 +1254,6 @@ static int rtw_wx_get_name(struct net_device *dev,
/* snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11g"); */
snprintf(wrqu->name, IFNAMSIZ, "unassociated");
}
return 0;
}
@ -1436,8 +1417,6 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
rtw_indicate_connect(padapter);
exit:
return ret;
}
@ -1448,8 +1427,6 @@ static int rtw_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)
wrqu->mode = IW_MODE_INFRA;
else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE) ||
@ -1463,12 +1440,10 @@ static int rtw_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
else
wrqu->mode = IW_MODE_AUTO;
return 0;
}
static int rtw_wx_set_pmkid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
@ -1587,8 +1562,6 @@ static int rtw_wx_get_range(struct net_device *dev,
u16 val;
int i;
wrqu->data.length = sizeof(*range);
_rtw_memset(range, 0, sizeof(*range));
@ -1724,9 +1697,6 @@ static int rtw_wx_get_range(struct net_device *dev,
range->scan_capa = IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_BSSID |
IW_SCAN_CAPA_CHANNEL | IW_SCAN_CAPA_MODE | IW_SCAN_CAPA_RATE;
#endif
return 0;
}
@ -1861,8 +1831,6 @@ static int rtw_wx_get_wap(struct net_device *dev,
_rtw_memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
if (((check_fwstate(pmlmepriv, _FW_LINKED)) == _TRUE) ||
((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) == _TRUE) ||
((check_fwstate(pmlmepriv, WIFI_AP_STATE)) == _TRUE))
@ -1871,7 +1839,6 @@ static int rtw_wx_get_wap(struct net_device *dev,
else
_rtw_memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
return 0;
}
@ -1894,7 +1861,6 @@ static int rtw_wx_set_mlme(struct net_device *dev,
_adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
struct iw_mlme *mlme = (struct iw_mlme *) extra;
if (mlme == NULL)
return -1;
@ -1902,10 +1868,8 @@ static int rtw_wx_set_mlme(struct net_device *dev,
reason = cpu_to_le16(mlme->reason_code);
RTW_INFO("%s, cmd=%d, reason=%d\n", __FUNCTION__, mlme->cmd, reason);
switch (mlme->cmd) {
case IW_MLME_DEAUTH:
if (!rtw_set_802_11_disassociate(padapter))
@ -2112,7 +2076,6 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
len -= sec_len;
break;
case WEXT_CSCAN_CHANNEL_SECTION:
/* RTW_INFO("WEXT_CSCAN_CHANNEL_SECTION\n"); */
pos += 1;
@ -2285,13 +2248,10 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
exit:
#ifdef DBG_IOCTL
RTW_INFO("DBG_IOCTL %s:%d return %d\n", __FUNCTION__, __LINE__, ret);
#endif
return ret ;
}
/* set ssid flow
@ -2315,7 +2275,6 @@ static int rtw_wx_set_essid(struct net_device *dev,
uint ret = 0, len;
#ifdef DBG_IOCTL
RTW_INFO("DBG_IOCTL %s:%d\n", __FUNCTION__, __LINE__);
#endif
@ -2333,8 +2292,6 @@ static int rtw_wx_set_essid(struct net_device *dev,
goto exit;
}
rtw_ps_deny(padapter, PS_DENY_JOIN);
if (_FAIL == rtw_pwr_wakeup(padapter)) {
ret = -1;
@ -2409,7 +2366,6 @@ static int rtw_wx_set_essid(struct net_device *dev,
dst_ssid = pnetwork->network.Ssid.Ssid;
if ((_rtw_memcmp(dst_ssid, src_ssid, ndis_ssid.SsidLength) == _TRUE) &&
(pnetwork->network.Ssid.SsidLength == ndis_ssid.SsidLength)) {
@ -2445,8 +2401,6 @@ exit:
#ifdef DBG_IOCTL
RTW_INFO("DBG_IOCTL %s:%d return %d\n", __FUNCTION__, __LINE__, ret);
#endif
return ret;
}
@ -2554,7 +2508,6 @@ set_rate:
ret = -1;
}
return ret;
}
@ -2594,7 +2547,6 @@ static int rtw_wx_set_rts(struct net_device *dev,
RTW_INFO("%s, rts_thresh=%d\n", __func__, padapter->registrypriv.rts_thresh);
return 0;
}
@ -2653,7 +2605,6 @@ static int rtw_wx_get_frag(struct net_device *dev,
wrqu->frag.fixed = 0; /* no auto select */
/* wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FRAG_THRESHOLD); */
return 0;
}
@ -2663,7 +2614,6 @@ static int rtw_wx_get_retry(struct net_device *dev,
{
/* _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); */
wrqu->retry.value = 7;
wrqu->retry.fixed = 0; /* no auto select */
wrqu->retry.disabled = 1;
@ -2713,7 +2663,6 @@ static int rtw_wx_set_enc(struct net_device *dev,
key = erq->flags & IW_ENCODE_INDEX;
if (erq->flags & IW_ENCODE_DISABLED) {
RTW_INFO("EncryptionDisabled\n");
padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled;
@ -2819,8 +2768,6 @@ static int rtw_wx_set_enc(struct net_device *dev,
}
exit:
return ret;
}
@ -2905,7 +2852,6 @@ static int rtw_wx_get_enc(struct net_device *dev,
}
return ret;
}
@ -3342,7 +3288,6 @@ static int rtw_wx_write32(struct net_device *dev,
u32 data32;
u32 bytes;
bytes = 0;
addr = 0;
data32 = 0;
@ -3732,7 +3677,6 @@ static int rtw_get_ap_info(struct net_device *dev,
break;
}
/* pdata->length = 0; */ /* ? */
pdata->flags = 0;
if (pdata->length >= 32) {
@ -3796,7 +3740,6 @@ static int rtw_get_ap_info(struct net_device *dev,
}
exit:
return ret;
}

View File

@ -67,7 +67,6 @@ int rtw_os_alloc_recvframe(_adapter *padapter, union recv_frame *precvframe, u8
return res;
}
/* Modified by Albert 20101213 */
/* For 8 bytes IP header alignment. */
shift_sz = pattrib->qos ? 6 : 0; /* Qos data, wireless lan header length is 26 */
@ -174,7 +173,6 @@ int rtw_os_recv_resource_init(struct recv_priv *precvpriv, _adapter *padapter)
#ifdef CONFIG_RTW_NAPI
skb_queue_head_init(&precvpriv->rx_napi_skb_queue);
#endif /* CONFIG_RTW_NAPI */
return res;
}
@ -182,9 +180,7 @@ int rtw_os_recv_resource_init(struct recv_priv *precvpriv, _adapter *padapter)
int rtw_os_recv_resource_alloc(_adapter *padapter, union recv_frame *precvframe)
{
int res = _SUCCESS;
precvframe->u.hdr.pkt = NULL;
return res;
}
@ -194,14 +190,11 @@ void rtw_os_recv_resource_free(struct recv_priv *precvpriv)
sint i;
union recv_frame *precvframe;
precvframe = (union recv_frame *) precvpriv->precv_frame_buf;
#ifdef CONFIG_RTW_NAPI
if (skb_queue_len(&precvpriv->rx_napi_skb_queue))
RTW_WARN("rx_napi_skb_queue not empty\n");
rtw_skb_queue_purge(&precvpriv->rx_napi_skb_queue);
#endif /* CONFIG_RTW_NAPI */
for (i = 0; i < NR_RECVFRAME; i++) {
rtw_os_free_recvframe(precvframe);
precvframe++;
@ -240,9 +233,7 @@ int rtw_os_recvbuf_resource_alloc(_adapter *padapter, struct recv_buf *precvbuf)
if (precvbuf->pallocated_buf == NULL)
return _FAIL;
#endif /* CONFIG_USE_USB_BUFFER_ALLOC_RX */
#endif /* CONFIG_USB_HCI */
return res;
}
@ -252,7 +243,6 @@ int rtw_os_recvbuf_resource_free(_adapter *padapter, struct recv_buf *precvbuf)
int ret = _SUCCESS;
#ifdef CONFIG_USB_HCI
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
@ -279,7 +269,6 @@ int rtw_os_recvbuf_resource_free(_adapter *padapter, struct recv_buf *precvbuf)
rtw_skb_free(precvbuf->pskb);
}
return ret;
}
_pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, const u8 *da, const u8 *sa, u8 *msdu ,u16 msdu_len)
@ -409,7 +398,6 @@ void dynamic_napi_th_chk (_adapter *adapter)
if (adapter->registrypriv.en_napi) {
struct dvobj_priv *dvobj;
struct registry_priv *registry;
dvobj = adapter_to_dvobj(adapter);
registry = &adapter->registrypriv;
if (dvobj->traffic_stat.cur_rx_tp > registry->napi_threshold)
@ -525,8 +513,7 @@ void rtw_os_recv_indicate_pkt(_adapter *padapter, _pkt *pkt, union recv_frame *r
#ifdef CONFIG_RTW_NAPI
#ifdef CONFIG_RTW_NAPI_DYNAMIC
if (!skb_queue_empty(&precvpriv->rx_napi_skb_queue)
&& !adapter_to_dvobj(padapter)->en_napi_dynamic
)
&& !adapter_to_dvobj(padapter)->en_napi_dynamic)
napi_recv(padapter, RTL_NAPI_WEIGHT);
#endif
@ -734,11 +721,9 @@ void rtw_os_read_port(_adapter *padapter, struct recv_buf *precvbuf)
if (precvbuf->irp_pending == _FALSE)
rtw_read_port(padapter, precvpriv->ff_hwaddr, 0, (unsigned char *)precvbuf);
#endif
#if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
precvbuf->pskb = NULL;
#endif
}