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)
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 _io_ops *io_ops = &adapter->io_ops;
......@@ -150,10 +150,10 @@ void _rtw_read_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt,
("rtw_read_port:bDriverStopped(%d) OR "
"bSurpriseRemoved(%d)", adapter->bDriverStopped,
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)
......@@ -167,11 +167,11 @@ void _rtw_read_port23a_cancel(struct rtw_adapter *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 _io_ops *io_ops = &adapter->io_ops;
u32 ret = _SUCCESS;
int ret = _SUCCESS;
ret = io_ops->_write_port(adapter, addr, cnt, xbuf);
......
......@@ -1228,9 +1228,9 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter)
int status;
struct _io_ops *io_ops = &Adapter->io_ops;
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);
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);
_read_port = io_ops->_read_port;
......@@ -1245,7 +1245,7 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter)
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
for (i = 0; i < NR_RECVBUFF; i++) {
if (_read_port(Adapter, precvpriv->ff_hwaddr, 0, precvbuf) ==
false) {
_FAIL) {
RT_TRACE(_module_hci_hal_init_c_, _drv_err_,
("usb_rx_init: usb_read_port error\n"));
status = _FAIL;
......@@ -1254,7 +1254,7 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter)
precvbuf++;
}
_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_,
("usb_rx_init: usb_read_interrupt error\n"));
status = _FAIL;
......
......@@ -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;
unsigned int pipe;
u32 ret = _SUCCESS;
int ret = _SUCCESS;
struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter);
struct recv_priv *precvpriv = &adapter->recvpriv;
struct usb_device *pusbd = pdvobj->pusbdev;
......@@ -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)
{
int err;
unsigned int pipe;
unsigned long tmpaddr = 0;
unsigned long alignment = 0;
u32 ret = _SUCCESS;
int ret = _SUCCESS;
struct urb *purb = NULL;
struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter);
struct recv_priv *precvpriv = &adapter->recvpriv;
......
......@@ -107,15 +107,20 @@ struct _io_ops
int (*_write8)(struct rtw_adapter *adapter, u32 addr, u8 val);
int (*_write16)(struct rtw_adapter *adapter, u32 addr, u16 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 (*_write_mem)(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
void (*_read_mem)(struct rtw_adapter *adapter, u32 addr, u32 cnt,
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);
u32 (*_write_port)(struct rtw_adapter *adapter, u32 addr, u32 cnt, struct xmit_buf *pmem);
int (*_read_port)(struct rtw_adapter *adapter, u32 addr, u32 cnt,
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 (*_write_port_cancel)(struct rtw_adapter *adapter);
......@@ -254,7 +259,7 @@ u8 _rtw_read823a(struct rtw_adapter *adapter, u32 addr);
u16 _rtw_read1623a(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_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);
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);
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);
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);
#ifdef DBG_IO
......
......@@ -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);
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);
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)
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 urb *purb = NULL;
......@@ -171,7 +171,7 @@ u32 usb_write_port23a(struct rtw_adapter *padapter, u32 addr, u32 cnt,
unsigned long irqL;
unsigned int pipe;
int status;
u32 ret = _FAIL;
int ret = _FAIL;
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