[PATCH v2 0/5] staging: rtl8723bs: remove unused functions

STALE1803d

Revision v2 of 2 in this series.

4 messages, 2 authors, 2021-08-26 · open the first message on its own page

[PATCH v2 0/5] staging: rtl8723bs: remove unused functions

From: Bryan Brattlof <hidden>
Date: 2021-08-22 20:43:41

Changes in v2:
 - Remove build warnings I introduced in the previous version.

***

There is a lot of un-used code and un-needed abstractions leftover
in this driver from when (I assume) it could be compiled on more than
one kernel.

This series removes dead code and is one small step toward
refactoring how this driver interacts with the SDIO subsystem.

Bryan Brattlof (5):
  staging: rtl8723bs: remove sdio_write_mem()
  staging: rtl8723bs: remove sdio_writeN()
  staging: rtl8723bs: remove sdio_read_mem() and sdio_readN()
  staging: rtl8723bs: remove unused definitions from rtw_io.h
  staging: rtl8723bs: remove _read_port from _io_ops structure

 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 116 ---------------------
 drivers/staging/rtl8723bs/include/rtw_io.h |  96 -----------------
 2 files changed, 212 deletions(-)

--
2.30.2

[PATCH v2 1/5] staging: rtl8723bs: remove sdio_write_mem()

From: Bryan Brattlof <hidden>
Date: 2021-08-22 20:43:29

The sdio_write_mem() function is unused in the driver. We can remove it.

Signed-off-by: Bryan Brattlof <redacted>
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 11 -----------
 drivers/staging/rtl8723bs/include/rtw_io.h |  1 -
 2 files changed, 12 deletions(-)
diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index a545832a468e..b784a390c8e1 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -356,16 +356,6 @@ static void sdio_read_mem(
 	sdio_readN(intfhdl, addr, cnt, rmem);
 }

-static void sdio_write_mem(
-	struct intf_hdl *intfhdl,
-	u32 addr,
-	u32 cnt,
-	u8 *wmem
-)
-{
-	sdio_writeN(intfhdl, addr, cnt, wmem);
-}
-
 /*
  * Description:
  *Read from RX FIFO
@@ -474,7 +464,6 @@ void sdio_set_intf_ops(struct adapter *adapter, struct _io_ops *ops)
 	ops->_write16 = &sdio_write16;
 	ops->_write32 = &sdio_write32;
 	ops->_writeN = &sdio_writeN;
-	ops->_write_mem = &sdio_write_mem;
 	ops->_write_port = &sdio_write_port;
 }
diff --git a/drivers/staging/rtl8723bs/include/rtw_io.h b/drivers/staging/rtl8723bs/include/rtw_io.h
index e98083a07a66..87f36b7e880f 100644
--- a/drivers/staging/rtl8723bs/include/rtw_io.h
+++ b/drivers/staging/rtl8723bs/include/rtw_io.h
@@ -91,7 +91,6 @@ struct _io_ops {
 		int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val);

 		void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
-		void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);

 		void (*_sync_irp_protocol_rw)(struct io_queue *pio_q);

--
2.30.2

[PATCH v2 2/5] staging: rtl8723bs: remove sdio_writeN()

From: Bryan Brattlof <hidden>
Date: 2021-08-22 20:43:35

The sdio_writeN() function is unused. We can remove it.

Signed-off-by: Bryan Brattlof <redacted>
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c   | 48 ----------------------
 drivers/staging/rtl8723bs/include/rtw_io.h |  1 -
 2 files changed, 49 deletions(-)
diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index b784a390c8e1..6bd662928ab6 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -299,53 +299,6 @@ static s32 sdio_write32(struct intf_hdl *intfhdl, u32 addr, u32 val)
 	return err;
 }

-static s32 sdio_writeN(struct intf_hdl *intfhdl, u32 addr, u32 cnt, u8 *buf)
-{
-	struct adapter *adapter;
-	u8 mac_pwr_ctrl_on;
-	u8 device_id;
-	u16 offset;
-	u32 ftaddr;
-	u8 shift;
-	s32 err;
-
-	adapter = intfhdl->padapter;
-	err = 0;
-
-	ftaddr = _cvrt2ftaddr(addr, &device_id, &offset);
-
-	rtw_hal_get_hwreg(adapter, HW_VAR_APFM_ON_MAC, &mac_pwr_ctrl_on);
-	if (
-		((device_id == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) ||
-		(!mac_pwr_ctrl_on) ||
-		(adapter_to_pwrctl(adapter)->fw_current_in_ps_mode)
-	)
-		return sd_cmd52_write(intfhdl, ftaddr, cnt, buf);
-
-	shift = ftaddr & 0x3;
-	if (shift == 0) {
-		err = sd_write(intfhdl, ftaddr, cnt, buf);
-	} else {
-		u8 *tmpbuf;
-		u32 n;
-
-		ftaddr &= ~(u16)0x3;
-		n = cnt + shift;
-		tmpbuf = rtw_malloc(n);
-		if (!tmpbuf)
-			return -1;
-		err = sd_read(intfhdl, ftaddr, 4, tmpbuf);
-		if (err) {
-			kfree(tmpbuf);
-			return err;
-		}
-		memcpy(tmpbuf + shift, buf, cnt);
-		err = sd_write(intfhdl, ftaddr, n, tmpbuf);
-		kfree(tmpbuf);
-	}
-	return err;
-}
-
 static void sdio_read_mem(
 	struct intf_hdl *intfhdl,
 	u32 addr,
@@ -463,7 +416,6 @@ void sdio_set_intf_ops(struct adapter *adapter, struct _io_ops *ops)
 	ops->_write8 = &sdio_write8;
 	ops->_write16 = &sdio_write16;
 	ops->_write32 = &sdio_write32;
-	ops->_writeN = &sdio_writeN;
 	ops->_write_port = &sdio_write_port;
 }
diff --git a/drivers/staging/rtl8723bs/include/rtw_io.h b/drivers/staging/rtl8723bs/include/rtw_io.h
index 87f36b7e880f..0753e20cfaa2 100644
--- a/drivers/staging/rtl8723bs/include/rtw_io.h
+++ b/drivers/staging/rtl8723bs/include/rtw_io.h
@@ -84,7 +84,6 @@ struct _io_ops {
 		int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
 		int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
 		int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
-		int (*_writeN)(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata);

 		int (*_write8_async)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
 		int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
--
2.30.2

Re: [PATCH v2 0/5] staging: rtl8723bs: remove unused functions

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2021-08-26 10:04:53

On Sun, Aug 22, 2021 at 08:42:58PM +0000, Bryan Brattlof wrote:
Changes in v2:
 - Remove build warnings I introduced in the previous version.

***

There is a lot of un-used code and un-needed abstractions leftover
in this driver from when (I assume) it could be compiled on more than
one kernel.

This series removes dead code and is one small step toward
refactoring how this driver interacts with the SDIO subsystem.
Better, but these are still not threaded properly (some were, patches 1
and 2, but not the rest.)

Please fix up and resend a v3.

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help