int rtw_hw_suspend23a(struct rtw_adapter *padapter) { struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct net_device *pnetdev = padapter->pnetdev; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) { DBG_8723A("padapter->bup =%d bDriverStopped =%d bSurpriseRemoved = %d\n", padapter->bup, padapter->bDriverStopped, padapter->bSurpriseRemoved); goto error_exit; } if (padapter) { /* system suspend */ LeaveAllPowerSaveMode23a(padapter); DBG_8723A("==> rtw_hw_suspend23a\n"); down(&pwrpriv->lock); pwrpriv->bips_processing = true; /* padapter->net_closed = true; */ /* s1. */ if (pnetdev) { netif_carrier_off(pnetdev); netif_tx_stop_all_queues(pnetdev); } /* s2. */ rtw_disassoc_cmd23a(padapter, 500, false); /* s2-2. indicate disconnect to os */ /* rtw_indicate_disconnect23a(padapter); */ if (check_fwstate(pmlmepriv, _FW_LINKED)) { _clr_fwstate_(pmlmepriv, _FW_LINKED); rtw_led_control(padapter, LED_CTL_NO_LINK); rtw_os_indicate_disconnect23a(padapter); /* donnot enqueue cmd */ rtw_lps_ctrl_wk_cmd23a(padapter, LPS_CTRL_DISCONNECT, 0); } /* s2-3. */ rtw_free_assoc_resources23a(padapter, 1); /* s2-4. */ rtw_free_network_queue23a(padapter); rtw_ips_dev_unload23a(padapter); pwrpriv->rf_pwrstate = rf_off; pwrpriv->bips_processing = false; up(&pwrpriv->lock); } else { goto error_exit; } return 0; error_exit: DBG_8723A("%s, failed\n", __func__); return -1; }
static void rtw_usb_if1_deinit(struct rtw_adapter *if1) { struct net_device *pnetdev = if1->pnetdev; struct mlme_priv *pmlmepriv = &if1->mlmepriv; if (check_fwstate(pmlmepriv, _FW_LINKED)) rtw_disassoc_cmd23a(if1, 0, false); #ifdef CONFIG_8723AU_AP_MODE free_mlme_ap_info23a(if1); #endif if (pnetdev) unregister_netdev(pnetdev); /* will call netdev_close() */ rtw_cancel_all_timer23a(if1); rtw_dev_unload(if1); DBG_8723A("+r871xu_dev_remove, hw_init_completed =%d\n", if1->hw_init_completed); if (if1->rtw_wdev) { rtw_wdev_unregister(if1->rtw_wdev); rtw_wdev_free(if1->rtw_wdev); } #ifdef CONFIG_8723AU_BT_COEXIST if (1 == if1->pwrctrlpriv.autopm_cnt) { usb_autopm_put_interface(adapter_to_dvobj(if1)->pusbintf); if1->pwrctrlpriv.autopm_cnt--; } #endif rtw_free_drv_sw23a(if1); if (pnetdev) free_netdev(pnetdev); }
static int netdev_close(struct net_device *pnetdev) { struct rtw_adapter *padapter = netdev_priv(pnetdev); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+871x_drv - drv_close\n")); padapter->net_closed = true; if (padapter->pwrctrlpriv.rf_pwrstate == rf_on) { DBG_8723A("(2)871x_drv - drv_close, bup =%d, " "hw_init_completed =%d\n", padapter->bup, padapter->hw_init_completed); /* s1. */ if (pnetdev) { if (!rtw_netif_queue_stopped(pnetdev)) netif_tx_stop_all_queues(pnetdev); } /* s2. */ LeaveAllPowerSaveMode23a(padapter); rtw_disassoc_cmd23a(padapter, 500, false); /* s2-2. indicate disconnect to os */ rtw_indicate_disconnect23a(padapter); /* s2-3. */ rtw_free_assoc_resources23a(padapter, 1); /* s2-4. */ rtw_free_network_queue23a(padapter); /* Close LED */ rtw_led_control(padapter, LED_CTL_POWER_OFF); } rtw_scan_abort23a(padapter); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-871x_drv - drv_close\n")); DBG_8723A("-871x_drv - drv_close, bup =%d\n", padapter->bup); return 0; }
static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) { struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf); struct rtw_adapter *padapter = dvobj->if1; struct net_device *pnetdev = padapter->pnetdev; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; int ret = 0; unsigned long start_time = jiffies; DBG_8723A("==> %s (%s:%d)\n", __func__, current->comm, current->pid); if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) { DBG_8723A("padapter->bup =%d bDriverStopped =%d bSurpriseRemoved = %d\n", padapter->bup, padapter->bDriverStopped, padapter->bSurpriseRemoved); goto exit; } pwrpriv->bInSuspend = true; rtw_cancel_all_timer23a(padapter); LeaveAllPowerSaveMode23a(padapter); down(&pwrpriv->lock); /* padapter->net_closed = true; */ /* s1. */ if (pnetdev) { netif_carrier_off(pnetdev); netif_tx_stop_all_queues(pnetdev); } /* s2. */ rtw_disassoc_cmd23a(padapter, 0, false); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) { DBG_8723A("%s:%d %s(%pM), length:%d assoc_ssid.length:%d\n", __func__, __LINE__, pmlmepriv->cur_network.network.Ssid.ssid, pmlmepriv->cur_network.network.MacAddress, pmlmepriv->cur_network.network.Ssid.ssid_len, pmlmepriv->assoc_ssid.ssid_len); rtw_set_roaming(padapter, 1); } /* s2-2. indicate disconnect to os */ rtw_indicate_disconnect23a(padapter); /* s2-3. */ rtw_free_assoc_resources23a(padapter, 1); /* s2-4. */ rtw_free_network_queue23a(padapter); rtw_dev_unload(padapter); up(&pwrpriv->lock); if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) rtw_cfg80211_indicate_scan_done( wdev_to_priv(padapter->rtw_wdev), true); if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) rtw_indicate_disconnect23a(padapter); exit: DBG_8723A("<=== %s return %d.............. in %dms\n", __func__, ret, jiffies_to_msecs(jiffies - start_time)); return ret; }