From: Dan Carpenter <error27@gmail.com>
To: "Bera Yüzlü" <b9788213@gmail.com>
Cc: gregkh@linuxfoundation.org, filippo.muschera@gmail.com,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8723bs: refactor switch-case
Date: Mon, 30 Mar 2026 12:35:25 +0300 [thread overview]
Message-ID: <aconhLks-F3rvFbV@stanley.mountain> (raw)
In-Reply-To: <20260328163357.163332-2-b9788213@gmail.com>
On Sat, Mar 28, 2026 at 07:33:58PM +0300, Bera Yüzlü wrote:
> Refactored huge switch-case to lookup table. Used if-else for dynamic
> values.
>
> Signed-off-by: Bera Yüzlü <b9788213@gmail.com>
> ---
> .../staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 269 +++++-------------
> 1 file changed, 69 insertions(+), 200 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
> index b3e34f97cfc6..c02df8e3c398 100644
> --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
> +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
> @@ -989,6 +989,51 @@ static void halbtc8723b1ant_SetFwPstdma(
> pBtCoexist->fBtcFillH2c(pBtCoexist, 0x60, 5, H2C_Parameter);
> }
>
> +static const u32 FwPstdma_table[41][5] = {
> + {0, 0, 0, 0, 0}, // 0
> + {0, 0, 0, 0, 0},
> + {0, 0, 0, 0, 0},
> + {0x51, 0x1d, 0x1d, 0x0, 0x10},
> + {0x93, 0x15, 0x3, 0x14, 0x0},
> + {0x61, 0x15, 0x3, 0x11, 0x10}, // 5
> + {0x61, 0x20, 0x3, 0x11, 0x11},
> + {0x13, 0xc, 0x5, 0x0, 0x0},
> + {0x93, 0x25, 0x3, 0x10, 0x0},
> + {0, 0, 0, 0, 0},
> + {0x13, 0xa, 0xa, 0x0, 0x40}, // 10
> + {0, 0, 0, 0, 0},
> + {0x51, 0x0a, 0x0a, 0x0, 0x50},
> + {0x51, 0x12, 0x12, 0x0, 0x10},
> + {0, 0, 0, 0, 0},
> + {0x13, 0xa, 0x3, 0x8, 0x0}, // 15
> + {0x93, 0x15, 0x3, 0x10, 0x0},
> + {0, 0, 0, 0, 0},
This patch is sort of a pain in the butt to review... I'm not
sure that it improves readability. I had to read until I got
to 17 before I found a mistake.
> + {0x93, 0x25, 0x3, 0x10, 0x0},
> + {0, 0, 0, 0, 0},
> + {0x61, 0x3f, 0x03, 0x11, 0x10}, // 20
[ snip ]
> + else if (type == 0 || type == 17 || type == 19 || type == 37 || type == 38 || type == 39)
> + halbtc8723b1ant_SetFwPstdma(pBtCoexist, 0x51,
> + 0x1a, 0x1a,
> + 0x0, psTdmaByte4Val);
In the original code there was no entry for 17 but in the new patch it's
treated like a 0. What's the deal with that?
$ grep 17 drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
regards,
dan carpenter
> + else if (type < 41)
> + halbtc8723b1ant_SetFwPstdma(pBtCoexist, FwPstdma_table[type][0],
> + FwPstdma_table[type][1], FwPstdma_table[type][2],
> + FwPstdma_table[type][3], FwPstdma_table[type][4]);
prev parent reply other threads:[~2026-03-30 9:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-28 16:33 [PATCH] staging: rtl8723bs: refactor switch-case Bera Yüzlü
2026-03-30 9:35 ` Dan Carpenter [this message]
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=aconhLks-F3rvFbV@stanley.mountain \
--to=error27@gmail.com \
--cc=b9788213@gmail.com \
--cc=filippo.muschera@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.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