rtl8188eu: Fix checkpatch errors for os_dep/usb_ops_linux.c

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-08-11 21:47:28 -05:00
parent 30b92ac1c6
commit aa6edf1619

View file

@ -15,7 +15,7 @@
* this program; if not, write to the Free Software Foundation, Inc., * this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
* *
*******************************************************************************/ ******************************************************************************/
#define _USB_OPS_LINUX_C_ #define _USB_OPS_LINUX_C_
#include <drv_types.h> #include <drv_types.h>
@ -24,15 +24,13 @@
unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr) unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr)
{ {
unsigned int pipe=0, ep_num=0; unsigned int pipe = 0, ep_num = 0;
struct usb_device *pusbd = pdvobj->pusbdev; struct usb_device *pusbd = pdvobj->pusbdev;
if (addr == RECV_BULK_IN_ADDR) { if (addr == RECV_BULK_IN_ADDR) {
pipe=usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[0]); pipe = usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[0]);
} else if (addr == RECV_INT_IN_ADDR) { } else if (addr == RECV_INT_IN_ADDR) {
pipe=usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[1]); pipe = usb_rcvbulkpipe(pusbd, pdvobj->RtInPipe[1]);
} else if (addr < HW_QUEUE_ENTRY) { } else if (addr < HW_QUEUE_ENTRY) {
ep_num = pdvobj->Queue2Pipe[addr]; ep_num = pdvobj->Queue2Pipe[addr];
pipe = usb_sndbulkpipe(pusbd, ep_num); pipe = usb_sndbulkpipe(pusbd, ep_num);
@ -41,7 +39,7 @@ unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr)
return pipe; return pipe;
} }
struct zero_bulkout_context{ struct zero_bulkout_context {
void *pbuf; void *pbuf;
void *purb; void *purb;
void *pirp; void *pirp;
@ -52,25 +50,15 @@ static void usb_bulkout_zero_complete(struct urb *purb, struct pt_regs *regs)
{ {
struct zero_bulkout_context *pcontext = (struct zero_bulkout_context *)purb->context; struct zero_bulkout_context *pcontext = (struct zero_bulkout_context *)purb->context;
//DBG_88E("+usb_bulkout_zero_complete\n"); if (pcontext) {
if (pcontext)
{
if (pcontext->pbuf) if (pcontext->pbuf)
{
rtw_mfree(pcontext->pbuf, sizeof(int)); rtw_mfree(pcontext->pbuf, sizeof(int));
}
if (pcontext->purb && (pcontext->purb==purb)) if (pcontext->purb && (pcontext->purb == purb))
{
usb_free_urb(pcontext->purb); usb_free_urb(pcontext->purb);
}
rtw_mfree((u8 *)pcontext, sizeof(struct zero_bulkout_context));
rtw_mfree((u8*)pcontext, sizeof(struct zero_bulkout_context));
} }
} }
static u32 usb_bulkout_zero(struct intf_hdl *pintfhdl, u32 addr) static u32 usb_bulkout_zero(struct intf_hdl *pintfhdl, u32 addr)
@ -79,15 +67,13 @@ static u32 usb_bulkout_zero(struct intf_hdl *pintfhdl, u32 addr)
u32 ret; u32 ret;
unsigned char *pbuf; unsigned char *pbuf;
struct zero_bulkout_context *pcontext; struct zero_bulkout_context *pcontext;
struct urb * purb = NULL; struct urb *purb = NULL;
struct adapter *padapter = (struct adapter *)pintfhdl->padapter; struct adapter *padapter = (struct adapter *)pintfhdl->padapter;
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
struct usb_device *pusbd = pdvobj->pusbdev; struct usb_device *pusbd = pdvobj->pusbdev;
//DBG_88E("%s\n", __func__); if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||
(padapter->pwrctrlpriv.pnp_bstop_trx))
if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||(padapter->pwrctrlpriv.pnp_bstop_trx))
return _FAIL; return _FAIL;
pcontext = (struct zero_bulkout_context *)rtw_zmalloc(sizeof(struct zero_bulkout_context)); pcontext = (struct zero_bulkout_context *)rtw_zmalloc(sizeof(struct zero_bulkout_context));
@ -101,36 +87,32 @@ static u32 usb_bulkout_zero(struct intf_hdl *pintfhdl, u32 addr)
pcontext->pirp = NULL; pcontext->pirp = NULL;
pcontext->padapter = padapter; pcontext->padapter = padapter;
//translate DMA FIFO addr to pipehandle /* translate DMA FIFO addr to pipehandle */
usb_fill_bulk_urb(purb, pusbd, pipe, usb_fill_bulk_urb(purb, pusbd, pipe,
pbuf, pbuf,
len, len,
usb_bulkout_zero_complete, usb_bulkout_zero_complete,
pcontext);//context is pcontext pcontext);/* context is pcontext */
status = usb_submit_urb(purb, GFP_ATOMIC); status = usb_submit_urb(purb, GFP_ATOMIC);
if (!status) if (!status)
ret= _SUCCESS; ret = _SUCCESS;
else else
ret= _FAIL; ret = _FAIL;
return ret; return ret;
} }
void usb_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) void usb_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
{ {
} }
void usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) void usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
{ {
} }
void usb_read_port_cancel(struct intf_hdl *pintfhdl) void usb_read_port_cancel(struct intf_hdl *pintfhdl)
{ {
int i; int i;
@ -142,13 +124,10 @@ void usb_read_port_cancel(struct intf_hdl *pintfhdl)
padapter->bReadPortCancel = true; padapter->bReadPortCancel = true;
for (i=0; i < NR_RECVBUFF ; i++) { for (i = 0; i < NR_RECVBUFF; i++) {
precvbuf->reuse = true; precvbuf->reuse = true;
if (precvbuf->purb) { if (precvbuf->purb)
//DBG_88E("usb_read_port_cancel : usb_kill_urb\n");
usb_kill_urb(precvbuf->purb); usb_kill_urb(precvbuf->purb);
}
precvbuf++; precvbuf++;
} }
} }
@ -160,6 +139,7 @@ static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs)
struct xmit_buf *pxmitbuf = (struct xmit_buf *)purb->context; struct xmit_buf *pxmitbuf = (struct xmit_buf *)purb->context;
struct adapter *padapter = pxmitbuf->padapter; struct adapter *padapter = pxmitbuf->padapter;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct hal_data_8188e *haldata;
_func_enter_; _func_enter_;
@ -185,26 +165,26 @@ _func_enter_;
break; break;
} }
if (padapter->bSurpriseRemoved || padapter->bDriverStopped ||padapter->bWritePortCancel) { if (padapter->bSurpriseRemoved || padapter->bDriverStopped ||
padapter->bWritePortCancel) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
("usb_write_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)", ("usb_write_port_complete:bDriverStopped(%d) OR bSurpriseRemoved(%d)",
padapter->bDriverStopped, padapter->bSurpriseRemoved)); padapter->bDriverStopped, padapter->bSurpriseRemoved));
DBG_88E("%s(): TX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bWritePortCancel(%d) pxmitbuf->ext_tag(%x)\n", DBG_88E("%s(): TX Warning! bDriverStopped(%d) OR bSurpriseRemoved(%d) bWritePortCancel(%d) pxmitbuf->ext_tag(%x)\n",
__func__,padapter->bDriverStopped, padapter->bSurpriseRemoved,padapter->bReadPortCancel,pxmitbuf->ext_tag); __func__, padapter->bDriverStopped,
padapter->bSurpriseRemoved, padapter->bReadPortCancel,
pxmitbuf->ext_tag);
goto check_completion; goto check_completion;
} }
if (purb->status==0) { if (purb->status) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_write_port_complete : purb->status(%d) != 0\n", purb->status));
} else { DBG_88E("###=> urb_write_port_complete status(%d)\n", purb->status);
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete : purb->status(%d) != 0\n", purb->status)); if ((purb->status == -EPIPE) || (purb->status == -EPROTO)) {
DBG_88E("###=> urb_write_port_complete status(%d)\n",purb->status);
if ((purb->status==-EPIPE)||(purb->status==-EPROTO))
{
sreset_set_wifi_error_status(padapter, USB_WRITE_PORT_FAIL); sreset_set_wifi_error_status(padapter, USB_WRITE_PORT_FAIL);
} else if (purb->status == -EINPROGRESS) { } else if (purb->status == -EINPROGRESS) {
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: EINPROGESS\n")); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_write_port_complete: EINPROGESS\n"));
goto check_completion; goto check_completion;
} else if (purb->status == -ENOENT) { } else if (purb->status == -ENOENT) {
DBG_88E("%s: -ENOENT\n", __func__); DBG_88E("%s: -ENOENT\n", __func__);
@ -213,40 +193,32 @@ _func_enter_;
DBG_88E("%s: -ECONNRESET\n", __func__); DBG_88E("%s: -ECONNRESET\n", __func__);
goto check_completion; goto check_completion;
} else if (purb->status == -ESHUTDOWN) { } else if (purb->status == -ESHUTDOWN) {
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete: ESHUTDOWN\n")); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_write_port_complete: ESHUTDOWN\n"));
padapter->bDriverStopped=true; padapter->bDriverStopped = true;
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bDriverStopped=true\n")); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_write_port_complete:bDriverStopped = true\n"));
goto check_completion; goto check_completion;
} } else {
else padapter->bSurpriseRemoved = true;
{ DBG_88E("bSurpriseRemoved = true\n");
padapter->bSurpriseRemoved=true; RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_write_port_complete:bSurpriseRemoved = true\n"));
DBG_88E("bSurpriseRemoved=true\n");
//rtl8192cu_trigger_gpio_0(padapter);
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port_complete:bSurpriseRemoved=true\n"));
goto check_completion; goto check_completion;
} }
} }
{ haldata = GET_HAL_DATA(padapter);
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); haldata->srestpriv.last_tx_complete_time = rtw_get_current_time();
pHalData->srestpriv.last_tx_complete_time = rtw_get_current_time();
}
check_completion: check_completion:
rtw_sctx_done_err(&pxmitbuf->sctx, rtw_sctx_done_err(&pxmitbuf->sctx,
purb->status ? RTW_SCTX_DONE_WRITE_PORT_ERR : RTW_SCTX_DONE_SUCCESS); purb->status ? RTW_SCTX_DONE_WRITE_PORT_ERR :
RTW_SCTX_DONE_SUCCESS);
rtw_free_xmitbuf(pxmitpriv, pxmitbuf); rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
//if (rtw_txframes_pending(padapter)) tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
{
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
}
_func_exit_; _func_exit_;
} }
u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
@ -255,7 +227,7 @@ u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
unsigned int pipe; unsigned int pipe;
int status; int status;
u32 ret = _FAIL, bwritezero = false; u32 ret = _FAIL, bwritezero = false;
struct urb * purb = NULL; struct urb *purb = NULL;
struct adapter *padapter = (struct adapter *)pintfhdl->padapter; struct adapter *padapter = (struct adapter *)pintfhdl->padapter;
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@ -266,69 +238,69 @@ u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
_func_enter_; _func_enter_;
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("+usb_write_port\n")); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("+usb_write_port\n"));
if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||(padapter->pwrctrlpriv.pnp_bstop_trx)) { if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved ||adapter->pwrctrlpriv.pnp_bstop_trx)!!!\n")); (padapter->pwrctrlpriv.pnp_bstop_trx)) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
("usb_write_port:( padapter->bDriverStopped ||padapter->bSurpriseRemoved ||adapter->pwrctrlpriv.pnp_bstop_trx)!!!\n"));
rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_TX_DENY); rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_TX_DENY);
goto exit; goto exit;
} }
_enter_critical(&pxmitpriv->lock, &irqL); _enter_critical(&pxmitpriv->lock, &irqL);
switch (addr) switch (addr) {
{ case VO_QUEUE_INX:
case VO_QUEUE_INX: pxmitpriv->voq_cnt++;
pxmitpriv->voq_cnt++; pxmitbuf->flags = VO_QUEUE_INX;
pxmitbuf->flags = VO_QUEUE_INX; break;
break; case VI_QUEUE_INX:
case VI_QUEUE_INX: pxmitpriv->viq_cnt++;
pxmitpriv->viq_cnt++; pxmitbuf->flags = VI_QUEUE_INX;
pxmitbuf->flags = VI_QUEUE_INX; break;
break; case BE_QUEUE_INX:
case BE_QUEUE_INX: pxmitpriv->beq_cnt++;
pxmitpriv->beq_cnt++; pxmitbuf->flags = BE_QUEUE_INX;
pxmitbuf->flags = BE_QUEUE_INX; break;
break; case BK_QUEUE_INX:
case BK_QUEUE_INX: pxmitpriv->bkq_cnt++;
pxmitpriv->bkq_cnt++; pxmitbuf->flags = BK_QUEUE_INX;
pxmitbuf->flags = BK_QUEUE_INX; break;
break; case HIGH_QUEUE_INX:
case HIGH_QUEUE_INX: pxmitbuf->flags = HIGH_QUEUE_INX;
pxmitbuf->flags = HIGH_QUEUE_INX; break;
break; default:
default: pxmitbuf->flags = MGT_QUEUE_INX;
pxmitbuf->flags = MGT_QUEUE_INX; break;
break;
} }
_exit_critical(&pxmitpriv->lock, &irqL); _exit_critical(&pxmitpriv->lock, &irqL);
purb = pxmitbuf->pxmit_urb[0]; purb = pxmitbuf->pxmit_urb[0];
//translate DMA FIFO addr to pipehandle /* translate DMA FIFO addr to pipehandle */
pipe = ffaddr2pipehdl(pdvobj, addr); pipe = ffaddr2pipehdl(pdvobj, addr);
usb_fill_bulk_urb(purb, pusbd, pipe, usb_fill_bulk_urb(purb, pusbd, pipe,
pxmitframe->buf_addr, //= pxmitbuf->pbuf pxmitframe->buf_addr, /* pxmitbuf->pbuf */
cnt, cnt,
usb_write_port_complete, usb_write_port_complete,
pxmitbuf);//context is pxmitbuf pxmitbuf);/* context is pxmitbuf */
status = usb_submit_urb(purb, GFP_ATOMIC); status = usb_submit_urb(purb, GFP_ATOMIC);
if (!status) { if (!status) {
{ struct hal_data_8188e *haldata = GET_HAL_DATA(padapter);
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
pHalData->srestpriv.last_tx_time = rtw_get_current_time(); haldata->srestpriv.last_tx_time = rtw_get_current_time();
}
} else { } else {
rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_WRITE_PORT_ERR); rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_WRITE_PORT_ERR);
DBG_88E("usb_write_port, status=%d\n", status); DBG_88E("usb_write_port, status =%d\n", status);
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("usb_write_port(): usb_submit_urb, status=%x\n", status)); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("usb_write_port(): usb_submit_urb, status =%x\n", status));
switch (status) { switch (status) {
case -ENODEV: case -ENODEV:
padapter->bDriverStopped=true; padapter->bDriverStopped = true;
break; break;
default: default:
break; break;
@ -336,25 +308,17 @@ _func_enter_;
goto exit; goto exit;
} }
ret= _SUCCESS; ret = _SUCCESS;
// Commented by Albert 2009/10/13 /* We add the URB_ZERO_PACKET flag to urb so that the host will send the zero packet automatically. */
// We add the URB_ZERO_PACKET flag to urb so that the host will send the zero packet automatically.
/*
if (bwritezero == true)
{
usb_bulkout_zero(pintfhdl, addr);
}
*/
RT_TRACE(_module_hci_ops_os_c_,_drv_err_,("-usb_write_port\n")); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("-usb_write_port\n"));
exit: exit:
if (ret != _SUCCESS) if (ret != _SUCCESS)
rtw_free_xmitbuf(pxmitpriv, pxmitbuf); rtw_free_xmitbuf(pxmitpriv, pxmitbuf);
_func_exit_; _func_exit_;
return ret; return ret;
} }
void usb_write_port_cancel(struct intf_hdl *pintfhdl) void usb_write_port_cancel(struct intf_hdl *pintfhdl)
@ -367,21 +331,19 @@ void usb_write_port_cancel(struct intf_hdl *pintfhdl)
padapter->bWritePortCancel = true; padapter->bWritePortCancel = true;
for (i=0; i<NR_XMITBUFF; i++) { for (i = 0; i < NR_XMITBUFF; i++) {
for (j=0; j<8; j++) { for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j]) { if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]); usb_kill_urb(pxmitbuf->pxmit_urb[j]);
}
} }
pxmitbuf++; pxmitbuf++;
} }
pxmitbuf = (struct xmit_buf*)padapter->xmitpriv.pxmit_extbuf; pxmitbuf = (struct xmit_buf *)padapter->xmitpriv.pxmit_extbuf;
for (i = 0; i < NR_XMIT_EXTBUFF; i++) { for (i = 0; i < NR_XMIT_EXTBUFF; i++) {
for (j=0; j<8; j++) { for (j = 0; j < 8; j++) {
if (pxmitbuf->pxmit_urb[j]) { if (pxmitbuf->pxmit_urb[j])
usb_kill_urb(pxmitbuf->pxmit_urb[j]); usb_kill_urb(pxmitbuf->pxmit_urb[j]);
}
} }
pxmitbuf++; pxmitbuf++;
} }