Drop unnecessary wrapper _rtw_init_mlme_priv and move its logic to rtw_init_mlme_priv. Reviewed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Signed-off-by: Vihas Makwana <makvihas@xxxxxxxxx> --- drivers/staging/r8188eu/core/rtw_mlme.c | 103 +++++++++++------------- 1 file changed, 47 insertions(+), 56 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 081c02417..50a65a4e2 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -30,60 +30,6 @@ u8 rtw_to_roaming(struct adapter *adapter) return adapter->mlmepriv.to_roaming; } -static int _rtw_init_mlme_priv(struct adapter *padapter) -{ - int i; - u8 *pbuf; - struct wlan_network *pnetwork; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - int res = _SUCCESS; - - /* We don't need to memset padapter->XXX to zero, because adapter is allocated by vzalloc(). */ - - pmlmepriv->nic_hdl = (u8 *)padapter; - - pmlmepriv->pscanned = NULL; - pmlmepriv->fw_state = 0; - pmlmepriv->cur_network.network.InfrastructureMode = Ndis802_11AutoUnknown; - pmlmepriv->scan_mode = SCAN_ACTIVE;/* 1: active, 0: pasive. Maybe someday we should rename this varable to "active_mode" (Jeff) */ - - spin_lock_init(&pmlmepriv->lock); - rtw_init_queue(&pmlmepriv->free_bss_pool); - rtw_init_queue(&pmlmepriv->scanned_queue); - - set_scanned_network_val(pmlmepriv, 0); - - memset(&pmlmepriv->assoc_ssid, 0, sizeof(struct ndis_802_11_ssid)); - - pbuf = vzalloc(MAX_BSS_CNT * (sizeof(struct wlan_network))); - - if (!pbuf) { - res = _FAIL; - goto exit; - } - pmlmepriv->free_bss_buf = pbuf; - - pnetwork = (struct wlan_network *)pbuf; - - for (i = 0; i < MAX_BSS_CNT; i++) { - INIT_LIST_HEAD(&pnetwork->list); - - list_add_tail(&pnetwork->list, &pmlmepriv->free_bss_pool.queue); - - pnetwork++; - } - - /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ - - rtw_clear_scan_deny(padapter); - - rtw_init_mlme_timer(padapter); - -exit: - - return res; -} - static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen) { kfree(*ppie); @@ -289,9 +235,54 @@ u8 *rtw_get_beacon_interval_from_ie(u8 *ie) int rtw_init_mlme_priv(struct adapter *padapter)/* struct mlme_priv *pmlmepriv) */ { - int res; + int i; + u8 *pbuf; + struct wlan_network *pnetwork; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + int res = _SUCCESS; + + /* We don't need to memset padapter->XXX to zero, because adapter is allocated by vzalloc(). */ + + pmlmepriv->nic_hdl = (u8 *)padapter; + + pmlmepriv->pscanned = NULL; + pmlmepriv->fw_state = 0; + pmlmepriv->cur_network.network.InfrastructureMode = Ndis802_11AutoUnknown; + pmlmepriv->scan_mode = SCAN_ACTIVE;/* 1: active, 0: pasive. Maybe someday we should rename this varable to "active_mode" (Jeff) */ + + spin_lock_init(&pmlmepriv->lock); + rtw_init_queue(&pmlmepriv->free_bss_pool); + rtw_init_queue(&pmlmepriv->scanned_queue); + + set_scanned_network_val(pmlmepriv, 0); + + memset(&pmlmepriv->assoc_ssid, 0, sizeof(struct ndis_802_11_ssid)); - res = _rtw_init_mlme_priv(padapter);/* (pmlmepriv); */ + pbuf = vzalloc(MAX_BSS_CNT * (sizeof(struct wlan_network))); + + if (!pbuf) { + res = _FAIL; + goto exit; + } + pmlmepriv->free_bss_buf = pbuf; + + pnetwork = (struct wlan_network *)pbuf; + + for (i = 0; i < MAX_BSS_CNT; i++) { + INIT_LIST_HEAD(&pnetwork->list); + + list_add_tail(&pnetwork->list, &pmlmepriv->free_bss_pool.queue); + + pnetwork++; + } + + /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */ + + rtw_clear_scan_deny(padapter); + + rtw_init_mlme_timer(padapter); + +exit: return res; } -- 2.30.2