* [PATCH v3] staging: rtl8723bs: use errno in rtw_register_tx_alive()
@ 2026-10-01 12:42 Hungyu Lin
0 siblings, 0 replies; only message in thread
From: Hungyu Lin @ 2026-10-01 12:42 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Dan Carpenter, linux-staging, linux-kernel, Hungyu Lin
Replace the driver-specific _SUCCESS and _FAIL return values with
0 when TX can proceed and -EAGAIN when the firmware is not ready yet.
Handle -EAGAIN explicitly in rtl8723bs_xmit_buf_handler(). The buffers
remain queued and XMIT_ALIVE remains set so cpwm_int_hdl() can wake
the TX thread for another attempt. Return _SUCCESS in this case to
keep rtw_xmit_thread() running and waiting on xmit_comp; propagating
-EAGAIN would terminate the thread.
No functional change.
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
Changes in v3:
- Handle -EAGAIN explicitly in rtl8723bs_xmit_buf_handler(), as
suggested by Greg.
- Explain why the deferred TX case returns _SUCCESS to keep the
transmit thread running for a later retry.
Changes in v2:
- Use the standard 0/-errno return convention instead of bool, as
suggested by Greg.
- Return -EAGAIN when the transmit path cannot proceed yet.
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 13 ++++++-------
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 9 ++++++++-
drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index 448611ad8237..00d64b2ff89e 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -771,13 +771,12 @@ void rtw_unregister_task_alive(struct adapter *padapter, u32 task)
* _SUCCESS rtw_xmit_thread can write fifo/txcmd afterwards.
* _FAIL rtw_xmit_thread can not do anything.
*/
-s32 rtw_register_tx_alive(struct adapter *padapter)
+int rtw_register_tx_alive(struct adapter *padapter)
{
- s32 res;
+ int ret = 0;
struct pwrctrl_priv *pwrctrl;
u8 pslv;
- res = _SUCCESS;
pwrctrl = adapter_to_pwrctl(padapter);
pslv = PS_STATE_S2;
@@ -788,7 +787,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
if (pwrctrl->fw_current_in_ps_mode) {
if (pwrctrl->cpwm < pslv) {
if (pwrctrl->cpwm < PS_STATE_S2)
- res = _FAIL;
+ ret = -EAGAIN;
if (pwrctrl->rpwm < pslv)
rtw_set_rpwm(padapter, pslv);
}
@@ -796,11 +795,11 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
mutex_unlock(&pwrctrl->lock);
- if (res == _FAIL)
+ if (ret)
if (pwrctrl->cpwm >= PS_STATE_S2)
- res = _SUCCESS;
+ ret = 0;
- return res;
+ return ret;
}
/*
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
index 0441e84ea87d..47f71e3ec633 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
@@ -140,9 +140,16 @@ s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter)
return _SUCCESS;
ret = rtw_register_tx_alive(padapter);
- if (ret != _SUCCESS) {
+ if (ret == -EAGAIN) {
+ /*
+ * Leave the buffers queued and XMIT_ALIVE registered so
+ * cpwm_int_hdl() can wake this thread for another attempt.
+ * Return success to keep the TX thread running.
+ */
return _SUCCESS;
}
+ if (ret)
+ return _FAIL;
do {
queue_empty = rtl8723_dequeue_writeport(padapter);
diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 49f19b6ee329..a14da6c18201 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -217,7 +217,7 @@ void rtw_free_pwrctrl_priv(struct adapter *adapter);
s32 rtw_register_task_alive(struct adapter *adapter, u32 task);
void rtw_unregister_task_alive(struct adapter *adapter, u32 task);
-s32 rtw_register_tx_alive(struct adapter *padapter);
+int rtw_register_tx_alive(struct adapter *padapter);
void rtw_unregister_tx_alive(struct adapter *padapter);
s32 rtw_register_cmd_alive(struct adapter *padapter);
void rtw_unregister_cmd_alive(struct adapter *padapter);
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-01 12:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 12:42 [PATCH v3] staging: rtl8723bs: use errno in rtw_register_tx_alive() Hungyu Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®