Commit 95311b47 authored by navin patidar's avatar navin patidar Committed by Greg Kroah-Hartman

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: default avatarnavin patidar <navin.patidar@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 418f9642
...@@ -23,6 +23,109 @@ ...@@ -23,6 +23,109 @@
#include <drv_types.h> #include <drv_types.h>
#include <osdep_intf.h> #include <osdep_intf.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <usb_osintf.h>
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) void ips_enter(struct adapter *padapter)
{ {
......
...@@ -77,7 +77,5 @@ void rtw_ips_dev_unload(struct adapter *padapter); ...@@ -77,7 +77,5 @@ void rtw_ips_dev_unload(struct adapter *padapter);
int rtw_ips_pwr_up(struct adapter *padapter); int rtw_ips_pwr_up(struct adapter *padapter);
void rtw_ips_pwr_down(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_ */ #endif /* _OSDEP_INTF_H_ */
...@@ -234,108 +234,6 @@ static void rtw_dev_unload(struct adapter *padapter) ...@@ -234,108 +234,6 @@ static void rtw_dev_unload(struct adapter *padapter)
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-rtw_dev_unload\n")); 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) static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
{ {
struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf); struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment