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

From: Luka Gejak

Date: Thu Apr 09 2026 - 10:11:49 EST


On Thu Apr 9, 2026 at 3:50 PM CEST, Prithvi Tambewagh 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@xxxxxxxxx>
> ---
> 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 12416e499ac3..4bdc8e314015 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@xxxxxxxxx>

Best regards,
Luka Gejak