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

staging: rtl8723au: Pass a struct rtw_adapter * to the USB functions

This lowers the dependency on struct intf_hdl so we can start getting
rid of if.
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ad0fb71b
......@@ -46,7 +46,7 @@ u8 _rtw_read823a(struct rtw_adapter *adapter, u32 addr)
u8 r_val;
struct intf_hdl *pintfhdl = &adapter->intf;
r_val = pintfhdl->io_ops._read8(pintfhdl, addr);
r_val = pintfhdl->io_ops._read8(adapter, addr);
return r_val;
}
......@@ -56,7 +56,7 @@ u16 _rtw_read1623a(struct rtw_adapter *adapter, u32 addr)
u16 r_val;
struct intf_hdl *pintfhdl = &adapter->intf;
r_val = pintfhdl->io_ops._read16(pintfhdl, addr);
r_val = pintfhdl->io_ops._read16(adapter, addr);
return le16_to_cpu(r_val);
}
......@@ -66,7 +66,7 @@ u32 _rtw_read3223a(struct rtw_adapter *adapter, u32 addr)
u32 r_val;
struct intf_hdl *pintfhdl = &adapter->intf;
r_val = pintfhdl->io_ops._read32(pintfhdl, addr);
r_val = pintfhdl->io_ops._read32(adapter, addr);
return le32_to_cpu(r_val);
}
......@@ -76,7 +76,7 @@ int _rtw_write823a(struct rtw_adapter *adapter, u32 addr, u8 val)
struct intf_hdl *pintfhdl = &adapter->intf;
int ret;
ret = pintfhdl->io_ops._write8(pintfhdl, addr, val);
ret = pintfhdl->io_ops._write8(adapter, addr, val);
return RTW_STATUS_CODE23a(ret);
}
......@@ -87,7 +87,7 @@ int _rtw_write1623a(struct rtw_adapter *adapter, u32 addr, u16 val)
int ret;
val = cpu_to_le16(val);
ret = pintfhdl->io_ops._write16(pintfhdl, addr, val);
ret = pintfhdl->io_ops._write16(adapter, addr, val);
return RTW_STATUS_CODE23a(ret);
}
......@@ -98,7 +98,7 @@ int _rtw_write3223a(struct rtw_adapter *adapter, u32 addr, u32 val)
int ret;
val = cpu_to_le32(val);
ret = pintfhdl->io_ops._write32(pintfhdl, addr, val);
ret = pintfhdl->io_ops._write32(adapter, addr, val);
return RTW_STATUS_CODE23a(ret);
}
......@@ -108,7 +108,7 @@ int _rtw_writeN23a(struct rtw_adapter *adapter, u32 addr , u32 length , u8 *pdat
struct intf_hdl *pintfhdl = &adapter->intf;
int ret;
ret = pintfhdl->io_ops._writeN(pintfhdl, addr, length, pdata);
ret = pintfhdl->io_ops._writeN(adapter, addr, length, pdata);
return RTW_STATUS_CODE23a(ret);
}
......@@ -125,14 +125,14 @@ void _rtw_read_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
return;
}
pintfhdl->io_ops._read_mem(pintfhdl, addr, cnt, pmem);
pintfhdl->io_ops._read_mem(adapter, addr, cnt, pmem);
}
void _rtw_write_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
{
struct intf_hdl *pintfhdl = &adapter->intf;
pintfhdl->io_ops._write_mem(pintfhdl, addr, cnt, pmem);
pintfhdl->io_ops._write_mem(adapter, addr, cnt, pmem);
}
void _rtw_read_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt,
......@@ -149,18 +149,18 @@ void _rtw_read_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt,
return;
}
pintfhdl->io_ops._read_port(pintfhdl, addr, cnt, rbuf);
pintfhdl->io_ops._read_port(adapter, addr, cnt, rbuf);
}
void _rtw_read_port23a_cancel(struct rtw_adapter *adapter)
{
void (*_read_port_cancel)(struct intf_hdl *pintfhdl);
void (*_read_port_cancel)(struct rtw_adapter *adapter);
struct intf_hdl *pintfhdl = &adapter->intf;
_read_port_cancel = pintfhdl->io_ops._read_port_cancel;
if (_read_port_cancel)
_read_port_cancel(pintfhdl);
_read_port_cancel(adapter);
}
u32 _rtw_write_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt,
......@@ -169,18 +169,18 @@ u32 _rtw_write_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt,
struct intf_hdl *pintfhdl = &adapter->intf;
u32 ret = _SUCCESS;
ret = pintfhdl->io_ops._write_port(pintfhdl, addr, cnt, xbuf);
ret = pintfhdl->io_ops._write_port(adapter, addr, cnt, xbuf);
return ret;
}
void _rtw_write_port23a_cancel(struct rtw_adapter *adapter)
{
void (*_write_port_cancel)(struct intf_hdl *pintfhdl);
void (*_write_port_cancel)(struct rtw_adapter *adapter);
struct intf_hdl *pintfhdl = &adapter->intf;
_write_port_cancel = pintfhdl->io_ops._write_port_cancel;
if (_write_port_cancel)
_write_port_cancel(pintfhdl);
_write_port_cancel(adapter);
}
......@@ -1229,9 +1229,9 @@ static unsigned int rtl8723au_inirp_init(struct rtw_adapter *Adapter)
uint status;
struct intf_hdl *pintfhdl = &Adapter->intf;
struct recv_priv *precvpriv = &Adapter->recvpriv;
u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
u32 (*_read_port)(struct rtw_adapter *padapter, u32 addr, u32 cnt,
struct recv_buf *rbuf);
u32 (*_read_interrupt)(struct intf_hdl *pintfhdl, u32 addr);
u32 (*_read_interrupt)(struct rtw_adapter *padapter, u32 addr);
struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter);
_read_port = pintfhdl->io_ops._read_port;
......@@ -1245,7 +1245,7 @@ static unsigned int rtl8723au_inirp_init(struct rtw_adapter *Adapter)
/* issue Rx irp to receive data */
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
for (i = 0; i < NR_RECVBUFF; i++) {
if (_read_port(pintfhdl, precvpriv->ff_hwaddr, 0, precvbuf) ==
if (_read_port(Adapter, precvpriv->ff_hwaddr, 0, precvbuf) ==
false) {
RT_TRACE(_module_hci_hal_init_c_, _drv_err_,
("usb_rx_init: usb_read_port error\n"));
......@@ -1256,7 +1256,7 @@ static unsigned int rtl8723au_inirp_init(struct rtw_adapter *Adapter)
precvpriv->free_recv_buf_queue_cnt--;
}
_read_interrupt = pintfhdl->io_ops._read_interrupt;
if (_read_interrupt(pintfhdl, RECV_INT_IN_ADDR) == false) {
if (_read_interrupt(Adapter, RECV_INT_IN_ADDR) == false) {
RT_TRACE(_module_hci_hal_init_c_, _drv_err_,
("usb_rx_init: usb_read_interrupt error\n"));
status = _FAIL;
......
......@@ -22,9 +22,10 @@
#include <rtl8723a_hal.h>
#include <rtl8723a_recv.h>
static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
static int usbctrl_vendorreq(struct rtw_adapter *padapter, u8 request,
u16 value, u16 index, void *pdata, u16 len,
u8 requesttype)
{
struct rtw_adapter *padapter = pintfhdl->padapter ;
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
struct usb_device *udev = pdvobjpriv->pusbdev;
......@@ -124,7 +125,7 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
return status;
}
static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
static u8 usb_read8(struct rtw_adapter *padapter, u32 addr)
{
u8 request;
u8 requesttype;
......@@ -140,12 +141,13 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
wvalue = (u16)(addr&0x0000ffff);
len = 1;
usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
usbctrl_vendorreq(padapter, request, wvalue, index, &data,
len, requesttype);
return data;
}
static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
static u16 usb_read16(struct rtw_adapter *padapter, u32 addr)
{
u8 request;
u8 requesttype;
......@@ -161,12 +163,13 @@ static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
wvalue = (u16)(addr&0x0000ffff);
len = 2;
usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
usbctrl_vendorreq(padapter, request, wvalue, index, &data,
len, requesttype);
return data;
}
static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
static u32 usb_read32(struct rtw_adapter *padapter, u32 addr)
{
u8 request;
u8 requesttype;
......@@ -182,12 +185,13 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
wvalue = (u16)(addr&0x0000ffff);
len = 4;
usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
usbctrl_vendorreq(padapter, request, wvalue, index, &data,
len, requesttype);
return data;
}
static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
static int usb_write8(struct rtw_adapter *padapter, u32 addr, u8 val)
{
u8 request;
u8 requesttype;
......@@ -206,12 +210,13 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
data = val;
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
ret = usbctrl_vendorreq(padapter, request, wvalue, index, &data,
len, requesttype);
return ret;
}
static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
static int usb_write16(struct rtw_adapter *padapter, u32 addr, u16 val)
{
u8 request;
u8 requesttype;
......@@ -230,11 +235,12 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
data = val;
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
ret = usbctrl_vendorreq(padapter, request, wvalue, index, &data,
len, requesttype);
return ret;
}
static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
static int usb_write32(struct rtw_adapter *padapter, u32 addr, u32 val)
{
u8 request;
u8 requesttype;
......@@ -252,12 +258,14 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
len = 4;
data = val;
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
ret = usbctrl_vendorreq(padapter, request, wvalue, index, &data,
len, requesttype);
return ret;
}
static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata)
static int usb_writeN(struct rtw_adapter *padapter,
u32 addr, u32 length, u8 *pdata)
{
u8 request;
u8 requesttype;
......@@ -275,7 +283,8 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
len = length;
memcpy(buf, pdata, len);
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, buf, len, requesttype);
ret = usbctrl_vendorreq(padapter, request, wvalue, index, buf,
len, requesttype);
return ret;
}
......@@ -423,12 +432,11 @@ static void usb_read_interrupt_complete(struct urb *purb, struct pt_regs *regs)
}
}
static u32 usb_read_interrupt(struct intf_hdl *pintfhdl, u32 addr)
static u32 usb_read_interrupt(struct rtw_adapter *adapter, u32 addr)
{
int err;
unsigned int pipe;
u32 ret = _SUCCESS;
struct rtw_adapter *adapter = pintfhdl->padapter;
struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter);
struct recv_priv *precvpriv = &adapter->recvpriv;
struct usb_device *pusbd = pdvobj->pusbdev;
......@@ -720,7 +728,7 @@ static void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
}
}
static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
static u32 usb_read_port(struct rtw_adapter *adapter, u32 addr, u32 cnt,
struct recv_buf *precvbuf)
{
int err;
......@@ -729,7 +737,6 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
unsigned long alignment = 0;
u32 ret = _SUCCESS;
struct urb *purb = NULL;
struct rtw_adapter *adapter = pintfhdl->padapter;
struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter);
struct recv_priv *precvpriv = &adapter->recvpriv;
struct usb_device *pusbd = pdvobj->pusbdev;
......
......@@ -101,25 +101,25 @@ struct intf_hdl;
struct _io_ops
{
u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
u8 (*_read8)(struct rtw_adapter *adapter, u32 addr);
u16 (*_read16)(struct rtw_adapter *adapter, u32 addr);
u32 (*_read32)(struct rtw_adapter *adapter, u32 addr);
int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
int (*_writeN)(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata);
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);
void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
void (*_write_mem)(struct intf_hdl *pintfhdl, 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 intf_hdl *pintfhdl, u32 addr);
u32 (*_read_interrupt)(struct rtw_adapter *adapter, u32 addr);
u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, struct recv_buf *rbuf);
u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, struct xmit_buf *pmem);
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);
void (*_read_port_cancel)(struct intf_hdl *pintfhdl);
void (*_write_port_cancel)(struct intf_hdl *pintfhdl);
void (*_read_port_cancel)(struct rtw_adapter *adapter);
void (*_write_port_cancel)(struct rtw_adapter *adapter);
};
struct io_req {
......
......@@ -34,13 +34,13 @@
unsigned int ffaddr2pipehdl23a(struct dvobj_priv *pdvobj, u32 addr);
void usb_read_mem23a(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem);
void usb_write_mem23a(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem);
void usb_read_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *rmem);
void usb_write_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *wmem);
void usb_read_port_cancel23a(struct intf_hdl *pintfhdl);
void usb_read_port_cancel23a(struct rtw_adapter *adapter);
u32 usb_write_port23a(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
u32 usb_write_port23a(struct rtw_adapter *adapter, u32 addr, u32 cnt,
struct xmit_buf *wmem);
void usb_write_port23a_cancel(struct intf_hdl *pintfhdl);
void usb_write_port23a_cancel(struct rtw_adapter *adapter);
#endif
......@@ -41,18 +41,17 @@ struct zero_bulkout_context {
void *padapter;
};
void usb_read_mem23a(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
void usb_read_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *rmem)
{
}
void usb_write_mem23a(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
void usb_write_mem23a(struct rtw_adapter *adapter, u32 addr, u32 cnt, u8 *wmem)
{
}
void usb_read_port_cancel23a(struct intf_hdl *pintfhdl)
void usb_read_port_cancel23a(struct rtw_adapter *padapter)
{
struct recv_buf *precvbuf;
struct rtw_adapter *padapter = pintfhdl->padapter;
int i;
precvbuf = (struct recv_buf *)padapter->recvpriv.precv_buf;
......@@ -161,11 +160,10 @@ static void usb_write_port23a_complete(struct urb *purb, struct pt_regs *regs)
tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
}
u32 usb_write_port23a(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
u32 usb_write_port23a(struct rtw_adapter *padapter, u32 addr, u32 cnt,
struct xmit_buf *pxmitbuf)
{
struct urb *purb = NULL;
struct rtw_adapter *padapter = (struct rtw_adapter *)pintfhdl->padapter;
struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter);
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data;
......@@ -255,9 +253,8 @@ u32 usb_write_port23a(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
return ret;
}
void usb_write_port23a_cancel(struct intf_hdl *pintfhdl)
void usb_write_port23a_cancel(struct rtw_adapter *padapter)
{
struct rtw_adapter *padapter = pintfhdl->padapter;
struct xmit_buf *pxmitbuf;
struct list_head *plist;
int j;
......
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