staging: r8188eu: drop unnecessary wrapper _rtw_init_mlme_priv
authorVihas Makwana <makvihas@gmail.com>
Fri, 22 Apr 2022 19:32:20 +0000 (01:02 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Apr 2022 09:34:36 +0000 (11:34 +0200)
Drop unnecessary wrapper _rtw_init_mlme_priv and move its logic to
rtw_init_mlme_priv.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
Link: https://lore.kernel.org/r/20220422193223.11948-5-makvihas@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_mlme.c

index 081c024..50a65a4 100644 (file)
@@ -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;
 }