staging: rtl8723au: Reduce wrapper layers around hal_{de, }init() calls
authorJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 21 Jul 2014 09:25:07 +0000 (11:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Jul 2014 19:09:28 +0000 (12:09 -0700)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/hal/usb_halinit.c
drivers/staging/rtl8723au/include/hal_intf.h
drivers/staging/rtl8723au/os_dep/os_intfs.c
drivers/staging/rtl8723au/os_dep/usb_intf.c

index d896d06c627d3209228bcde76a8cbfefcad7b431..681810ea657bf5b76df2b4a8986e6453bc3ed25e 100644 (file)
@@ -534,7 +534,7 @@ enum rt_rf_power_state RfOnOffDetect23a(struct rtw_adapter *pAdapter)
 
 void _ps_open_RF23a(struct rtw_adapter *padapter);
 
-static int rtl8723au_hal_init(struct rtw_adapter *Adapter)
+int rtl8723au_hal_init(struct rtw_adapter *Adapter)
 {
        u8 val8 = 0;
        u32 boundary;
@@ -545,6 +545,8 @@ static int rtl8723au_hal_init(struct rtw_adapter *Adapter)
 
        unsigned long init_start_time = jiffies;
 
+       Adapter->hw_init_completed = false;
+
        if (Adapter->pwrctrlpriv.bkeepfwalive) {
                _ps_open_RF23a(Adapter);
 
@@ -796,6 +798,13 @@ static int rtl8723au_hal_init(struct rtw_adapter *Adapter)
                          rtl8723au_read32(Adapter, REG_FWHW_TXQ_CTRL)|BIT(12));
 
 exit:
+       if (status == _SUCCESS) {
+               Adapter->hw_init_completed = true;
+
+               if (Adapter->registrypriv.notch_filter == 1)
+                       rtl8723a_notch_filter(Adapter, 1);
+       }
+
        DBG_8723A("%s in %dms\n", __func__,
                  jiffies_to_msecs(jiffies - init_start_time));
        return status;
@@ -1105,7 +1114,7 @@ static void CardDisableRTL8723U(struct rtw_adapter *Adapter)
        rtl8723au_write8(Adapter, REG_RSV_CTRL, 0x0e);
 }
 
-static int rtl8723au_hal_deinit(struct rtw_adapter *padapter)
+int rtl8723au_hal_deinit(struct rtw_adapter *padapter)
 {
        DBG_8723A("==> %s\n", __func__);
 
@@ -1118,6 +1127,8 @@ static int rtl8723au_hal_deinit(struct rtw_adapter *padapter)
        /*  IC. Accord to johnny's opinion, only RU need the support. */
        CardDisableRTL8723U(padapter);
 
+       padapter->hw_init_completed = false;
+
        return _SUCCESS;
 }
 
@@ -1543,40 +1554,3 @@ void rtl8723a_update_ramask(struct rtw_adapter *padapter,
        /* set correct initial date rate for each mac_id */
        pdmpriv->INIDATA_RATE[mac_id] = init_rate;
 }
-
-int rtw_hal_init23a(struct rtw_adapter *padapter)
-{
-       int status;
-
-       padapter->hw_init_completed = false;
-
-       status = rtl8723au_hal_init(padapter);
-
-       if (status == _SUCCESS) {
-               padapter->hw_init_completed = true;
-
-               if (padapter->registrypriv.notch_filter == 1)
-                       rtl8723a_notch_filter(padapter, 1);
-       } else {
-               padapter->hw_init_completed = false;
-               DBG_8723A("rtw_hal_init23a: hal__init fail\n");
-       }
-
-       RT_TRACE(_module_hal_init_c_, _drv_err_,
-                ("-rtl871x_hal_init:status = 0x%x\n", status));
-
-       return status;
-}
-
-int rtw_hal_deinit23a(struct rtw_adapter *padapter)
-{
-       int status;
-
-       status = rtl8723au_hal_deinit(padapter);
-
-       if (status == _SUCCESS)
-               padapter->hw_init_completed = false;
-       else
-               DBG_8723A("\n rtw_hal_deinit23a: hal_init fail\n");
-       return status;
-}
index 04223b5c047deea36933b345574248a901d8fac9..396decb44edc58e4c664bc1138093cf8df04163a 100644 (file)
@@ -103,8 +103,8 @@ void rtw_hal_def_value_init23a(struct rtw_adapter *padapter);
 int pm_netdev_open23a(struct net_device *pnetdev, u8 bnormal);
 int rtw_resume_process23a(struct rtw_adapter *padapter);
 
-int rtw_hal_init23a(struct rtw_adapter *padapter);
-int rtw_hal_deinit23a(struct rtw_adapter *padapter);
+int rtl8723au_hal_init(struct rtw_adapter *padapter);
+int rtl8723au_hal_deinit(struct rtw_adapter *padapter);
 void rtw_hal_stop(struct rtw_adapter *padapter);
 
 void rtw_hal_update_ra_mask23a(struct sta_info *psta, u8 rssi_level);
index a081e7ab97aebdf49caf1fbbd23b291dbf1bdf33..b34eaec9dd48d9aaacc100ea27f5e473043b670e 100644 (file)
@@ -666,7 +666,7 @@ int netdev_open23a(struct net_device *pnetdev)
                padapter->bSurpriseRemoved = false;
                padapter->bCardDisableWOHSM = false;
 
-               status = rtw_hal_init23a(padapter);
+               status = rtl8723au_hal_init(padapter);
                if (status == _FAIL) {
                        RT_TRACE(_module_os_intfs_c_, _drv_err_,
                                 ("rtl871x_hal_init(): Can't init h/w!\n"));
@@ -735,7 +735,7 @@ static int ips_netdrv_open(struct rtw_adapter *padapter)
        padapter->bSurpriseRemoved = false;
        padapter->bCardDisableWOHSM = false;
 
-       status = rtw_hal_init23a(padapter);
+       status = rtl8723au_hal_init(padapter);
        if (status == _FAIL) {
                RT_TRACE(_module_os_intfs_c_, _drv_err_,
                         ("ips_netdrv_open(): Can't init h/w!\n"));
@@ -800,7 +800,7 @@ void rtw_ips_dev_unload23a(struct rtw_adapter *padapter)
 
        /* s5. */
        if (!padapter->bSurpriseRemoved)
-               rtw_hal_deinit23a(padapter);
+               rtl8723au_hal_deinit(padapter);
 }
 
 int pm_netdev_open23a(struct net_device *pnetdev, u8 bnormal)
index ec9021601b3ed9c694fa361f1c164305d9ff2563..aeaedcdbb422301f2523eb75e97d6f47b8dcac97 100644 (file)
@@ -303,7 +303,7 @@ static void rtw_dev_unload(struct rtw_adapter *padapter)
 
                /* s5. */
                if (!padapter->bSurpriseRemoved) {
-                       rtw_hal_deinit23a(padapter);
+                       rtl8723au_hal_deinit(padapter);
                        padapter->bSurpriseRemoved = true;
                }
                padapter->bup = false;