staging: r8188eu: clean up the usb_writeXY functions

Remove unnecessary variables, summarize declarations and assignments.

Acked-by: Phillip Potter <phil@philpotter.co.uk>
Acked-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20210821164859.4351-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Martin Kaiser 2021-08-21 18:48:56 +02:00 коммит произвёл Greg Kroah-Hartman
Родитель 0d3e1be506
Коммит e8baed3c76
1 изменённых файлов: 8 добавлений и 42 удалений

Просмотреть файл

@ -128,59 +128,25 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
{ {
u16 wvalue; u16 wvalue = (u16)(addr & 0x0000ffff);
u16 len;
u8 data;
int ret;
return usbctrl_vendorreq(pintfhdl, wvalue, &val, 1, REALTEK_USB_VENQT_WRITE);
wvalue = (u16)(addr & 0x0000ffff);
len = 1;
data = val;
ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_WRITE);
return ret;
} }
static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
{ {
u16 wvalue; u16 wvalue = (u16)(addr & 0x0000ffff);
u16 len; __le32 data = cpu_to_le32(val & 0x0000ffff);
__le32 data;
int ret;
return usbctrl_vendorreq(pintfhdl, wvalue, &data, 2, REALTEK_USB_VENQT_WRITE);
wvalue = (u16)(addr & 0x0000ffff);
len = 2;
data = cpu_to_le32(val & 0x0000ffff);
ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_WRITE);
return ret;
} }
static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
{ {
u16 wvalue; u16 wvalue = (u16)(addr & 0x0000ffff);
u16 len; __le32 data = cpu_to_le32(val);
__le32 data;
int ret;
return usbctrl_vendorreq(pintfhdl, wvalue, &data, 4, REALTEK_USB_VENQT_WRITE);
wvalue = (u16)(addr & 0x0000ffff);
len = 4;
data = cpu_to_le32(val);
ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_WRITE);
return ret;
} }
static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata) static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata)