All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prithvi Tambewagh <activprithvi@gmail.com>
To: gregkh@linuxfoundation.org, abrahamadekunle50@gmail.com,
	b9788213@gmail.com, straube.linux@gmail.com,
	ethantidmore06@gmail.com, andriy.shevchenko@linux.intel.com,
	dan.carpenter@linaro.org, weibu@redadmin.org,
	knavaneeth786@gmail.com, ignacio.pena87@gmail.com,
	dharanitharan725@gmail.com, samasth.norway.ananda@oracle.com,
	lukagejak5@gmail.com, karanja99erick@gmail.com,
	s9430939@naver.com, suunj1331@gmail.com, ysinghcin@gmail.com
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linux.dev, skhan@linuxfoundation.org,
	david.hunter.linux@gmail.com, khalid@kernel.org,
	Prithvi Tambewagh <activprithvi@gmail.com>
Subject: [RFT PATCH v3 4/5] staging: rtl8723bs: use read_poll_timeout_atomic in _is_fw_read_cmd_down
Date: Sun,  5 Apr 2026 17:11:31 +0530	[thread overview]
Message-ID: <20260405114132.310774-5-activprithvi@gmail.com> (raw)
In-Reply-To: <20260405114132.310774-1-activprithvi@gmail.com>

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;
 }
 
 
-- 
2.34.1


  parent reply	other threads:[~2026-04-05 11:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-05 11:41 [RFT PATCH v3 0/5] staging: rtl8723bs: Code cleanup in drivers/staging/rtl8723bs Prithvi Tambewagh
2026-04-05 11:41 ` [RFT PATCH v3 1/5] staging: rtl8723bs: move constant to right side of test in comparison Prithvi Tambewagh
2026-04-05 12:49   ` Luka Gejak
2026-04-05 12:51   ` Luka Gejak
2026-04-06 20:45     ` Ethan Tidmore
2026-04-07  4:34   ` Luka Gejak
2026-04-07  4:37   ` Luka Gejak
2026-04-05 11:41 ` [RFT PATCH v3 2/5] staging: rtl8723bs: remove empty if statement block Prithvi Tambewagh
2026-04-05 12:53   ` Luka Gejak
2026-04-05 11:41 ` [RFT PATCH v3 3/5] staging: rtl8723bs: simplify boolean return in IsFrameTypeCtrl() Prithvi Tambewagh
2026-04-05 12:54   ` Luka Gejak
2026-04-05 11:41 ` Prithvi Tambewagh [this message]
2026-04-05 12:55   ` [RFT PATCH v3 4/5] staging: rtl8723bs: use read_poll_timeout_atomic in _is_fw_read_cmd_down Luka Gejak
2026-04-05 11:41 ` [RFT PATCH v3 5/5] staging: rtl8723bs: remove duplicate rate checks in PHY_GetTxPowerIndexBase() Prithvi Tambewagh
2026-04-05 12:57   ` Luka Gejak
2026-04-06 20:47     ` Ethan Tidmore
2026-04-05 13:01 ` [RFT PATCH v3 0/5] staging: rtl8723bs: Code cleanup in drivers/staging/rtl8723bs Luka Gejak
2026-04-08 19:31   ` Prithvi
2026-04-08 19:59 ` Prithvi
2026-04-08 20:19   ` Luka Gejak
2026-04-09 13:33     ` Prithvi

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=20260405114132.310774-5-activprithvi@gmail.com \
    --to=activprithvi@gmail.com \
    --cc=abrahamadekunle50@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=b9788213@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=david.hunter.linux@gmail.com \
    --cc=dharanitharan725@gmail.com \
    --cc=ethantidmore06@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ignacio.pena87@gmail.com \
    --cc=karanja99erick@gmail.com \
    --cc=khalid@kernel.org \
    --cc=knavaneeth786@gmail.com \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=lukagejak5@gmail.com \
    --cc=s9430939@naver.com \
    --cc=samasth.norway.ananda@oracle.com \
    --cc=skhan@linuxfoundation.org \
    --cc=straube.linux@gmail.com \
    --cc=suunj1331@gmail.com \
    --cc=weibu@redadmin.org \
    --cc=ysinghcin@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.