mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-11-13 00:32:24 +00:00
rtl8188eu: Do some cleanup in hal/usb_ops_linux.c
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
b34f4ec9be
commit
b2e37eb332
1 changed files with 97 additions and 142 deletions
|
@ -270,7 +270,7 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
|
|||
u16 wvalue;
|
||||
u16 index;
|
||||
u16 len;
|
||||
__le32 data;
|
||||
__le16 data;
|
||||
int ret;
|
||||
|
||||
request = 0x05;
|
||||
|
@ -280,7 +280,7 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
|
|||
wvalue = (u16)(addr&0x0000ffff);
|
||||
len = 2;
|
||||
|
||||
data = cpu_to_le32(val);
|
||||
data = cpu_to_le16(val);
|
||||
|
||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
|
||||
|
||||
|
@ -297,7 +297,6 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
|
|||
__le32 data;
|
||||
int ret;
|
||||
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;//write_out
|
||||
index = 0;//n/a
|
||||
|
@ -319,7 +318,6 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
|
|||
u16 index;
|
||||
u16 len;
|
||||
u8 buf[VENDOR_CMD_MAX_DATA_LEN]={0};
|
||||
int ret;
|
||||
|
||||
request = 0x05;
|
||||
requesttype = 0x00;//write_out
|
||||
|
@ -329,12 +327,7 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
|
|||
len = length;
|
||||
_rtw_memcpy(buf, pdata, len );
|
||||
|
||||
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, buf, len, requesttype);
|
||||
|
||||
;
|
||||
|
||||
return ret;
|
||||
|
||||
return usbctrl_vendorreq(pintfhdl, request, wvalue, index, buf, len, requesttype);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SUPPORT_USB_INT
|
||||
|
@ -343,8 +336,7 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf)
|
|||
HAL_DATA_TYPE *pHalData=GET_HAL_DATA(padapter);
|
||||
struct reportpwrstate_parm pwr_rpt;
|
||||
|
||||
if ( pkt_len != INTERRUPT_MSG_FORMAT_LEN )
|
||||
{
|
||||
if ( pkt_len != INTERRUPT_MSG_FORMAT_LEN ) {
|
||||
DBG_8192C("%s Invalid interrupt content length (%d)!\n", __FUNCTION__, pkt_len);
|
||||
return ;
|
||||
}
|
||||
|
@ -354,10 +346,8 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf)
|
|||
_rtw_memcpy(&(pHalData->IntArray[1]), &(pbuf[USB_INTR_CONTENT_HISRE_OFFSET]), 4);
|
||||
|
||||
#ifdef CONFIG_LPS_LCLK
|
||||
if( pHalData->IntArray[0] & IMR_CPWM_88E )
|
||||
{
|
||||
if ( pHalData->IntArray[0] & IMR_CPWM_88E ) {
|
||||
_rtw_memcpy(&pwr_rpt.state, &(pbuf[USB_INTR_CONTENT_CPWM1_OFFSET]), 1);
|
||||
//_rtw_memcpy(&pwr_rpt.state2, &(pbuf[USB_INTR_CONTENT_CPWM2_OFFSET]), 1);
|
||||
|
||||
//88e's cpwm value only change BIT0, so driver need to add PS_STATE_S2 for LPS flow.
|
||||
pwr_rpt.state |= PS_STATE_S2;
|
||||
|
@ -376,33 +366,21 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf)
|
|||
{
|
||||
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
||||
|
||||
if(check_fwstate(pmlmepriv, WIFI_AP_STATE))
|
||||
{
|
||||
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
|
||||
//send_beacon(padapter);
|
||||
if (pmlmepriv->update_bcn == true)
|
||||
{
|
||||
//tx_beacon_hdl(padapter, NULL);
|
||||
set_tx_beacon_cmd(padapter);
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_CONCURRENT_MODE
|
||||
if(check_buddy_fwstate(padapter, WIFI_AP_STATE))
|
||||
{
|
||||
if (check_buddy_fwstate(padapter, WIFI_AP_STATE)) {
|
||||
//send_beacon(padapter);
|
||||
if (padapter->pbuddy_adapter->mlmepriv.update_bcn == true)
|
||||
{
|
||||
//tx_beacon_hdl(padapter, NULL);
|
||||
set_tx_beacon_cmd(padapter->pbuddy_adapter);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif //CONFIG_INTERRUPT_BASED_TXBCN
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef DBG_CONFIG_ERROR_DETECT_INT
|
||||
if ( pHalData->IntArray[1] & IMR_TXERR_88E )
|
||||
DBG_871X("===> %s Tx Error Flag Interrupt Status \n",__FUNCTION__);
|
||||
|
@ -414,7 +392,6 @@ void interrupt_handler_8188eu(struct adapter *padapter,u16 pkt_len,u8 *pbuf)
|
|||
DBG_871X("===> %s Receive FIFO Overflow \n",__FUNCTION__);
|
||||
#endif//DBG_CONFIG_ERROR_DETECT_INT
|
||||
|
||||
|
||||
// C2H Event
|
||||
if (pbuf[0]!= 0){
|
||||
_rtw_memcpy(&(pHalData->C2hArray[0]), &(pbuf[USB_INTR_CONTENT_C2H_OFFSET]), 16);
|
||||
|
@ -1438,18 +1415,14 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
if(precvbuf !=NULL)
|
||||
{
|
||||
if (precvbuf != NULL) {
|
||||
rtl8188eu_init_recvbuf(adapter, precvbuf);
|
||||
|
||||
//re-assign for linux based on skb
|
||||
if((precvbuf->reuse == false) || (precvbuf->pskb == NULL))
|
||||
{
|
||||
if ((precvbuf->reuse == false) || (precvbuf->pskb == NULL)) {
|
||||
precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
|
||||
|
||||
if(precvbuf->pskb == NULL)
|
||||
{
|
||||
if (precvbuf->pskb == NULL) {
|
||||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("init_recvbuf(): alloc_skb fail!\n"));
|
||||
DBG_8192C("#### usb_read_port() alloc_skb fail!#####\n");
|
||||
return _FAIL;
|
||||
|
@ -1464,8 +1437,7 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
|||
precvbuf->ptail = skb_tail_pointer(precvbuf->pskb);
|
||||
precvbuf->pend = skb_end_pointer(precvbuf->pskb);
|
||||
precvbuf->pbuf = precvbuf->pskb->data;
|
||||
}
|
||||
else//reuse skb
|
||||
} else//reuse skb
|
||||
{
|
||||
precvbuf->phead = precvbuf->pskb->head;
|
||||
precvbuf->pdata = precvbuf->pskb->data;
|
||||
|
@ -1476,11 +1448,6 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
|||
precvbuf->reuse = false;
|
||||
}
|
||||
|
||||
//_enter_critical(&precvpriv->lock, &irqL);
|
||||
//precvpriv->rx_pending_cnt++;
|
||||
//precvbuf->irp_pending = true;
|
||||
//_exit_critical(&precvpriv->lock, &irqL);
|
||||
|
||||
precvpriv->rx_pending_cnt++;
|
||||
|
||||
purb = precvbuf->purb;
|
||||
|
@ -1488,28 +1455,23 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
|
|||
//translate DMA FIFO addr to pipehandle
|
||||
pipe = ffaddr2pipehdl(pdvobj, addr);
|
||||
|
||||
usb_fill_bulk_urb(purb, pusbd, pipe,
|
||||
precvbuf->pbuf,
|
||||
MAX_RECVBUF_SZ,
|
||||
usb_read_port_complete,
|
||||
usb_fill_bulk_urb(purb, pusbd, pipe, precvbuf->pbuf,
|
||||
MAX_RECVBUF_SZ, usb_read_port_complete,
|
||||
precvbuf);//context is precvbuf
|
||||
|
||||
err = usb_submit_urb(purb, GFP_ATOMIC);
|
||||
if((err) && (err != (-EPERM)))
|
||||
{
|
||||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("cannot submit rx in-token(err=0x%.8x), URB_STATUS =0x%.8x", err, purb->status));
|
||||
DBG_8192C("cannot submit rx in-token(err = 0x%08x),urb_status = %d\n",err,purb->status);
|
||||
if ((err) && (err != (-EPERM))) {
|
||||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,
|
||||
("cannot submit rx in-token(err=0x%.8x), URB_STATUS =0x%.8x",
|
||||
err, purb->status));
|
||||
DBG_8192C("cannot submit rx in-token(err = 0x%08x),urb_status = %d\n",
|
||||
err, purb->status);
|
||||
ret = _FAIL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_read_port:precvbuf ==NULL\n"));
|
||||
ret = _FAIL;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||
|
@ -1523,27 +1485,23 @@ void rtl8188eu_xmit_tasklet(void *priv)
|
|||
if (check_fwstate(&padapter->mlmepriv, _FW_UNDER_SURVEY) == true)
|
||||
return;
|
||||
|
||||
while(1)
|
||||
{
|
||||
if ((padapter->bDriverStopped == true)||(padapter->bSurpriseRemoved== true) || (padapter->bWritePortCancel == true))
|
||||
{
|
||||
while(1) {
|
||||
if (padapter->bDriverStopped ||
|
||||
padapter->bSurpriseRemoved ||
|
||||
padapter->bWritePortCancel) {
|
||||
DBG_8192C("xmit_tasklet => bDriverStopped or bSurpriseRemoved or bWritePortCancel\n");
|
||||
break;
|
||||
}
|
||||
|
||||
ret = rtl8188eu_xmitframe_complete(padapter, pxmitpriv, NULL);
|
||||
|
||||
if(ret==false)
|
||||
if (!ret)
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void rtl8188eu_set_intf_ops(struct _io_ops *pops)
|
||||
{
|
||||
;
|
||||
|
||||
_rtw_memset((u8 *)pops, 0, sizeof(struct _io_ops));
|
||||
|
||||
pops->_read8 = &usb_read8;
|
||||
|
@ -1571,9 +1529,6 @@ void rtl8188eu_set_intf_ops(struct _io_ops *pops)
|
|||
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
||||
pops->_read_interrupt = &usb_read_interrupt;
|
||||
#endif
|
||||
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
void rtl8188eu_set_hw_type(struct adapter *padapter)
|
||||
|
|
Loading…
Reference in a new issue