* [PATCH v4] staging: rtl8723bs: return bool from check_pending_xmitbuf
@ 2026-10-01 14:06 Matheus Alves de Almeida
2026-10-01 14:41 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Matheus Alves de Almeida @ 2026-10-01 14:06 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Dan Carpenter, linux-staging, linux-kernel, Matheus Alves de Almeida
check_pending_xmitbuf() returns only true or false. Use bool as its
return type to accurately describe the function's behavior and
propagate the return type through one of the call chains.
Signed-off-by: Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br>
---
v2: Add missing "staging: " prefix to commit message.
v3: Change one of the call chains to also return bool.
v4:
- rtw_transmit_thread(): rename err -> xmit_status and remove
unnescessary initialization.
- check_pending_xmitbuf(): rename ret -> xmitbuf_pending and remove
unnescessary if statement.
- rtl8723bs_xmit_buf_handler(): remove queue_pending and directly
check the value returned by check_pending_xmitbuf() instead.
drivers/staging/rtl8723bs/core/rtw_xmit.c | 16 +++++++---------
drivers/staging/rtl8723bs/hal/hal_intf.c | 2 +-
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 8 +++-----
drivers/staging/rtl8723bs/include/hal_intf.h | 2 +-
.../staging/rtl8723bs/include/rtl8723b_xmit.h | 2 +-
drivers/staging/rtl8723bs/include/rtw_xmit.h | 2 +-
6 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 57b3690bc48af..513a4934ab599 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -2463,37 +2463,35 @@ struct xmit_buf *dequeue_pending_xmitbuf_under_survey(struct xmit_priv *pxmitpri
return pxmitbuf;
}
-signed int check_pending_xmitbuf(struct xmit_priv *pxmitpriv)
+bool check_pending_xmitbuf(struct xmit_priv *pxmitpriv)
{
struct __queue *pqueue;
- signed int ret = false;
+ bool xmitbuf_pending;
pqueue = &pxmitpriv->pending_xmitbuf_queue;
spin_lock_bh(&pqueue->lock);
- if (!list_empty(&pqueue->queue))
- ret = true;
+ xmitbuf_pending = !list_empty(&pqueue->queue);
spin_unlock_bh(&pqueue->lock);
- return ret;
+ return xmitbuf_pending;
}
int rtw_xmit_thread(void *context)
{
- s32 err;
+ bool xmit_status;
struct adapter *padapter;
- err = _SUCCESS;
padapter = context;
allow_signal(SIGTERM);
do {
- err = rtw_hal_xmit_thread_handler(padapter);
+ xmit_status = rtw_hal_xmit_thread_handler(padapter);
flush_signals_thread();
- } while (err == _SUCCESS);
+ } while (xmit_status == _SUCCESS);
complete(&padapter->xmitpriv.terminate_xmitthread_comp);
diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 1443875d13694..9653ab3ad893d 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -229,7 +229,7 @@ void beacon_timing_control(struct adapter *padapter)
rtl8723b_SetBeaconRelatedRegisters(padapter);
}
-s32 rtw_hal_xmit_thread_handler(struct adapter *padapter)
+bool rtw_hal_xmit_thread_handler(struct adapter *padapter)
{
return rtl8723bs_xmit_buf_handler(padapter);
}
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
index dec9d4d53de7a..2918a8e50f3d6 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
@@ -115,10 +115,10 @@ static s32 rtl8723_dequeue_writeport(struct adapter *padapter)
*_SUCCESS ok
*_FAIL something error
*/
-s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter)
+bool rtl8723bs_xmit_buf_handler(struct adapter *padapter)
{
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- u8 queue_empty, queue_pending;
+ u8 queue_empty;
s32 ret;
if (wait_for_completion_interruptible(&pxmitpriv->xmit_comp)) {
@@ -131,9 +131,7 @@ s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter)
if (ret)
return _FAIL;
- queue_pending = check_pending_xmitbuf(pxmitpriv);
-
- if (!queue_pending)
+ if (!check_pending_xmitbuf(pxmitpriv))
return _SUCCESS;
ret = rtw_register_tx_alive(padapter);
diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h
index 7b63116525cab..763ff6f3cb535 100644
--- a/drivers/staging/rtl8723bs/include/hal_intf.h
+++ b/drivers/staging/rtl8723bs/include/hal_intf.h
@@ -222,7 +222,7 @@ void rtw_hal_set_chnl_bw(struct adapter *padapter, u8 channel, enum channel_widt
void rtw_hal_dm_watchdog(struct adapter *padapter);
void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter);
-s32 rtw_hal_xmit_thread_handler(struct adapter *padapter);
+bool rtw_hal_xmit_thread_handler(struct adapter *padapter);
void rtw_hal_notch_filter(struct adapter *adapter, bool enable);
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
index d02ead67777a0..acf0ac9e5a755 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h
@@ -406,7 +406,7 @@ void rtl8723bs_free_xmit_priv(struct adapter *padapter);
s32 rtl8723bs_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe);
s32 rtl8723bs_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe);
s32 rtl8723bs_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe);
-s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter);
+bool rtl8723bs_xmit_buf_handler(struct adapter *padapter);
int rtl8723bs_xmit_thread(void *context);
u8 BWMapping_8723B(struct adapter *Adapter, struct pkt_attrib *pattrib);
diff --git a/drivers/staging/rtl8723bs/include/rtw_xmit.h b/drivers/staging/rtl8723bs/include/rtw_xmit.h
index c5cb814789d86..68fe47dcceec4 100644
--- a/drivers/staging/rtl8723bs/include/rtw_xmit.h
+++ b/drivers/staging/rtl8723bs/include/rtw_xmit.h
@@ -432,7 +432,7 @@ void enqueue_pending_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmit
void enqueue_pending_xmitbuf_to_head(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
struct xmit_buf *dequeue_pending_xmitbuf(struct xmit_priv *pxmitpriv);
struct xmit_buf *dequeue_pending_xmitbuf_under_survey(struct xmit_priv *pxmitpriv);
-signed int check_pending_xmitbuf(struct xmit_priv *pxmitpriv);
+bool check_pending_xmitbuf(struct xmit_priv *pxmitpriv);
int rtw_xmit_thread(void *context);
u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe);
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v4] staging: rtl8723bs: return bool from check_pending_xmitbuf
2026-10-01 14:06 [PATCH v4] staging: rtl8723bs: return bool from check_pending_xmitbuf Matheus Alves de Almeida
@ 2026-10-01 14:41 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2026-10-01 14:41 UTC (permalink / raw)
To: Matheus Alves de Almeida; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel
On Thu, Oct 01, 2026 at 11:06:40AM -0300, Matheus Alves de Almeida wrote:
> check_pending_xmitbuf() returns only true or false. Use bool as its
> return type to accurately describe the function's behavior and
> propagate the return type through one of the call chains.
>
> Signed-off-by: Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br>
> ---
> v2: Add missing "staging: " prefix to commit message.
> v3: Change one of the call chains to also return bool.
> v4:
> - rtw_transmit_thread(): rename err -> xmit_status and remove
> unnescessary initialization.
> - check_pending_xmitbuf(): rename ret -> xmitbuf_pending and remove
> unnescessary if statement.
> - rtl8723bs_xmit_buf_handler(): remove queue_pending and directly
> check the value returned by check_pending_xmitbuf() instead.
>
> drivers/staging/rtl8723bs/core/rtw_xmit.c | 16 +++++++---------
> drivers/staging/rtl8723bs/hal/hal_intf.c | 2 +-
> drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 8 +++-----
> drivers/staging/rtl8723bs/include/hal_intf.h | 2 +-
> .../staging/rtl8723bs/include/rtl8723b_xmit.h | 2 +-
> drivers/staging/rtl8723bs/include/rtw_xmit.h | 2 +-
> 6 files changed, 14 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
> index 57b3690bc48af..513a4934ab599 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
> @@ -2463,37 +2463,35 @@ struct xmit_buf *dequeue_pending_xmitbuf_under_survey(struct xmit_priv *pxmitpri
> return pxmitbuf;
> }
>
> -signed int check_pending_xmitbuf(struct xmit_priv *pxmitpriv)
> +bool check_pending_xmitbuf(struct xmit_priv *pxmitpriv)
Ideally boolean functions would have a name that indicates what
the return means. For example, if (has_pending()) is clear.
if (check_pending()) is less clear.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-01 14:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 14:06 [PATCH v4] staging: rtl8723bs: return bool from check_pending_xmitbuf Matheus Alves de Almeida
2026-10-01 14:41 ` Dan Carpenter
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®