Commit 5829a658 authored by Pavel Skripkin's avatar Pavel Skripkin Committed by Greg Kroah-Hartman
Browse files

staging: r8188eu: remove the helpers of rtw_read8()



Remove the unnecessary _rtw_read8() and usb_read8() and embed their
code into the caller (i.e., rtw_read8()).

_rtw_read8() is a mere redefinition of rtw_read8() and it is unneeded.
usb_read8() was the only functions assigned to (*_usb_read8) pointer,
so we can simply remove it and make a direct call.

This patch is in preparation for the _io_ops structure removal.

Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Co-developed-by: default avatarFabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: default avatarFabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/20210917071837.10926-3-fmdefrancesco@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ae1e2ad8
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -34,20 +34,6 @@ jackson@realtek.com.tw
#define rtw_cpu_to_le16(val)		cpu_to_le16(val)
#define rtw_cpu_to_le32(val)		cpu_to_le32(val)

u8 _rtw_read8(struct adapter *adapter, u32 addr)
{
	u8 r_val;
	struct io_priv *pio_priv = &adapter->iopriv;
	struct	intf_hdl *pintfhdl = &pio_priv->intf;
	u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);


	_read8 = pintfhdl->io_ops._read8;
	r_val = _read8(pintfhdl, addr);

	return r_val;
}

u16 _rtw_read16(struct adapter *adapter, u32 addr)
{
	u16 r_val;
+3 −2
Original line number Diff line number Diff line
@@ -97,8 +97,10 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, void *pdata,
	return status;
}

static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
u8 rtw_read8(struct adapter *adapter, u32 addr)
{
	struct io_priv *pio_priv = &adapter->iopriv;
	struct intf_hdl *pintfhdl = &pio_priv->intf;
	u16 wvalue = (u16)(addr & 0x0000ffff);
	u8 data;

@@ -538,7 +540,6 @@ void rtl8188eu_set_intf_ops(struct _io_ops *pops)
{

	memset((u8 *)pops, 0, sizeof(struct _io_ops));
	pops->_read8 = &usb_read8;
	pops->_read16 = &usb_read16;
	pops->_read32 = &usb_read32;
	pops->_read_port = &usb_read_port;
+1 −2
Original line number Diff line number Diff line
@@ -245,7 +245,7 @@ void unregister_intf_hdl(struct intf_hdl *pintfhdl);
void _rtw_attrib_read(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
void _rtw_attrib_write(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);

u8 _rtw_read8(struct adapter *adapter, u32 addr);
u8 rtw_read8(struct adapter *adapter, u32 addr);
u16 _rtw_read16(struct adapter *adapter, u32 addr);
u32 _rtw_read32(struct adapter *adapter, u32 addr);
void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
@@ -267,7 +267,6 @@ u32 _rtw_write_port_and_wait(struct adapter *adapter, u32 addr, u32 cnt,
			     u8 *pmem, int timeout_ms);
void _rtw_write_port_cancel(struct adapter *adapter);

#define rtw_read8(adapter, addr) _rtw_read8((adapter), (addr))
#define rtw_read16(adapter, addr) _rtw_read16((adapter), (addr))
#define rtw_read32(adapter, addr) _rtw_read32((adapter), (addr))
#define rtw_read_port(adapter, addr, cnt, mem)				\