2023-01-23 20:54:06

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 02/23] staging: r8188eu: pass struct adapter to usb_write

The usb_write function takes a struct intf_hdl only to extract the struct
adapter from it. We can pass struct adapter directly.

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/hal/usb_ops_linux.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
index d82abfcd91f3..9f008e61a6f2 100644
--- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
@@ -49,9 +49,8 @@ static int usb_read(struct adapter *adapt, u16 value, void *data, u8 size)
return status;
}

-static int usb_write(struct intf_hdl *intf, u16 value, void *data, u8 size)
+static int usb_write(struct adapter *adapt, u16 value, void *data, u8 size)
{
- struct adapter *adapt = intf->padapter;
struct dvobj_priv *dvobjpriv = adapter_to_dvobj(adapt);
struct usb_device *udev = dvobjpriv->pusbdev;
int status;
@@ -131,48 +130,44 @@ int __must_check rtw_read32(struct adapter *adapter, u32 addr, u32 *data)

int rtw_write8(struct adapter *adapter, u32 addr, u8 val)
{
- struct intf_hdl *intf = &adapter->intf;
u16 value = addr & 0xffff;
int ret;

- ret = usb_write(intf, value, &val, 1);
+ ret = usb_write(adapter, value, &val, 1);

return RTW_STATUS_CODE(ret);
}

int rtw_write16(struct adapter *adapter, u32 addr, u16 val)
{
- struct intf_hdl *intf = &adapter->intf;
u16 value = addr & 0xffff;
__le16 data = cpu_to_le16(val);
int ret;

- ret = usb_write(intf, value, &data, 2);
+ ret = usb_write(adapter, value, &data, 2);

return RTW_STATUS_CODE(ret);
}

int rtw_write32(struct adapter *adapter, u32 addr, u32 val)
{
- struct intf_hdl *intf = &adapter->intf;
u16 value = addr & 0xffff;
__le32 data = cpu_to_le32(val);
int ret;

- ret = usb_write(intf, value, &data, 4);
+ ret = usb_write(adapter, value, &data, 4);

return RTW_STATUS_CODE(ret);
}

int rtw_writeN(struct adapter *adapter, u32 addr, u32 length, u8 *data)
{
- struct intf_hdl *intf = &adapter->intf;
u16 value = addr & 0xffff;

if (length > VENDOR_CMD_MAX_DATA_LEN)
return -EINVAL;

- return usb_write(intf, value, data, length);
+ return usb_write(adapter, value, data, length);
}

static void handle_txrpt_ccx_88e(struct adapter *adapter, u8 *buf)
--
2.30.2