mirror of
https://github.com/Mange/rtl8192eu-linux-driver
synced 2024-11-26 07:25:00 +00:00
clean up the usb_readXY functions
Remove unnecessary variables, summarize declarations and assignments. Link: https://lore.kernel.org/r/20210821164859.4351-6-martin@kaiser.cx
This commit is contained in:
parent
28e0bba794
commit
ba036a3e14
@ -319,26 +319,17 @@ int usb_async_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
|
|||||||
|
|
||||||
u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
|
u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
|
||||||
{
|
{
|
||||||
u8 requesttype;
|
u16 wvalue = (u16)(addr & 0x0000ffff);
|
||||||
u16 wvalue;
|
|
||||||
u16 index;
|
|
||||||
u16 len;
|
|
||||||
u8 data = 0;
|
u8 data = 0;
|
||||||
|
|
||||||
|
|
||||||
requesttype = 0x01;/* read_in */
|
|
||||||
index = 0;/* n/a */
|
|
||||||
|
|
||||||
wvalue = (u16)(addr & 0x0000ffff);
|
|
||||||
len = 1;
|
|
||||||
|
|
||||||
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
||||||
#if defined(CONFIG_RTL8710B)
|
#if defined(CONFIG_RTL8710B)
|
||||||
if(wvalue >= 0x0000 && wvalue < 0x0100)
|
if(wvalue >= 0x0000 && wvalue < 0x0100)
|
||||||
wvalue |= 0x8000;
|
wvalue |= 0x8000;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
|
usbctrl_vendorreq(pintfhdl, wvalue, 0, &data, 1, VENDOR_READ);
|
||||||
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
@ -346,18 +337,8 @@ u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
|
|||||||
|
|
||||||
u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
|
u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
|
||||||
{
|
{
|
||||||
u8 requesttype;
|
u16 wvalue = (u16)(addr & 0x0000ffff);
|
||||||
u16 wvalue;
|
u16 data;
|
||||||
u16 index;
|
|
||||||
u16 len;
|
|
||||||
u16 data = 0;
|
|
||||||
|
|
||||||
|
|
||||||
requesttype = 0x01;/* read_in */
|
|
||||||
index = 0;/* n/a */
|
|
||||||
|
|
||||||
wvalue = (u16)(addr & 0x0000ffff);
|
|
||||||
len = 2;
|
|
||||||
|
|
||||||
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
||||||
#if defined(CONFIG_RTL8710B)
|
#if defined(CONFIG_RTL8710B)
|
||||||
@ -365,7 +346,7 @@ u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
|
|||||||
wvalue |= 0x8000;
|
wvalue |= 0x8000;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
|
usbctrl_vendorreq(pintfhdl, wvalue, 0, &data, 2, VENDOR_READ);
|
||||||
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
@ -374,18 +355,8 @@ u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
|
|||||||
|
|
||||||
u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
|
u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
|
||||||
{
|
{
|
||||||
u8 requesttype;
|
u16 wvalue = (u16)(addr & 0x0000ffff);
|
||||||
u16 wvalue;
|
u32 data;
|
||||||
u16 index;
|
|
||||||
u16 len;
|
|
||||||
u32 data = 0;
|
|
||||||
|
|
||||||
|
|
||||||
requesttype = 0x01;/* read_in */
|
|
||||||
index = 0;/* n/a */
|
|
||||||
|
|
||||||
wvalue = (u16)(addr & 0x0000ffff);
|
|
||||||
len = 4;
|
|
||||||
|
|
||||||
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
/* WLANON PAGE0_REG needs to add an offset 0x8000 */
|
||||||
#if defined(CONFIG_RTL8710B)
|
#if defined(CONFIG_RTL8710B)
|
||||||
@ -393,7 +364,7 @@ u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
|
|||||||
wvalue |= 0x8000;
|
wvalue |= 0x8000;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
|
usbctrl_vendorreq(pintfhdl, wvalue, 0, &data, 4, VENDOR_READ);
|
||||||
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
Loading…
Reference in New Issue
Block a user