From: Nikolay Kulikov <nikolayof23@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev, Nikolay Kulikov <nikolayof23@gmail.com>
Subject: [PATCH RFC 09/11] staging: rtl8723bs: inline sdio_write_port() into rtw_write_port()
Date: Fri, 8 May 2026 22:38:38 +0300 [thread overview]
Message-ID: <20260508193909.16015-10-nikolayof23@gmail.com> (raw)
In-Reply-To: <20260508193909.16015-1-nikolayof23@gmail.com>
rtw_write_port() is just a wrapper around sdio_write_port(). Combine
them to reduce the number of abstractions and simplify the code.
Update the function description to match the actual parameters.
Signed-off-by: Nikolay Kulikov <nikolayof23@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_io.c | 41 ++++++++++++++--
drivers/staging/rtl8723bs/hal/sdio_ops.c | 54 +---------------------
drivers/staging/rtl8723bs/include/rtw_io.h | 1 -
3 files changed, 37 insertions(+), 59 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_io.c b/drivers/staging/rtl8723bs/core/rtw_io.c
index f1f3ca46bd15..2f99e5e6e2ac 100644
--- a/drivers/staging/rtl8723bs/core/rtw_io.c
+++ b/drivers/staging/rtl8723bs/core/rtw_io.c
@@ -171,15 +171,46 @@ int rtw_write32(struct adapter *adapter, u32 addr, u32 val)
return RTW_STATUS_CODE(err);
}
+/*
+ * Description:
+ * Write to TX FIFO
+ * Align write size block size,
+ * and make sure data could be written in one command.
+ *
+ * Parameters:
+ * @adapter: adapter
+ * @addr: port ID
+ * @cnt: size to write
+ * @pmem: pointer to struct xmit_buf
+ *
+ * Return:
+ * _SUCCESS(1) Success
+ * _FAIL(0) Fail
+ */
u32 rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
{
- u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
- struct io_priv *pio_priv = &adapter->iopriv;
- struct intf_hdl *pintfhdl = &pio_priv->intf;
+ struct sdio_data *sdio = &adapter->dvobj->intf_data;
+ struct xmit_buf *xmitbuf = (struct xmit_buf *)pmem;
+ struct intf_hdl *intfhdl = &adapter->iopriv.intf;
+ s32 err;
- _write_port = pintfhdl->io_ops._write_port;
+ if (!adapter->hw_init_completed || !xmitbuf)
+ return _FAIL;
+
+ cnt = round_up(cnt, 4);
+ hal_sdio_get_cmd_addr_8723b(adapter, addr, cnt >> 2, &addr);
+
+ if (cnt > sdio->block_transfer_len)
+ cnt = _RND(cnt, sdio->block_transfer_len);
+
+ err = sd_write(intfhdl, addr, cnt, xmitbuf->pdata);
- return _write_port(pintfhdl, addr, cnt, pmem);
+ rtw_sctx_done_err(&xmitbuf->sctx,
+ err ? RTW_SCTX_DONE_WRITE_PORT_ERR : RTW_SCTX_DONE_SUCCESS);
+
+ if (err)
+ return _FAIL;
+ return _SUCCESS;
}
int rtw_init_io_priv(struct adapter *padapter,
diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index a162815e24a4..3b90bab3b92f 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -168,61 +168,9 @@ static u32 sdio_read_port(
return _SUCCESS;
}
-/*
- * Description:
- *Write to TX FIFO
- *Align write size block size,
- *and make sure data could be written in one command.
- *
- * Parameters:
- *intfhdl a pointer of intf_hdl
- *addr port ID
- *cnt size to write
- *wmem data pointer to write
- *
- * Return:
- *_SUCCESS(1) Success
- *_FAIL(0) Fail
- */
-static u32 sdio_write_port(
- struct intf_hdl *intfhdl,
- u32 addr,
- u32 cnt,
- u8 *mem
-)
-{
- struct adapter *adapter;
- struct sdio_data *psdio;
- s32 err;
- struct xmit_buf *xmitbuf = (struct xmit_buf *)mem;
-
- adapter = intfhdl->padapter;
- psdio = &adapter_to_dvobj(adapter)->intf_data;
-
- if (!adapter->hw_init_completed)
- return _FAIL;
-
- cnt = round_up(cnt, 4);
- hal_sdio_get_cmd_addr_8723b(adapter, addr, cnt >> 2, &addr);
-
- if (cnt > psdio->block_transfer_len)
- cnt = _RND(cnt, psdio->block_transfer_len);
-
- err = sd_write(intfhdl, addr, cnt, xmitbuf->pdata);
-
- rtw_sctx_done_err(
- &xmitbuf->sctx,
- err ? RTW_SCTX_DONE_WRITE_PORT_ERR : RTW_SCTX_DONE_SUCCESS
- );
-
- if (err)
- return _FAIL;
- return _SUCCESS;
-}
-
void sdio_set_intf_ops(struct adapter *adapter, struct _io_ops *ops)
{
- ops->_write_port = &sdio_write_port;
+ return;
}
/*
diff --git a/drivers/staging/rtl8723bs/include/rtw_io.h b/drivers/staging/rtl8723bs/include/rtw_io.h
index 9fc2f7413543..4e3504260bbc 100644
--- a/drivers/staging/rtl8723bs/include/rtw_io.h
+++ b/drivers/staging/rtl8723bs/include/rtw_io.h
@@ -11,7 +11,6 @@
struct intf_hdl;
struct _io_ops {
- u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
};
struct intf_hdl {
--
2.54.0
next prev parent reply other threads:[~2026-05-08 19:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 19:38 [PATCH RFC 00/11] staging: rtl8723bs: remove struct _io_ops Nikolay Kulikov
2026-05-08 19:38 ` [PATCH RFC 01/11] staging: rtl8723bs: remove unused sdio_local_read() Nikolay Kulikov
2026-05-08 19:38 ` [PATCH RFC 02/11] staging: rtl8723bs: declare helper sdio functions in .h files Nikolay Kulikov
2026-05-08 19:38 ` [PATCH RFC 03/11] staging: rtl8723bs: inline sd_read8() and sdio_read8() into rtw_read8() Nikolay Kulikov
2026-05-08 19:38 ` [PATCH RFC 04/11] staging: rtl8723bs: inline sdio_read16() into rtw_read16() Nikolay Kulikov
2026-05-08 19:38 ` [PATCH RFC 05/11] staging: rtl8723bs: inline sdio_read32() into rtw_read32() Nikolay Kulikov
2026-05-08 19:38 ` [PATCH RFC 06/11] staging: rtl8723bs: inline sd_write8() and sdio_write8() in rtw_write8() Nikolay Kulikov
2026-05-08 19:38 ` [PATCH RFC 07/11] staging: rtl8723bs: inline sdio_write16() into rtw_write16() Nikolay Kulikov
2026-05-08 19:38 ` [PATCH RFC 08/11] staging: rtl8723bs: inline sdio_write32() into rtw_write32() Nikolay Kulikov
2026-05-08 19:38 ` Nikolay Kulikov [this message]
2026-05-08 19:38 ` [PATCH RFC 10/11] staging: rtl8723bs: remove the empty function set_intf_ops() Nikolay Kulikov
2026-05-08 19:38 ` [PATCH RFC 11/11] staging: rtl8723bs: remove empty struct _io_ops Nikolay Kulikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260508193909.16015-10-nikolayof23@gmail.com \
--to=nikolayof23@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox