/* dev_remove() - our device is being removed */ static void rtw_disconnect(struct usb_interface *pusb_intf) { struct dvobj_priv *dvobj; struct rtw_adapter *padapter; struct net_device *pnetdev; struct mlme_priv *pmlmepriv; dvobj = usb_get_intfdata(pusb_intf); if (!dvobj) return; padapter = dvobj->if1; pnetdev = padapter->pnetdev; pmlmepriv = &padapter->mlmepriv; usb_set_intfdata(pusb_intf, NULL); RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+dev_remove()\n")); rtw_pm_set_ips23a(padapter, IPS_NONE); rtw_pm_set_lps23a(padapter, PS_MODE_ACTIVE); LeaveAllPowerSaveMode23a(padapter); rtw_usb_if1_deinit(padapter); usb_dvobj_deinit(pusb_intf); RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-dev_remove()\n")); DBG_8723A("-r871xu_dev_remove, done\n"); return; }
/* rmmod module & unplug(SurpriseRemoved) will call r871xu_dev_remove() => how to recognize both */ static void rtw_dev_remove(struct usb_interface *pusb_intf) { struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf); struct adapter *padapter = dvobj->if1; DBG_88E("+rtw_dev_remove\n"); RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+dev_remove()\n")); if (!pusb_intf->unregistering) padapter->bSurpriseRemoved = true; rtw_pm_set_ips(padapter, IPS_NONE); rtw_pm_set_lps(padapter, PS_MODE_ACTIVE); LeaveAllPowerSaveMode(padapter); rtw_usb_if1_deinit(padapter); usb_dvobj_deinit(pusb_intf); RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-dev_remove()\n")); DBG_88E("-r871xu_dev_remove, done\n"); return; }
static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid) { struct adapter *if1 = NULL; struct dvobj_priv *dvobj; /* Initialize dvobj_priv */ dvobj = usb_dvobj_init(pusb_intf); if (!dvobj) { RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("initialize device object priv Failed!\n")); goto exit; } if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid); if (!if1) { pr_debug("rtw_init_primarystruct adapter Failed!\n"); goto free_dvobj; } return 0; free_dvobj: usb_dvobj_deinit(pusb_intf); exit: return -ENODEV; }
static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid) { struct rtw_adapter *if1 = NULL; struct dvobj_priv *dvobj; int status = _FAIL; RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_init\n")); /* Initialize dvobj_priv */ dvobj = usb_dvobj_init(pusb_intf); if (!dvobj) { RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("initialize device object priv Failed!\n")); goto exit; } if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid); if (!if1) { DBG_8723A("rtw_init_primary_adapter Failed!\n"); goto free_dvobj; } /* dev_alloc_name && register_netdev */ status = rtw_drv_register_netdev(if1); if (status != _SUCCESS) goto free_if1; RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-871x_drv - drv_init, success!\n")); status = _SUCCESS; free_if1: if (status != _SUCCESS && if1) rtw_usb_if1_deinit(if1); free_dvobj: if (status != _SUCCESS) usb_dvobj_deinit(pusb_intf); exit: return status == _SUCCESS ? 0 : -ENODEV; }
static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid) { struct adapter *if1 = NULL; int status = _FAIL; struct dvobj_priv *dvobj; RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_init\n")); /* Initialize dvobj_priv */ dvobj = usb_dvobj_init(pusb_intf); if (dvobj == NULL) { RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("initialize device object priv Failed!\n")); goto exit; } if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid); if (if1 == NULL) { DBG_88E("rtw_init_primarystruct adapter Failed!\n"); goto free_dvobj; } if (ui_pid[1] != 0) { DBG_88E("ui_pid[1]:%d\n", ui_pid[1]); rtw_signal_process(ui_pid[1], SIGUSR2); } RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-871x_drv - drv_init, success!\n")); status = _SUCCESS; free_dvobj: if (status != _SUCCESS) usb_dvobj_deinit(pusb_intf); exit: return status == _SUCCESS ? 0 : -ENODEV; }