From 95311b478fea4c489603258549c16e5819c4c153 Mon Sep 17 00:00:00 2001 From: navin patidar Date: Fri, 6 Jun 2014 21:45:12 +0530 Subject: [PATCH] staging: rtl8188eu:Move rtw_hw_[suspend, resume]() to rtw_pwrctrl.c rtw_hw_[suspend,resume]() functions are used only in rtw_pwrctrl.c, so move these functions there. Signed-off-by: navin patidar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | 103 ++++++++++++++++++ .../staging/rtl8188eu/include/osdep_intf.h | 2 - drivers/staging/rtl8188eu/os_dep/usb_intf.c | 102 ----------------- 3 files changed, 103 insertions(+), 104 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c index 599f2b69873c..be4c0944f106 100644 --- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c @@ -23,6 +23,109 @@ #include #include #include +#include + +static int rtw_hw_suspend(struct adapter *padapter) +{ + struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; + struct net_device *pnetdev = padapter->pnetdev; + + + if ((!padapter->bup) || (padapter->bDriverStopped) || + (padapter->bSurpriseRemoved)) { + DBG_88E("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", + padapter->bup, padapter->bDriverStopped, + padapter->bSurpriseRemoved); + goto error_exit; + } + + /* system suspend */ + LeaveAllPowerSaveMode(padapter); + + DBG_88E("==> rtw_hw_suspend\n"); + _enter_pwrlock(&pwrpriv->lock); + pwrpriv->bips_processing = true; + /* s1. */ + if (pnetdev) { + netif_carrier_off(pnetdev); + netif_tx_stop_all_queues(pnetdev); + } + + /* s2. */ + rtw_disassoc_cmd(padapter, 500, false); + + /* s2-2. indicate disconnect to os */ + { + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + + if (check_fwstate(pmlmepriv, _FW_LINKED)) { + _clr_fwstate_(pmlmepriv, _FW_LINKED); + + rtw_led_control(padapter, LED_CTL_NO_LINK); + + rtw_os_indicate_disconnect(padapter); + + /* donnot enqueue cmd */ + rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0); + } + } + /* s2-3. */ + rtw_free_assoc_resources(padapter, 1); + + /* s2-4. */ + rtw_free_network_queue(padapter, true); + rtw_ips_dev_unload(padapter); + pwrpriv->rf_pwrstate = rf_off; + pwrpriv->bips_processing = false; + + _exit_pwrlock(&pwrpriv->lock); + + return 0; + +error_exit: + DBG_88E("%s, failed\n", __func__); + return -1; +} + +static int rtw_hw_resume(struct adapter *padapter) +{ + struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; + struct net_device *pnetdev = padapter->pnetdev; + + + /* system resume */ + DBG_88E("==> rtw_hw_resume\n"); + _enter_pwrlock(&pwrpriv->lock); + pwrpriv->bips_processing = true; + rtw_reset_drv_sw(padapter); + + if (pm_netdev_open(pnetdev, false) != 0) { + _exit_pwrlock(&pwrpriv->lock); + goto error_exit; + } + + netif_device_attach(pnetdev); + netif_carrier_on(pnetdev); + + if (!netif_queue_stopped(pnetdev)) + netif_start_queue(pnetdev); + else + netif_wake_queue(pnetdev); + + pwrpriv->bkeepfwalive = false; + pwrpriv->brfoffbyhw = false; + + pwrpriv->rf_pwrstate = rf_on; + pwrpriv->bips_processing = false; + + _exit_pwrlock(&pwrpriv->lock); + + + return 0; +error_exit: + DBG_88E("%s, Open net dev failed\n", __func__); + return -1; +} void ips_enter(struct adapter *padapter) { diff --git a/drivers/staging/rtl8188eu/include/osdep_intf.h b/drivers/staging/rtl8188eu/include/osdep_intf.h index c4599c583b59..a5b3bd313202 100644 --- a/drivers/staging/rtl8188eu/include/osdep_intf.h +++ b/drivers/staging/rtl8188eu/include/osdep_intf.h @@ -77,7 +77,5 @@ void rtw_ips_dev_unload(struct adapter *padapter); int rtw_ips_pwr_up(struct adapter *padapter); void rtw_ips_pwr_down(struct adapter *padapter); -int rtw_hw_suspend(struct adapter *padapter); -int rtw_hw_resume(struct adapter *padapter); #endif /* _OSDEP_INTF_H_ */ diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index a84ee9796ce6..25a931ac1fe3 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -234,108 +234,6 @@ static void rtw_dev_unload(struct adapter *padapter) RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-rtw_dev_unload\n")); } -int rtw_hw_suspend(struct adapter *padapter) -{ - struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; - struct net_device *pnetdev = padapter->pnetdev; - - - if ((!padapter->bup) || (padapter->bDriverStopped) || - (padapter->bSurpriseRemoved)) { - DBG_88E("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", - padapter->bup, padapter->bDriverStopped, - padapter->bSurpriseRemoved); - goto error_exit; - } - - /* system suspend */ - LeaveAllPowerSaveMode(padapter); - - DBG_88E("==> rtw_hw_suspend\n"); - _enter_pwrlock(&pwrpriv->lock); - pwrpriv->bips_processing = true; - /* s1. */ - if (pnetdev) { - netif_carrier_off(pnetdev); - netif_tx_stop_all_queues(pnetdev); - } - - /* s2. */ - rtw_disassoc_cmd(padapter, 500, false); - - /* s2-2. indicate disconnect to os */ - { - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - _clr_fwstate_(pmlmepriv, _FW_LINKED); - - rtw_led_control(padapter, LED_CTL_NO_LINK); - - rtw_os_indicate_disconnect(padapter); - - /* donnot enqueue cmd */ - rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0); - } - } - /* s2-3. */ - rtw_free_assoc_resources(padapter, 1); - - /* s2-4. */ - rtw_free_network_queue(padapter, true); - rtw_ips_dev_unload(padapter); - pwrpriv->rf_pwrstate = rf_off; - pwrpriv->bips_processing = false; - - _exit_pwrlock(&pwrpriv->lock); - - return 0; - -error_exit: - DBG_88E("%s, failed\n", __func__); - return -1; -} - -int rtw_hw_resume(struct adapter *padapter) -{ - struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; - struct net_device *pnetdev = padapter->pnetdev; - - - /* system resume */ - DBG_88E("==> rtw_hw_resume\n"); - _enter_pwrlock(&pwrpriv->lock); - pwrpriv->bips_processing = true; - rtw_reset_drv_sw(padapter); - - if (pm_netdev_open(pnetdev, false) != 0) { - _exit_pwrlock(&pwrpriv->lock); - goto error_exit; - } - - netif_device_attach(pnetdev); - netif_carrier_on(pnetdev); - - if (!netif_queue_stopped(pnetdev)) - netif_start_queue(pnetdev); - else - netif_wake_queue(pnetdev); - - pwrpriv->bkeepfwalive = false; - pwrpriv->brfoffbyhw = false; - - pwrpriv->rf_pwrstate = rf_on; - pwrpriv->bips_processing = false; - - _exit_pwrlock(&pwrpriv->lock); - - - return 0; -error_exit: - DBG_88E("%s, Open net dev failed\n", __func__); - return -1; -} - static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) { struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf); -- 2.30.2