public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: refactor halbtc8723b1ant_CoexTableWithType() to remove duplication
@ 2026-02-08 13:15 Bera Yüzlü
  2026-02-08 18:35 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Bera Yüzlü @ 2026-02-08 13:15 UTC (permalink / raw)
  To: gregkh, linux-staging; +Cc: linux-kernel

Replace the verbose switch-case block with a constant 2D array lookup.
This makes the function much more concise and easier to read without
changing the underlying behavior.

Signed-off-by: Bera Yüzlü <b9788213@gmail.com>
---
 .../staging/rtl8723bs/hal/HalBtc8723b1Ant.c   | 55 +++++--------------
 1 file changed, 13 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
index b3d7f50fac4c..d3c7a4b32ff5 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
@@ -684,52 +684,23 @@ static void halbtc8723b1ant_CoexTableWithType(
 	struct btc_coexist *pBtCoexist, bool bForceExec, u8 type
 )
 {
+	static const u32 table[8][2] = {
+		{0x55555555, 0x55555555},
+		{0x55555555, 0x5a5a5a5a},
+		{0x5a5a5a5a, 0x5a5a5a5a},
+		{0xaaaa5555, 0xaaaa5a5a},
+		{0x55555555, 0xaaaa5a5a},
+		{0x5a5a5a5a, 0xaaaa5a5a},
+		{0x55555555, 0xaaaaaaaa},
+		{0xaaaaaaaa, 0xaaaaaaaa}
+	};
+
 	pCoexSta->nCoexTableType = type;
 
-	switch (type) {
-	case 0:
-		halbtc8723b1ant_CoexTable(
-			pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffffff, 0x3
-		);
-		break;
-	case 1:
-		halbtc8723b1ant_CoexTable(
-			pBtCoexist, bForceExec, 0x55555555, 0x5a5a5a5a, 0xffffff, 0x3
-		);
-		break;
-	case 2:
-		halbtc8723b1ant_CoexTable(
-			pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffffff, 0x3
-		);
-		break;
-	case 3:
-		halbtc8723b1ant_CoexTable(
-			pBtCoexist, bForceExec, 0xaaaa5555, 0xaaaa5a5a, 0xffffff, 0x3
-		);
-		break;
-	case 4:
+	if (-1 < type && type < 8)
 		halbtc8723b1ant_CoexTable(
-			pBtCoexist, bForceExec, 0x55555555, 0xaaaa5a5a, 0xffffff, 0x3
+			pBtCoexist, bForceExec, table[type][0], table[type][1], 0xffffff, 0x3
 		);
-		break;
-	case 5:
-		halbtc8723b1ant_CoexTable(
-			pBtCoexist, bForceExec, 0x5a5a5a5a, 0xaaaa5a5a, 0xffffff, 0x3
-		);
-		break;
-	case 6:
-		halbtc8723b1ant_CoexTable(
-			pBtCoexist, bForceExec, 0x55555555, 0xaaaaaaaa, 0xffffff, 0x3
-		);
-		break;
-	case 7:
-		halbtc8723b1ant_CoexTable(
-			pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffffff, 0x3
-		);
-		break;
-	default:
-		break;
-	}
 }
 
 static void halbtc8723b1ant_SetFwIgnoreWlanAct(
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-08 18:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-08 13:15 [PATCH] staging: rtl8723bs: refactor halbtc8723b1ant_CoexTableWithType() to remove duplication Bera Yüzlü
2026-02-08 18:35 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox