Re: [RFT PATCH v3 4/5] staging: rtl8723bs: use read_poll_timeout_atomic in _is_fw_read_cmd_down

Luka Gejak
2026-04-05T12:55:28Z

On April 5, 2026 1:41:31 PM GMT+02:00, Prithvi Tambewagh <activprithvi@gmail.com> wrote:
>Replace the existing rtw_read8() and do-while loop mechanism with
>read_poll_timeout_atomic() from <linux/iopoll.h>, in _is_fw_read_cmd_down()
>which is a standard Linux macro, ensuring polling REG_HMETFR efficiently.
>
>Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
>---
> drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
>diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
>index af6cdda8238d..17e135cd3e0e 100644
>--- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
>+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
>@@ -8,6 +8,7 @@
> #include <drv_types.h>
> #include <rtl8723b_hal.h>
> #include <linux/etherdevice.h>
>+#include <linux/iopoll.h>
> #include "hal_com_h2c.h"
>
> #define MAX_H2C_BOX_NUMS 4
>@@ -18,20 +19,15 @@
>
> static u8 _is_fw_read_cmd_down(struct adapter *padapter, u8 msgbox_num)
> {
>- u8 read_down = false;
>- int retry_cnts = 100;
>-
> u8 valid;
>+ int ret;
>
>- do {
>- valid = rtw_read8(padapter, REG_HMETFR) & BIT(msgbox_num);
>- if (0 == valid) {
>- read_down = true;
>- }
>- } while ((!read_down) && (retry_cnts--));
>-
>- return read_down;
>+ ret = read_poll_timeout_atomic(rtw_read8,
>+ valid, !(valid & BIT(msgbox_num)),
>+ 0, 500, false,
>+ padapter, REG_HMETFR);
>
>+ return !ret;
> }
>
>

LGTM,
Reviewed-by: Luka Gejak <luka.gejak@linux.dev>