[1/6] staging: r8188eu: pass a struct recv_buf to rtw_read_port
Commit Message
The rtw_read_port function needs a struct recv_buf for preparing the usb
transfer.
Replace its u8 *rmem parameter with a struct recv_buf pointer to avoid
casts in the caller and in rtw_read_port.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/hal/usb_halinit.c | 2 +-
drivers/staging/r8188eu/hal/usb_ops_linux.c | 9 ++++-----
drivers/staging/r8188eu/include/rtw_io.h | 2 +-
3 files changed, 6 insertions(+), 7 deletions(-)
@@ -860,7 +860,7 @@ unsigned int rtl8188eu_inirp_init(struct adapter *Adapter)
/* issue Rx irp to receive data */
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
for (i = 0; i < NR_RECVBUFF; i++) {
- if (!rtw_read_port(Adapter, (unsigned char *)precvbuf)) {
+ if (!rtw_read_port(Adapter, precvbuf)) {
status = _FAIL;
goto exit;
}
@@ -364,7 +364,7 @@ static void usb_read_port_complete(struct urb *purb)
if (purb->status == 0) { /* SUCCESS */
if ((purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)) {
precvbuf->reuse = true;
- rtw_read_port(adapt, (unsigned char *)precvbuf);
+ rtw_read_port(adapt, precvbuf);
} else {
rtw_reset_continual_urb_error(adapter_to_dvobj(adapt));
@@ -376,7 +376,7 @@ static void usb_read_port_complete(struct urb *purb)
precvbuf->pskb = NULL;
precvbuf->reuse = false;
- rtw_read_port(adapt, (unsigned char *)precvbuf);
+ rtw_read_port(adapt, precvbuf);
}
} else {
skb_put(precvbuf->pskb, purb->actual_length);
@@ -396,7 +396,7 @@ static void usb_read_port_complete(struct urb *purb)
case -EPROTO:
case -EOVERFLOW:
precvbuf->reuse = true;
- rtw_read_port(adapt, (unsigned char *)precvbuf);
+ rtw_read_port(adapt, precvbuf);
break;
case -EINPROGRESS:
break;
@@ -406,10 +406,9 @@ static void usb_read_port_complete(struct urb *purb)
}
}
-u32 rtw_read_port(struct adapter *adapter, u8 *rmem)
+u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf)
{
struct urb *purb = NULL;
- struct recv_buf *precvbuf = (struct recv_buf *)rmem;
struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter);
struct recv_priv *precvpriv = &adapter->recvpriv;
struct usb_device *pusbd = pdvobj->pusbdev;
@@ -19,7 +19,7 @@
int __must_check rtw_read8(struct adapter *adapter, u32 addr, u8 *data);
int __must_check rtw_read16(struct adapter *adapter, u32 addr, u16 *data);
int __must_check rtw_read32(struct adapter *adapter, u32 addr, u32 *data);
-u32 rtw_read_port(struct adapter *adapter, u8 *pmem);
+u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf);
void rtw_read_port_cancel(struct adapter *adapter);
int rtw_write8(struct adapter *adapter, u32 addr, u8 val);