rtl8188eu: Fix checkpatch errors in os_dep/usb_intf.c

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-08-11 20:59:28 -05:00
parent b5d91ff7e0
commit 30b92ac1c6
2 changed files with 273 additions and 313 deletions

View file

@ -37,4 +37,6 @@ void *scdb_findEntry(struct adapter *priv, unsigned char *macAddr, unsigned char
void nat25_db_expire(struct adapter *priv);
int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method);
int rtw_resume_process(struct adapter *padapter);
#endif

View file

@ -38,7 +38,6 @@ int ui_pid[3] = {0, 0, 0};
static int rtw_suspend(struct usb_interface *intf, pm_message_t message);
static int rtw_resume(struct usb_interface *intf);
int rtw_resume_process(struct adapter *padapter);
static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid);
@ -101,48 +100,33 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf);
#define USB_VENDER_ID_REALTEK 0x0BDA
/* DID_USB_v916_20130116 */
#define RTL8188E_USB_IDS \
/*=== Realtek demoboard ===*/ \
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8179)}, /* 8188EUS */ \
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */ \
/*=== Customer ID ===*/ \
/****** 8188EUS ********/ \
{USB_DEVICE(0x8179, 0x07B8)}, /* Abocom - Abocom */
static struct usb_device_id rtw_usb_id_tbl[] = {
RTL8188E_USB_IDS
/*=== Realtek demoboard ===*/
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8179)}, /* 8188EUS */
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */
/*=== Customer ID ===*/
/****** 8188EUS ********/
{USB_DEVICE(0x8179, 0x07B8)}, /* Abocom - Abocom */
{} /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, rtw_usb_id_tbl);
//int const rtw_usb_id_len = sizeof(rtw_usb_id_tbl) / sizeof(struct usb_device_id);
static struct specific_device_id specific_device_id_tbl[] = {
{.idVendor=USB_VENDER_ID_REALTEK, .idProduct=0x8177, .flags=SPEC_DEV_ID_DISABLE_HT},//8188cu 1*1 dongole, (b/g mode only)
{.idVendor=USB_VENDER_ID_REALTEK, .idProduct=0x817E, .flags=SPEC_DEV_ID_DISABLE_HT},//8188CE-VAU USB minCard (b/g mode only)
{.idVendor=0x0b05, .idProduct=0x1791, .flags=SPEC_DEV_ID_DISABLE_HT},
{.idVendor=0x13D3, .idProduct=0x3311, .flags=SPEC_DEV_ID_DISABLE_HT},
{.idVendor=0x13D3, .idProduct=0x3359, .flags=SPEC_DEV_ID_DISABLE_HT},//Russian customer -Azwave (8188CE-VAU g mode)
{}
{} /* empty table for now */
};
struct rtw_usb_drv {
struct usb_driver usbdrv;
int drv_registered;
struct mutex hw_init_mutex;
};
static struct usb_device_id rtl8188e_usb_id_tbl[] ={
RTL8188E_USB_IDS
{} /* Terminating entry */
};
static struct rtw_usb_drv rtl8188e_usb_drv = {
.usbdrv.name = (char *)"rtl8188eu",
.usbdrv.probe = rtw_drv_init,
.usbdrv.disconnect = rtw_dev_remove,
.usbdrv.id_table = rtl8188e_usb_id_tbl,
.usbdrv.id_table = rtw_usb_id_tbl,
.usbdrv.suspend = rtw_suspend,
.usbdrv.resume = rtw_resume,
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))
@ -154,37 +138,37 @@ static struct rtw_usb_drv *usb_drv = &rtl8188e_usb_drv;
static inline int RT_usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
{
return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
return (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN;
}
static inline int RT_usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd)
{
return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
return (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT;
}
static inline int RT_usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd)
{
return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT);
return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT;
}
static inline int RT_usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd)
{
return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK);
return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK;
}
static inline int RT_usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd)
{
return (RT_usb_endpoint_xfer_bulk(epd) && RT_usb_endpoint_dir_in(epd));
return RT_usb_endpoint_xfer_bulk(epd) && RT_usb_endpoint_dir_in(epd);
}
static inline int RT_usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd)
{
return (RT_usb_endpoint_xfer_bulk(epd) && RT_usb_endpoint_dir_out(epd));
return RT_usb_endpoint_xfer_bulk(epd) && RT_usb_endpoint_dir_out(epd);
}
static inline int RT_usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd)
static inline int usb_endpoint_is_int(const struct usb_endpoint_descriptor *epd)
{
return (RT_usb_endpoint_xfer_int(epd) && RT_usb_endpoint_dir_in(epd));
return RT_usb_endpoint_xfer_int(epd) && RT_usb_endpoint_dir_in(epd);
}
static inline int RT_usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
@ -204,8 +188,7 @@ static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj)
rst = _FAIL;
goto exit;
}
dvobj->usb_vendor_req_buf =
(u8 *)N_BYTE_ALIGMENT((size_t)(dvobj->usb_alloc_vendor_req_buf ), ALIGNMENT_UNIT);
dvobj->usb_vendor_req_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(dvobj->usb_alloc_vendor_req_buf), ALIGNMENT_UNIT);
exit:
return rst;
}
@ -216,9 +199,7 @@ static u8 rtw_deinit_intf_priv(struct dvobj_priv *dvobj)
if (dvobj->usb_vendor_req_buf)
rtw_mfree(dvobj->usb_alloc_vendor_req_buf, MAX_USB_IO_CTL_SIZE);
_rtw_mutex_free(&dvobj->usb_vendor_req_mutex);
return rst;
}
@ -238,12 +219,13 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
_func_enter_;
if ((pdvobjpriv = (struct dvobj_priv*)rtw_zmalloc(sizeof(*pdvobjpriv))) == NULL) {
pdvobjpriv = (struct dvobj_priv *)rtw_zmalloc(sizeof(*pdvobjpriv));
if (pdvobjpriv == NULL)
goto exit;
}
pdvobjpriv->pusbintf = usb_intf;
pusbd = pdvobjpriv->pusbdev = interface_to_usbdev(usb_intf);
pusbd = interface_to_usbdev(usb_intf);
pdvobjpriv->pusbdev = pusbd;
usb_set_intfdata(usb_intf, pdvobjpriv);
pdvobjpriv->RtNumInPipes = 0;
@ -259,34 +241,35 @@ _func_enter_;
pdvobjpriv->InterfaceNumber = piface_desc->bInterfaceNumber;
pdvobjpriv->nr_endpoint = piface_desc->bNumEndpoints;
for (i = 0; i < pdvobjpriv->nr_endpoint; i++)
{
for (i = 0; i < pdvobjpriv->nr_endpoint; i++) {
phost_endp = phost_iface->endpoint + i;
if (phost_endp)
{
if (phost_endp) {
pendp_desc = &phost_endp->desc;
DBG_88E("\nusb_endpoint_descriptor(%d):\n", i);
DBG_88E("bLength=%x\n", pendp_desc->bLength);
DBG_88E("bDescriptorType=%x\n",pendp_desc->bDescriptorType);
DBG_88E("bEndpointAddress=%x\n",pendp_desc->bEndpointAddress);
DBG_88E("wMaxPacketSize=%d\n",le16_to_cpu(pendp_desc->wMaxPacketSize));
DBG_88E("bDescriptorType=%x\n",
pendp_desc->bDescriptorType);
DBG_88E("bEndpointAddress=%x\n",
pendp_desc->bEndpointAddress);
DBG_88E("wMaxPacketSize=%d\n",
le16_to_cpu(pendp_desc->wMaxPacketSize));
DBG_88E("bInterval=%x\n", pendp_desc->bInterval);
if (RT_usb_endpoint_is_bulk_in(pendp_desc)) {
DBG_88E("RT_usb_endpoint_is_bulk_in = %x\n", RT_usb_endpoint_num(pendp_desc));
DBG_88E("RT_usb_endpoint_is_bulk_in = %x\n",
RT_usb_endpoint_num(pendp_desc));
pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] = RT_usb_endpoint_num(pendp_desc);
pdvobjpriv->RtNumInPipes++;
}
else if (RT_usb_endpoint_is_int_in(pendp_desc))
{
DBG_88E("RT_usb_endpoint_is_int_in = %x, Interval = %x\n", RT_usb_endpoint_num(pendp_desc),pendp_desc->bInterval);
} else if (usb_endpoint_is_int(pendp_desc)) {
DBG_88E("usb_endpoint_is_int = %x, Interval = %x\n",
RT_usb_endpoint_num(pendp_desc),
pendp_desc->bInterval);
pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] = RT_usb_endpoint_num(pendp_desc);
pdvobjpriv->RtNumInPipes++;
}
else if (RT_usb_endpoint_is_bulk_out(pendp_desc))
{
DBG_88E("RT_usb_endpoint_is_bulk_out = %x\n", RT_usb_endpoint_num(pendp_desc));
} else if (RT_usb_endpoint_is_bulk_out(pendp_desc)) {
DBG_88E("RT_usb_endpoint_is_bulk_out = %x\n",
RT_usb_endpoint_num(pendp_desc));
pdvobjpriv->RtOutPipe[pdvobjpriv->RtNumOutPipes] = RT_usb_endpoint_num(pendp_desc);
pdvobjpriv->RtNumOutPipes++;
}
@ -294,7 +277,9 @@ _func_enter_;
}
}
DBG_88E("nr_endpoint=%d, in_num=%d, out_num=%d\n\n", pdvobjpriv->nr_endpoint, pdvobjpriv->RtNumInPipes, pdvobjpriv->RtNumOutPipes);
DBG_88E("nr_endpoint=%d, in_num=%d, out_num=%d\n\n",
pdvobjpriv->nr_endpoint, pdvobjpriv->RtNumInPipes,
pdvobjpriv->RtNumOutPipes);
if (pusbd->speed == USB_SPEED_HIGH) {
pdvobjpriv->ishighspeed = true;
@ -305,11 +290,12 @@ _func_enter_;
}
if (rtw_init_intf_priv(pdvobjpriv) == _FAIL) {
RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't INIT rtw_init_intf_priv\n"));
RT_TRACE(_module_os_intfs_c_, _drv_err_,
("\n Can't INIT rtw_init_intf_priv\n"));
goto free_dvobj;
}
//.3 misc
/* 3 misc */
_rtw_init_sema(&(pdvobjpriv->usb_suspend_sema), 0);
rtw_reset_continual_urb_error(pdvobjpriv);
@ -336,12 +322,17 @@ _func_enter_;
usb_set_intfdata(usb_intf, NULL);
if (dvobj) {
//Modify condition for 92DU DMDP 2010.11.18, by Thomas
if ((dvobj->NumInterfaces != 2 && dvobj->NumInterfaces != 3)
|| (dvobj->InterfaceNumber == 1)) {
if (interface_to_usbdev(usb_intf)->state != USB_STATE_NOTATTACHED) {
//If we didn't unplug usb dongle and remove/insert modlue, driver fails on sitesurvey for the first time when device is up .
//Reset usb port for sitesurvey fail issue. 2009.8.13, by Thomas
/* Modify condition for 92DU DMDP 2010.11.18, by Thomas */
if ((dvobj->NumInterfaces != 2 &&
dvobj->NumInterfaces != 3) ||
(dvobj->InterfaceNumber == 1)) {
if (interface_to_usbdev(usb_intf)->state !=
USB_STATE_NOTATTACHED) {
/* If we didn't unplug usb dongle and
* remove/insert module, driver fails
* on sitesurvey for the first time when
* device is up . Reset usb port for sitesurvey
* fail issue. */
DBG_88E("usb attached..., try to reset usb device\n");
usb_reset_device(interface_to_usbdev(usb_intf));
}
@ -350,13 +341,13 @@ _func_enter_;
rtw_mfree((u8 *)dvobj, sizeof(*dvobj));
}
//DBG_88E("%s %d\n", __func__, ATOMIC_READ(&usb_intf->dev.kobj.kref.refcount));
usb_put_dev(interface_to_usbdev(usb_intf));
_func_exit_;
}
static void decide_chip_type_by_usb_device_id(struct adapter *padapter, const struct usb_device_id *pdid)
static void chip_by_usb_id(struct adapter *padapter,
const struct usb_device_id *pdid)
{
padapter->chip_type = NULL_CHIP_TYPE;
hal_set_hw_type(padapter);
@ -364,38 +355,34 @@ static void decide_chip_type_by_usb_device_id(struct adapter *padapter, const st
static void usb_intf_start(struct adapter *padapter)
{
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+usb_intf_start\n"));
rtw_hal_inirp_init(padapter);
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-usb_intf_start\n"));
}
static void usb_intf_stop(struct adapter *padapter)
{
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+usb_intf_stop\n"));
//disabel_hw_interrupt
if (padapter->bSurpriseRemoved == false)
{
//device still exists, so driver can do i/o operation
//TODO:
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("SurpriseRemoved==false\n"));
/* disabel_hw_interrupt */
if (!padapter->bSurpriseRemoved) {
/* device still exists, so driver can do i/o operation */
/* TODO: */
RT_TRACE(_module_hci_intfs_c_, _drv_err_,
("SurpriseRemoved == false\n"));
}
//cancel in irp
/* cancel in irp */
rtw_hal_inirp_deinit(padapter);
//cancel out irp
/* cancel out irp */
rtw_write_port_cancel(padapter);
//todo:cancel other irps
/* todo:cancel other irps */
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-usb_intf_stop\n"));
}
static void rtw_dev_unload(struct adapter *padapter)
@ -404,55 +391,43 @@ static void rtw_dev_unload(struct adapter *padapter)
u8 val8;
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_dev_unload\n"));
if (padapter->bup == true)
{
if (padapter->bup) {
DBG_88E("===> rtw_dev_unload\n");
padapter->bDriverStopped = true;
if (padapter->xmitpriv.ack_tx)
rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP);
//s3.
/* s3. */
if (padapter->intf_stop)
{
padapter->intf_stop(padapter);
}
//s4.
/* s4. */
if (!padapter->pwrctrlpriv.bInternalAutoSuspend)
rtw_stop_drv_threads(padapter);
//s5.
if (padapter->bSurpriseRemoved == false)
{
//DBG_88E("r871x_dev_unload()->rtl871x_hal_deinit()\n");
/* s5. */
if (!padapter->bSurpriseRemoved) {
#ifdef CONFIG_WOWLAN
if ((padapter->pwrctrlpriv.bSupportRemoteWakeup==true)&&(padapter->pwrctrlpriv.wowlan_mode==true)){
DBG_88E("%s bSupportWakeOnWlan==true do not run rtw_hal_deinit()\n",__func__);
}
if ((padapter->pwrctrlpriv.bSupportRemoteWakeup) &&
(padapter->pwrctrlpriv.wowlan_mode))
DBG_88E("%s bSupportWakeOnWlan == true do not run rtw_hal_deinit()\n",
__func__);
else
#endif //CONFIG_WOWLAN
{
#endif /* CONFIG_WOWLAN */
rtw_hal_deinit(padapter);
}
padapter->bSurpriseRemoved = true;
}
padapter->bup = false;
#ifdef CONFIG_WOWLAN
padapter->hw_init_completed = false;
#endif //CONFIG_WOWLAN
}
else
{
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("r871x_dev_unload():padapter->bup == false\n" ));
#endif /* CONFIG_WOWLAN */
} else {
RT_TRACE(_module_hci_intfs_c_, _drv_err_,
("r871x_dev_unload():padapter->bup == false\n"));
}
DBG_88E("<=== rtw_dev_unload\n");
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-rtw_dev_unload\n"));
}
static void process_spec_devid(const struct usb_device_id *pdid)
@ -460,16 +435,16 @@ static void process_spec_devid(const struct usb_device_id *pdid)
u16 vid, pid;
u32 flags;
int i;
int num = sizeof(specific_device_id_tbl)/sizeof(struct specific_device_id);
int num = sizeof(specific_device_id_tbl) /
sizeof(struct specific_device_id);
for (i=0; i<num; i++)
{
for (i = 0; i < num; i++) {
vid = specific_device_id_tbl[i].idVendor;
pid = specific_device_id_tbl[i].idProduct;
flags = specific_device_id_tbl[i].flags;
if ((pdid->idVendor==vid) && (pdid->idProduct==pid) && (flags&SPEC_DEV_ID_DISABLE_HT))
{
if ((pdid->idVendor == vid) && (pdid->idProduct == pid) &&
(flags&SPEC_DEV_ID_DISABLE_HT)) {
rtw_ht_enable = 0;
rtw_cbw40_enable = 0;
rtw_ampdu_enable = 0;
@ -485,70 +460,63 @@ int rtw_hw_suspend(struct adapter *padapter )
_func_enter_;
if ((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved))
{
if ((!padapter->bup) || (padapter->bDriverStopped) ||
(padapter->bSurpriseRemoved)) {
DBG_88E("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n",
padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved);
padapter->bup, padapter->bDriverStopped,
padapter->bSurpriseRemoved);
goto error_exit;
}
if (padapter)//system suspend
{
if (padapter) { /* system suspend */
LeaveAllPowerSaveMode(padapter);
DBG_88E("==> rtw_hw_suspend\n");
_enter_pwrlock(&pwrpriv->lock);
pwrpriv->bips_processing = true;
//padapter->net_closed = true;
//s1.
if (pnetdev)
{
/* s1. */
if (pnetdev) {
netif_carrier_off(pnetdev);
rtw_netif_stop_queue(pnetdev);
}
//s2.
/* s2. */
rtw_disassoc_cmd(padapter, 500, false);
//s2-2. indicate disconnect to os
//rtw_indicate_disconnect(padapter);
/* s2-2. indicate disconnect to os */
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
if (check_fwstate(pmlmepriv, _FW_LINKED))
{
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
/* donnot enqueue cmd */
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0);
}
}
//s2-3.
/* s2-3. */
rtw_free_assoc_resources(padapter, 1);
//s2-4.
/* 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);
}
else
} else {
goto error_exit;
}
_func_exit_;
return 0;
error_exit:
DBG_88E("%s, failed\n", __func__);
return (-1);
return -1;
}
int rtw_hw_resume(struct adapter *padapter)
@ -559,15 +527,13 @@ int rtw_hw_resume(struct adapter *padapter)
_func_enter_;
if (padapter)//system resume
{
if (padapter) { /* 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)
{
if (pm_netdev_open(pnetdev, false) != 0) {
_exit_pwrlock(&pwrpriv->lock);
goto error_exit;
}
@ -587,9 +553,7 @@ int rtw_hw_resume(struct adapter *padapter)
pwrpriv->bips_processing = false;
_exit_pwrlock(&pwrpriv->lock);
}
else
{
} else {
goto error_exit;
}
@ -598,7 +562,7 @@ int rtw_hw_resume(struct adapter *padapter)
return 0;
error_exit:
DBG_88E("%s, Open net dev failed\n", __func__);
return (-1);
return -1;
}
static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
@ -611,7 +575,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
struct usb_device *usb_dev = interface_to_usbdev(pusb_intf);
#ifdef CONFIG_WOWLAN
struct wowlan_ioctl_param poidparam;
#endif // CONFIG_WOWLAN
#endif /* CONFIG_WOWLAN */
int ret = 0;
u32 start_time = rtw_get_current_time();
@ -627,10 +591,11 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
padapter->pwrctrlpriv.wowlan_mode = false;
#endif
if ((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved))
{
if ((!padapter->bup) || (padapter->bDriverStopped) ||
(padapter->bSurpriseRemoved)) {
DBG_88E("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n",
padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved);
padapter->bup, padapter->bDriverStopped,
padapter->bSurpriseRemoved);
goto exit;
}
@ -639,30 +604,31 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
LeaveAllPowerSaveMode(padapter);
_enter_pwrlock(&pwrpriv->lock);
//s1.
if (pnetdev)
{
/* s1. */
if (pnetdev) {
netif_carrier_off(pnetdev);
rtw_netif_stop_queue(pnetdev);
}
#ifdef CONFIG_WOWLAN
if (padapter->pwrctrlpriv.bSupportRemoteWakeup==true&&padapter->pwrctrlpriv.wowlan_mode==true){
//set H2C command
if (padapter->pwrctrlpriv.bSupportRemoteWakeup &&
padapter->pwrctrlpriv.wowlan_mode) {
/* set H2C command */
poidparam.subcode = WOWLAN_ENABLE;
padapter->HalFunc.SetHwRegHandler(padapter,HW_VAR_WOWLAN,(u8 *)&poidparam);
}
else
padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN,
(u8 *)&poidparam);
} else
#else
{
//s2.
/* s2. */
rtw_disassoc_cmd(padapter, 0, false);
}
#endif //CONFIG_WOWLAN
#endif /* CONFIG_WOWLAN */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) )
{
DBG_88E("%s:%d %s( %pM ), length:%d assoc_ssid.length:%d\n",__func__, __LINE__,
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) &&
check_fwstate(pmlmepriv, _FW_LINKED)) {
DBG_88E("%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.SsidLength,
@ -670,11 +636,11 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
pmlmepriv->to_roaming = 1;
}
//s2-2. indicate disconnect to os
/* s2-2. indicate disconnect to os */
rtw_indicate_disconnect(padapter);
//s2-3.
/* s2-3. */
rtw_free_assoc_resources(padapter, 1);
//s2-4.
/* s2-4. */
rtw_free_network_queue(padapter, true);
rtw_dev_unload(padapter);
@ -717,7 +683,7 @@ int rtw_resume_process(struct adapter *padapter)
u32 start_time = rtw_get_current_time();
#ifdef CONFIG_BT_COEXIST
u8 pm_cnt;
#endif //#ifdef CONFIG_BT_COEXIST
#endif /* ifdef CONFIG_BT_COEXIST */
_func_enter_;
DBG_88E("==> %s (%s:%d)\n", __func__, current->comm, current->pid);
@ -763,11 +729,12 @@ exit:
/*
* drv_init() - a device potentially for us
*
* notes: drv_init() is called when the bus driver has located a card for us to support.
* notes: drv_init() is called when the bus driver has located
* a card for us to support.
* We accept the new device by returning 0.
*/
static struct adapter *rtw_sw_export = NULL;
static struct adapter *rtw_sw_export;
static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
struct usb_interface *pusb_intf, const struct usb_device_id *pdid)
@ -776,9 +743,9 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
struct net_device *pnetdev = NULL;
int status = _FAIL;
if ((padapter = (struct adapter *)rtw_zvmalloc(sizeof(*padapter))) == NULL) {
padapter = (struct adapter *)rtw_zvmalloc(sizeof(*padapter));
if (padapter == NULL)
goto exit;
}
padapter->dvobj = dvobj;
dvobj->if1 = padapter;
@ -786,47 +753,47 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
padapter->hw_init_mutex = &usb_drv->hw_init_mutex;
//step 1-1., decide the chip_type via vid/pid
/* step 1-1., decide the chip_type via vid/pid */
padapter->interface_type = RTW_USB;
decide_chip_type_by_usb_device_id(padapter, pdid);
chip_by_usb_id(padapter, pdid);
if (rtw_handle_dualmac(padapter, 1) != _SUCCESS)
goto free_adapter;
if ((pnetdev = rtw_init_netdev(padapter)) == NULL) {
pnetdev = rtw_init_netdev(padapter);
if (pnetdev == NULL)
goto handle_dualmac;
}
SET_NETDEV_DEV(pnetdev, dvobj_to_dev(dvobj));
padapter = rtw_netdev_priv(pnetdev);
//step 2. hook HalFunc, allocate HalData
/* step 2. hook HalFunc, allocate HalData */
hal_set_hal_ops(padapter);
padapter->intf_start = &usb_intf_start;
padapter->intf_stop = &usb_intf_stop;
//step init_io_priv
/* step init_io_priv */
rtw_init_io_priv(padapter, usb_set_intf_ops);
//step read_chip_version
/* step read_chip_version */
rtw_hal_read_chip_version(padapter);
//step usb endpoint mapping
/* step usb endpoint mapping */
rtw_hal_chip_configure(padapter);
//step read efuse/eeprom data and get mac_addr
/* step read efuse/eeprom data and get mac_addr */
rtw_hal_read_chip_info(padapter);
//step 5.
/* step 5. */
if (rtw_init_drv_sw(padapter) == _FAIL) {
RT_TRACE(_module_hci_intfs_c_,_drv_err_,("Initialize driver software resource Failed!\n"));
RT_TRACE(_module_hci_intfs_c_, _drv_err_,
("Initialize driver software resource Failed!\n"));
goto free_hal_data;
}
#ifdef CONFIG_PM
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 18))
if (padapter->pwrctrlpriv.bSupportRemoteWakeup)
{
if (padapter->pwrctrlpriv.bSupportRemoteWakeup) {
dvobj->pusbdev->do_remote_wakeup = 1;
pusb_intf->needs_remote_wakeup = 1;
device_init_wakeup(&pusb_intf->dev, 1);
@ -836,25 +803,26 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
#endif
#endif
//2012-07-11 Move here to prevent the 8723AS-VAU BT auto suspend influence
/* 2012-07-11 Move here to prevent the 8723AS-VAU BT auto
* suspend influence */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33))
if (usb_autopm_get_interface(pusb_intf) < 0)
{
DBG_88E("can't get autopm:\n");
}
#endif
#ifdef CONFIG_BT_COEXIST
padapter->pwrctrlpriv.autopm_cnt = 1;
#endif
// alloc dev name after read efuse.
/* alloc dev name after read efuse. */
rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname);
rtw_macaddr_cfg(padapter->eeprompriv.mac_addr);
rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr, padapter->eeprompriv.mac_addr);
rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr,
padapter->eeprompriv.mac_addr);
_rtw_memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
DBG_88E("MAC Address from pnetdev->dev_addr= %pM\n", pnetdev->dev_addr);
DBG_88E("MAC Address from pnetdev->dev_addr = %pM\n",
pnetdev->dev_addr);
//step 6. /* Tell the network stack we exist */
/* step 6. Tell the network stack we exist */
if (register_netdev(pnetdev) != 0) {
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("register_netdev() failed\n"));
goto free_hal_data;
@ -896,28 +864,26 @@ static void rtw_usb_if1_deinit(struct adapter *if1)
if (check_fwstate(pmlmepriv, _FW_LINKED))
rtw_disassoc_cmd(if1, 0, false);
#ifdef CONFIG_AP_MODE
free_mlme_ap_info(if1);
#endif
if (if1->DriverState != DRIVER_DISAPPEAR) {
if (pnetdev) {
unregister_netdev(pnetdev); //will call netdev_close()
/* will call netdev_close() */
unregister_netdev(pnetdev);
rtw_proc_remove_one(pnetdev);
}
}
rtw_cancel_all_timer(if1);
#ifdef CONFIG_WOWLAN
if1->pwrctrlpriv.wowlan_mode = false;
#endif //CONFIG_WOWLAN
#endif /* CONFIG_WOWLAN */
rtw_dev_unload(if1);
DBG_88E("+r871xu_dev_remove, hw_init_completed=%d\n", if1->hw_init_completed);
DBG_88E("+r871xu_dev_remove, hw_init_completed=%d\n",
if1->hw_init_completed);
rtw_handle_dualmac(if1, 0);
#ifdef CONFIG_BT_COEXIST
@ -956,7 +922,8 @@ static void dump_usb_interface(struct usb_interface *usb_intf)
struct usb_endpoint_descriptor *endp_desc;
/* The usb device this usb interface belongs to */
DBG_88E("usb_interface:%p, usb_device:%p(num:%d, path:%s), usb_device_descriptor:%p\n", usb_intf, udev, udev->devnum, udev->devpath, dev_desc);
DBG_88E("usb_interface:%p, usb_device:%p(num:%d, path:%s), usb_device_descriptor:%p\n",
usb_intf, udev, udev->devnum, udev->devpath, dev_desc);
DBG_88E("bLength:%u\n", dev_desc->bLength);
DBG_88E("bDescriptorType:0x%02x\n", dev_desc->bDescriptorType);
DBG_88E("bcdUSB:0x%04x\n", le16_to_cpu(dev_desc->bcdUSB));
@ -978,13 +945,16 @@ static void dump_usb_interface(struct usb_interface *usb_intf)
DBG_88E("bDescriptorType:0x%02x\n", act_conf_desc->bDescriptorType);
DBG_88E("wTotalLength:%u\n", le16_to_cpu(act_conf_desc->wTotalLength));
DBG_88E("bNumInterfaces:%u\n", act_conf_desc->bNumInterfaces);
DBG_88E("bConfigurationValue:0x%02x\n", act_conf_desc->bConfigurationValue);
DBG_88E("bConfigurationValue:0x%02x\n",
act_conf_desc->bConfigurationValue);
DBG_88E("iConfiguration:0x%02x\n", act_conf_desc->iConfiguration);
DBG_88E("bmAttributes:0x%02x\n", act_conf_desc->bmAttributes);
DBG_88E("bMaxPower=%u\n", act_conf_desc->bMaxPower);
DBG_88E("****** num of altsetting = (%d) ******/\n", usb_intf->num_altsetting);
/* Get he host side alternate setting (the current alternate setting) for this interface*/
DBG_88E("****** num of altsetting = (%d) ******/\n",
usb_intf->num_altsetting);
/* Get he host side alternate settingi
* (the current alternate setting) for this interface*/
host_iface = usb_intf->cur_altsetting;
iface_desc = &host_iface->desc;
@ -1000,34 +970,35 @@ static void dump_usb_interface(struct usb_interface *usb_intf)
DBG_88E("bInterfaceProtocol=%x\n", iface_desc->bInterfaceProtocol);
DBG_88E("iInterface=%x\n", iface_desc->iInterface);
for (i = 0; i < iface_desc->bNumEndpoints; i++)
{
for (i = 0; i < iface_desc->bNumEndpoints; i++) {
host_endp = host_iface->endpoint + i;
if (host_endp)
{
if (host_endp) {
endp_desc = &host_endp->desc;
DBG_88E("\nusb_endpoint_descriptor(%d):\n", i);
DBG_88E("bLength=%x\n", endp_desc->bLength);
DBG_88E("bDescriptorType=%x\n",endp_desc->bDescriptorType);
DBG_88E("bEndpointAddress=%x\n",endp_desc->bEndpointAddress);
DBG_88E("bmAttributes=%x\n",endp_desc->bmAttributes);
DBG_88E("wMaxPacketSize=%x\n",endp_desc->wMaxPacketSize);
DBG_88E("wMaxPacketSize=%x\n",le16_to_cpu(endp_desc->wMaxPacketSize));
DBG_88E("bDescriptorType=%x\n",
endp_desc->bDescriptorType);
DBG_88E("bEndpointAddress=%x\n",
endp_desc->bEndpointAddress);
DBG_88E("bmAttributes=%x\n",
endp_desc->bmAttributes);
DBG_88E("wMaxPacketSize=%x\n",
endp_desc->wMaxPacketSize);
DBG_88E("wMaxPacketSize=%x\n",
le16_to_cpu(endp_desc->wMaxPacketSize));
DBG_88E("bInterval=%x\n", endp_desc->bInterval);
if (RT_usb_endpoint_is_bulk_in(endp_desc))
{
DBG_88E("RT_usb_endpoint_is_bulk_in = %x\n", RT_usb_endpoint_num(endp_desc));
}
else if (RT_usb_endpoint_is_int_in(endp_desc))
{
DBG_88E("RT_usb_endpoint_is_int_in = %x, Interval = %x\n", RT_usb_endpoint_num(endp_desc),endp_desc->bInterval);
}
DBG_88E("RT_usb_endpoint_is_bulk_in = %x\n",
RT_usb_endpoint_num(endp_desc));
else if (usb_endpoint_is_int(endp_desc))
DBG_88E("usb_endpoint_is_int = %x, Interval = %x\n",
RT_usb_endpoint_num(endp_desc),
endp_desc->bInterval);
else if (RT_usb_endpoint_is_bulk_out(endp_desc))
{
DBG_88E("RT_usb_endpoint_is_bulk_out = %x\n", RT_usb_endpoint_num(endp_desc));
}
DBG_88E("RT_usb_endpoint_is_bulk_out = %x\n",
RT_usb_endpoint_num(endp_desc));
}
}
@ -1035,10 +1006,8 @@ static void dump_usb_interface(struct usb_interface *usb_intf)
DBG_88E("USB_SPEED_HIGH\n");
else
DBG_88E("NON USB_SPEED_HIGH\n");
}
static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid)
{
int i;
@ -1047,18 +1016,20 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device
struct dvobj_priv *dvobj;
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_init\n"));
//DBG_88E("+rtw_drv_init\n");
//step 0.
/* step 0. */
process_spec_devid(pdid);
/* Initialize dvobj_priv */
if ((dvobj = usb_dvobj_init(pusb_intf)) == NULL) {
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("initialize device object priv Failed!\n"));
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;
}
if ((if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid)) == NULL) {
if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid);
if (if1 == NULL) {
DBG_88E("rtw_init_primarystruct adapter Failed!\n");
goto free_dvobj;
}
@ -1073,9 +1044,8 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device
status = _SUCCESS;
free_if1:
if (status != _SUCCESS && if1) {
if (status != _SUCCESS && if1)
rtw_usb_if1_deinit(if1);
}
free_dvobj:
if (status != _SUCCESS)
usb_dvobj_deinit(pusb_intf);
@ -1086,7 +1056,7 @@ exit:
/*
* dev_remove() - our device is being removed
*/
//rmmod module & unplug(SurpriseRemoved) will call r871xu_dev_remove() => how to recognize both
/* 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);
@ -1099,16 +1069,8 @@ _func_enter_;
DBG_88E("+rtw_dev_remove\n");
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+dev_remove()\n"));
if (usb_drv->drv_registered == true)
{
//DBG_88E("r871xu_dev_remove():padapter->bSurpriseRemoved == true\n");
if (usb_drv->drv_registered)
padapter->bSurpriseRemoved = true;
}
/*else
{
//DBG_88E("r871xu_dev_remove():module removed\n");
padapter->hw_init_completed = false;
}*/
rtw_pm_set_ips(padapter, IPS_NONE);
rtw_pm_set_lps(padapter, PS_MODE_ACTIVE);
@ -1126,10 +1088,6 @@ _func_exit_;
return;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
extern int console_suspend_enabled;
#endif
static int __init rtw_drv_entry(void)
{
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_entry\n"));