From dc20d1da78a631b1c823b6cebbf8f659d0faac1d Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 21 Jul 2014 11:25:07 +0200 Subject: [PATCH] staging: rtl8723au: Reduce wrapper layers around hal_{de, }init() calls Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/hal/usb_halinit.c | 52 +++++--------------- drivers/staging/rtl8723au/include/hal_intf.h | 4 +- drivers/staging/rtl8723au/os_dep/os_intfs.c | 6 +-- drivers/staging/rtl8723au/os_dep/usb_intf.c | 2 +- 4 files changed, 19 insertions(+), 45 deletions(-) diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c index d896d06c627d..681810ea657b 100644 --- a/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -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; -} diff --git a/drivers/staging/rtl8723au/include/hal_intf.h b/drivers/staging/rtl8723au/include/hal_intf.h index 04223b5c047d..396decb44edc 100644 --- a/drivers/staging/rtl8723au/include/hal_intf.h +++ b/drivers/staging/rtl8723au/include/hal_intf.h @@ -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); diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c index a081e7ab97ae..b34eaec9dd48 100644 --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c @@ -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) diff --git a/drivers/staging/rtl8723au/os_dep/usb_intf.c b/drivers/staging/rtl8723au/os_dep/usb_intf.c index ec9021601b3e..aeaedcdbb422 100644 --- a/drivers/staging/rtl8723au/os_dep/usb_intf.c +++ b/drivers/staging/rtl8723au/os_dep/usb_intf.c @@ -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; -- 2.30.2