Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <ku920601@realtek.com>, <kevin_yang@realtek.com>
Subject: [PATCH rtw-next 5/7] wifi: rtw89: add instance of IO ops for (un)pack and [um]delay
Date: Wed, 23 Sep 2026 15:13:52 +0800	[thread overview]
Message-ID: <20260923071354.50864-6-pkshih@realtek.com> (raw)
In-Reply-To: <20260923071354.50864-1-pkshih@realtek.com>

From: Zong-Zhe Yang <kevin_yang@realtek.com>

To make IO wrappers of pack/unpack/udely/mdely can intuitively call
the loaded IO ops as others do, add corresponding instances for them.
And, expect all rtw89_io_ops initializers should assign all members.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/core.h | 38 ++++++++++++++---------
 drivers/net/wireless/realtek/rtw89/fw.c   | 10 +++---
 2 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index fc51419a1782..128667fb95b0 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -8097,36 +8097,44 @@ struct rtw89_tx_skb_data *RTW89_TX_SKB_CB(struct sk_buff *skb)
 	return (struct rtw89_tx_skb_data *)info->driver_data;
 }
 
-static inline int rtw89_io_pack(struct rtw89_dev *rtwdev)
+static inline int rtw89_raw_io_pack(struct rtw89_dev *rtwdev)
 {
-	if (rtwdev->io->pack)
-		return rtwdev->io->pack(rtwdev);
+	return 0;
+}
 
+static inline int rtw89_raw_io_unpack(struct rtw89_dev *rtwdev)
+{
 	return 0;
 }
 
-static inline int rtw89_io_unpack(struct rtw89_dev *rtwdev)
+static inline void rtw89_raw_io_udelay(struct rtw89_dev *rtwdev, u32 us)
 {
-	if (rtwdev->io->unpack)
-		return rtwdev->io->unpack(rtwdev);
+	udelay(us);
+}
 
-	return 0;
+static inline void rtw89_raw_io_mdelay(struct rtw89_dev *rtwdev, u32 ms)
+{
+	mdelay(ms);
+}
+
+static inline int rtw89_io_pack(struct rtw89_dev *rtwdev)
+{
+	return rtwdev->io->pack(rtwdev);
+}
+
+static inline int rtw89_io_unpack(struct rtw89_dev *rtwdev)
+{
+	return rtwdev->io->unpack(rtwdev);
 }
 
 static inline void rtw89_io_udelay(struct rtw89_dev *rtwdev, u32 us)
 {
-	if (rtwdev->io->do_udelay)
-		rtwdev->io->do_udelay(rtwdev, us);
-	else
-		udelay(us);
+	rtwdev->io->do_udelay(rtwdev, us);
 }
 
 static inline void rtw89_io_mdelay(struct rtw89_dev *rtwdev, u32 ms)
 {
-	if (rtwdev->io->do_mdelay)
-		rtwdev->io->do_mdelay(rtwdev, ms);
-	else
-		mdelay(ms);
+	rtwdev->io->do_mdelay(rtwdev, ms);
 }
 
 static inline u8 rtw89_read8(struct rtw89_dev *rtwdev, u32 addr)
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index 535cc2ad8611..7cf51e78ce98 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -12916,8 +12916,10 @@ static int rtw89_fw_cmd_ofld_enqueue(struct rtw89_dev *rtwdev,
 }
 
 static const struct rtw89_io_ops rtw89_raw_io = {
-	.pack = NULL,
-	.unpack = NULL,
+	.pack = rtw89_raw_io_pack,
+	.unpack = rtw89_raw_io_unpack,
+	.do_udelay = rtw89_raw_io_udelay,
+	.do_mdelay = rtw89_raw_io_mdelay,
 	.write8 = rtw89_raw_write8,
 	.write16 = rtw89_raw_write16,
 	.write32 = rtw89_raw_write32,
@@ -13096,7 +13098,7 @@ static void rtw89_fw_cmd_ofld_udelay(struct rtw89_dev *rtwdev, u32 us)
 
 	ret = rtw89_fw_cmd_ofld_enqueue(rtwdev, &cmd);
 	if (ret)
-		udelay(us);
+		rtw89_raw_io.do_udelay(rtwdev, us);
 }
 
 static void rtw89_fw_cmd_ofld_mdelay(struct rtw89_dev *rtwdev, u32 ms)
@@ -13110,7 +13112,7 @@ static void rtw89_fw_cmd_ofld_mdelay(struct rtw89_dev *rtwdev, u32 ms)
 
 	ret = rtw89_fw_cmd_ofld_enqueue(rtwdev, &cmd);
 	if (ret)
-		mdelay(ms);
+		rtw89_raw_io.do_mdelay(rtwdev, ms);
 }
 
 static const struct rtw89_io_ops rtw89_fw_cmd_ofld_io = {
-- 
2.25.1


  parent reply	other threads:[~2026-09-23  7:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  7:13 [PATCH rtw-next 0/7] wifi: rtw89: coex: update to support newer firmware especially RTL8852C Ping-Ke Shih
2026-09-23  7:13 ` [PATCH rtw-next 1/7] wifi: rtw89: coex: log FCX report version mismatch without dropping Ping-Ke Shih
2026-09-30  2:14   ` Ping-Ke Shih
2026-09-23  7:13 ` [PATCH rtw-next 2/7] wifi: rtw89: coex: add fbtc_rpt_ctrl v205 report struct and handling Ping-Ke Shih
2026-09-23  7:13 ` [PATCH rtw-next 3/7] wifi: rtw89: coex: Add firmware 0.27.130.1 support for RTL8852C Ping-Ke Shih
2026-09-23  7:13 ` [PATCH rtw-next 4/7] wifi: rtw89: coex: fix BT scoreboard update for non-C2H paths Ping-Ke Shih
2026-09-23  7:13 ` Ping-Ke Shih [this message]
2026-09-23  7:13 ` [PATCH rtw-next 6/7] wifi: rtw89: coex: offload 8852C IO writes via firmware CMD pack region Ping-Ke Shih
2026-09-23  7:13 ` [PATCH rtw-next 7/7] wifi: rtw89: coex: batch PTA init with masked IO offload Ping-Ke Shih

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=20260923071354.50864-6-pkshih@realtek.com \
    --to=pkshih@realtek.com \
    --cc=kevin_yang@realtek.com \
    --cc=ku920601@realtek.com \
    --cc=linux-wireless@vger.kernel.org \
    /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