staging: rtl8723bs: make rtw_register_tx_alive() return bool
PATCH 1/1 staging: rtl8723bs: make rtw_register_tx_alive() return bool
rtw_register_tx_alive() only reports whether the transmit path can continue, and its only caller treats the return value as a boolean.
Change the return type to bool and replace _SUCCESS and _FAIL with true and false. Update the caller accordingly.
No functional change.
--- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 12 ++++++------ drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 4 +--- drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-)
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +6 -6
@@ -771,13 +771,13 @@ 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) +bool rtw_register_tx_alive (struct adapter *padapter) { -s32 res; +bool res;struct pwrctrl_priv *pwrctrl;u8 pslv; - res = _SUCCESS; + res = true; pwrctrl =adapter_to_pwrctl (padapter); pslv =PS_STATE_S2 ;
@@ -788,7 +788,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; + res = false;if (pwrctrl->rpwm < pslv)rtw_set_rpwm (padapter, pslv); }
@@ -796,9 +796,9 @@ s32 rtw_register_tx_alive(struct adapter *padapter)mutex_unlock (&pwrctrl->lock); -if (res == _FAIL) +if (!res)if (pwrctrl->cpwm >=PS_STATE_S2 ) - res = _SUCCESS; + res = true;return res; }
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +1 -3
@@ -139,10 +139,8 @@ s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter)if (!queue_pending)return _SUCCESS; - ret =rtw_register_tx_alive (padapter); -if (ret != _SUCCESS) { +if (!rtw_register_tx_alive (padapter))return _SUCCESS; - } do { queue_empty = rtl8723_dequeue_writeport(padapter);
drivers/staging/rtl8723bs/include/rtw_pwrctrl.h +1 -1
@@ -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); +bool 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);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerQuoted 20 lines · Hungyu Lin
rtw_register_tx_alive()only reports whether the transmit path can continue, and its only caller treats the return value as a boolean.Change the return type to bool and replace
_SUCCESSand_FAILwith true and false. Update the caller accordingly.No functional change.
Signed-off-by Hungyu Lin <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 12 ++++++------ drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 4 +--- drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-)drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +0
-0
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c void rtw_unregister_task_alive(struct adapter *padapter, u32 task) · line 774
Quoted 5 lines
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +1
-1@@ -771,13 +771,13 @@ 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) +bool rtw_register_tx_alive (struct adapter *padapter)
This is kind of the wrong way to do this as the caller of this function:
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c void rtw_unregister_task_alive(struct adapter *padapter, u32 task) · line 776
Quoted 4 lines
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +1
-2- ret =rtw_register_tx_alive (padapter); -if (ret != _SUCCESS) { +if (!rtw_register_tx_alive (padapter))return _SUCCESS;
Is now in the "opposite" format for kernel functions, right?
Why not fall back to the normal 0 and -ERROR instead?
thanks,
greg k-h