Commit ad899b12 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: Clean up error codes in IO functions

This also fixes up another messy case assuming _FAIL == false and
true == _SUCCESS
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 828373f9
...@@ -139,7 +139,7 @@ void _rtw_write_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *pmem) ...@@ -139,7 +139,7 @@ void _rtw_write_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
io_ops->_write_mem(adapter, addr, cnt, pmem); io_ops->_write_mem(adapter, addr, cnt, pmem);
} }
void _rtw_read_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, int _rtw_read_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt,
struct recv_buf *rbuf) struct recv_buf *rbuf)
{ {
struct _io_ops *io_ops = &adapter->io_ops; struct _io_ops *io_ops = &adapter->io_ops;
...@@ -150,10 +150,10 @@ void _rtw_read_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, ...@@ -150,10 +150,10 @@ void _rtw_read_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt,
("rtw_read_port:bDriverStopped(%d) OR " ("rtw_read_port:bDriverStopped(%d) OR "
"bSurpriseRemoved(%d)", adapter->bDriverStopped, "bSurpriseRemoved(%d)", adapter->bDriverStopped,
adapter->bSurpriseRemoved)); adapter->bSurpriseRemoved));
return; return _FAIL;
} }
io_ops->_read_port(adapter, addr, cnt, rbuf); return io_ops->_read_port(adapter, addr, cnt, rbuf);
} }
void _rtw_read_port23a_cancel(struct rtw_adapter *adapter) void _rtw_read_port23a_cancel(struct rtw_adapter *adapter)
...@@ -167,11 +167,11 @@ void _rtw_read_port23a_cancel(struct rtw_adapter *adapter) ...@@ -167,11 +167,11 @@ void _rtw_read_port23a_cancel(struct rtw_adapter *adapter)
_read_port_cancel(adapter); _read_port_cancel(adapter);
} }
u32 _rtw_write_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, int _rtw_write_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt,
struct xmit_buf *xbuf) struct xmit_buf *xbuf)
{ {
struct _io_ops *io_ops = &adapter->io_ops; struct _io_ops *io_ops = &adapter->io_ops;
u32 ret = _SUCCESS; int ret = _SUCCESS;
ret = io_ops->_write_port(adapter, addr, cnt, xbuf); ret = io_ops->_write_port(adapter, addr, cnt, xbuf);
......
...@@ -1228,9 +1228,9 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter) ...@@ -1228,9 +1228,9 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter)
int status; int status;
struct _io_ops *io_ops = &Adapter->io_ops; struct _io_ops *io_ops = &Adapter->io_ops;
struct recv_priv *precvpriv = &Adapter->recvpriv; struct recv_priv *precvpriv = &Adapter->recvpriv;
u32 (*_read_port)(struct rtw_adapter *padapter, u32 addr, u32 cnt, int (*_read_port)(struct rtw_adapter *padapter, u32 addr, u32 cnt,
struct recv_buf *rbuf); struct recv_buf *rbuf);
u32 (*_read_interrupt)(struct rtw_adapter *padapter, u32 addr); int (*_read_interrupt)(struct rtw_adapter *padapter, u32 addr);
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
_read_port = io_ops->_read_port; _read_port = io_ops->_read_port;
...@@ -1245,7 +1245,7 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter) ...@@ -1245,7 +1245,7 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter)
precvbuf = (struct recv_buf *)precvpriv->precv_buf; precvbuf = (struct recv_buf *)precvpriv->precv_buf;
for (i = 0; i < NR_RECVBUFF; i++) { for (i = 0; i < NR_RECVBUFF; i++) {
if (_read_port(Adapter, precvpriv->ff_hwaddr, 0, precvbuf) == if (_read_port(Adapter, precvpriv->ff_hwaddr, 0, precvbuf) ==
false) { _FAIL) {
RT_TRACE(_module_hci_hal_init_c_, _drv_err_, RT_TRACE(_module_hci_hal_init_c_, _drv_err_,
("usb_rx_init: usb_read_port error\n")); ("usb_rx_init: usb_read_port error\n"));
status = _FAIL; status = _FAIL;
...@@ -1254,7 +1254,7 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter) ...@@ -1254,7 +1254,7 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter)
precvbuf++; precvbuf++;
} }
_read_interrupt = io_ops->_read_interrupt; _read_interrupt = io_ops->_read_interrupt;
if (_read_interrupt(Adapter, RECV_INT_IN_ADDR) == false) { if (_read_interrupt(Adapter, RECV_INT_IN_ADDR) == _FAIL) {
RT_TRACE(_module_hci_hal_init_c_, _drv_err_, RT_TRACE(_module_hci_hal_init_c_, _drv_err_,
("usb_rx_init: usb_read_interrupt error\n")); ("usb_rx_init: usb_read_interrupt error\n"));
status = _FAIL; status = _FAIL;
......
...@@ -439,11 +439,11 @@ static void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs) ...@@ -439,11 +439,11 @@ static void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs)
} }
} }
static u32 usb_read_interrupt(struct rtw_adapter *adapter, u32 addr) static int usb_read_interrupt(struct rtw_adapter *adapter, u32 addr)
{ {
int err; int err;
unsigned int pipe; unsigned int pipe;
u32 ret = _SUCCESS; int ret = _SUCCESS;
struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter); struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter);
struct recv_priv *precvpriv = &adapter->recvpriv; struct recv_priv *precvpriv = &adapter->recvpriv;
struct usb_device *pusbd = pdvobj->pusbdev; struct usb_device *pusbd = pdvobj->pusbdev;
...@@ -733,14 +733,14 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs) ...@@ -733,14 +733,14 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
} }
} }
static u32 usb_read_port(struct rtw_adapter *adapter, u32 addr, u32 cnt, static int usb_read_port(struct rtw_adapter *adapter, u32 addr, u32 cnt,
struct recv_buf *precvbuf) struct recv_buf *precvbuf)
{ {
int err; int err;
unsigned int pipe; unsigned int pipe;
unsigned long tmpaddr = 0; unsigned long tmpaddr = 0;
unsigned long alignment = 0; unsigned long alignment = 0;
u32 ret = _SUCCESS; int ret = _SUCCESS;
struct urb *purb = NULL; struct urb *purb = NULL;
struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter); struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter);
struct recv_priv *precvpriv = &adapter->recvpriv; struct recv_priv *precvpriv = &adapter->recvpriv;
......
...@@ -107,15 +107,20 @@ struct _io_ops ...@@ -107,15 +107,20 @@ struct _io_ops
int (*_write8)(struct rtw_adapter *adapter, u32 addr, u8 val); int (*_write8)(struct rtw_adapter *adapter, u32 addr, u8 val);
int (*_write16)(struct rtw_adapter *adapter, u32 addr, u16 val); int (*_write16)(struct rtw_adapter *adapter, u32 addr, u16 val);
int (*_write32)(struct rtw_adapter *adapter, u32 addr, u32 val); int (*_write32)(struct rtw_adapter *adapter, u32 addr, u32 val);
int (*_writeN)(struct rtw_adapter *adapter, u32 addr, u32 length, u8 *pdata); int (*_writeN)(struct rtw_adapter *adapter, u32 addr, u32 length,
u8 *pdata);
void (*_read_mem)(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *pmem); void (*_read_mem)(struct rtw_adapter *adapter, u32 addr, u32 cnt,
void (*_write_mem)(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *pmem); u8 *pmem);
void (*_write_mem)(struct rtw_adapter *adapter, u32 addr, u32 cnt,
u8 *pmem);
u32 (*_read_interrupt)(struct rtw_adapter *adapter, u32 addr); int (*_read_interrupt)(struct rtw_adapter *adapter, u32 addr);
u32 (*_read_port)(struct rtw_adapter *adapter, u32 addr, u32 cnt, struct recv_buf *rbuf); int (*_read_port)(struct rtw_adapter *adapter, u32 addr, u32 cnt,
u32 (*_write_port)(struct rtw_adapter *adapter, u32 addr, u32 cnt, struct xmit_buf *pmem); struct recv_buf *rbuf);
int (*_write_port)(struct rtw_adapter *adapter, u32 addr, u32 cnt,
struct xmit_buf *pmem);
void (*_read_port_cancel)(struct rtw_adapter *adapter); void (*_read_port_cancel)(struct rtw_adapter *adapter);
void (*_write_port_cancel)(struct rtw_adapter *adapter); void (*_write_port_cancel)(struct rtw_adapter *adapter);
...@@ -254,7 +259,7 @@ u8 _rtw_read823a(struct rtw_adapter *adapter, u32 addr); ...@@ -254,7 +259,7 @@ u8 _rtw_read823a(struct rtw_adapter *adapter, u32 addr);
u16 _rtw_read1623a(struct rtw_adapter *adapter, u32 addr); u16 _rtw_read1623a(struct rtw_adapter *adapter, u32 addr);
u32 _rtw_read3223a(struct rtw_adapter *adapter, u32 addr); u32 _rtw_read3223a(struct rtw_adapter *adapter, u32 addr);
void _rtw_read_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *pmem); void _rtw_read_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
void _rtw_read_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, struct recv_buf *rbuf); int _rtw_read_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, struct recv_buf *rbuf);
void _rtw_read_port23a_cancel(struct rtw_adapter *adapter); void _rtw_read_port23a_cancel(struct rtw_adapter *adapter);
int _rtw_write823a(struct rtw_adapter *adapter, u32 addr, u8 val); int _rtw_write823a(struct rtw_adapter *adapter, u32 addr, u8 val);
...@@ -263,7 +268,7 @@ int _rtw_write3223a(struct rtw_adapter *adapter, u32 addr, u32 val); ...@@ -263,7 +268,7 @@ int _rtw_write3223a(struct rtw_adapter *adapter, u32 addr, u32 val);
int _rtw_writeN23a(struct rtw_adapter *adapter, u32 addr, u32 length, u8 *pdata); int _rtw_writeN23a(struct rtw_adapter *adapter, u32 addr, u32 length, u8 *pdata);
void _rtw_write_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *pmem); void _rtw_write_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
u32 _rtw_write_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, struct xmit_buf *pmem); int _rtw_write_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, struct xmit_buf *pmem);
void _rtw_write_port23a_cancel(struct rtw_adapter *adapter); void _rtw_write_port23a_cancel(struct rtw_adapter *adapter);
#ifdef DBG_IO #ifdef DBG_IO
......
...@@ -39,7 +39,7 @@ void usb_write_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *wmem); ...@@ -39,7 +39,7 @@ void usb_write_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *wmem);
void usb_read_port_cancel23a(struct rtw_adapter *adapter); void usb_read_port_cancel23a(struct rtw_adapter *adapter);
u32 usb_write_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, int usb_write_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt,
struct xmit_buf *wmem); struct xmit_buf *wmem);
void usb_write_port23a_cancel(struct rtw_adapter *adapter); void usb_write_port23a_cancel(struct rtw_adapter *adapter);
......
...@@ -160,7 +160,7 @@ static void usb_write_port23a_complete(struct urb *purb, struct pt_regs *regs) ...@@ -160,7 +160,7 @@ static void usb_write_port23a_complete(struct urb *purb, struct pt_regs *regs)
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
} }
u32 usb_write_port23a(struct rtw_adapter *padapter, u32 addr, u32 cnt, int usb_write_port23a(struct rtw_adapter *padapter, u32 addr, u32 cnt,
struct xmit_buf *pxmitbuf) struct xmit_buf *pxmitbuf)
{ {
struct urb *purb = NULL; struct urb *purb = NULL;
...@@ -171,7 +171,7 @@ u32 usb_write_port23a(struct rtw_adapter *padapter, u32 addr, u32 cnt, ...@@ -171,7 +171,7 @@ u32 usb_write_port23a(struct rtw_adapter *padapter, u32 addr, u32 cnt,
unsigned long irqL; unsigned long irqL;
unsigned int pipe; unsigned int pipe;
int status; int status;
u32 ret = _FAIL; int ret = _FAIL;
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("+usb_write_port23a\n")); RT_TRACE(_module_hci_ops_os_c_, _drv_err_, ("+usb_write_port23a\n"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment