diff options
| author | Samasth Norway Ananda <samasth.norway.ananda@oracle.com> | 2026-01-30 03:16:41 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-02-07 15:35:58 +0300 |
| commit | c41ac3530710e9d49e0ddd5e6f338407f6d4ab00 (patch) | |
| tree | 0ed31b5ddb16ad135f6c46c5727c391a18bbe5b2 | |
| parent | 4dba9d6c691327f06276619ae97bab8aa48b2dbe (diff) | |
| download | linux-c41ac3530710e9d49e0ddd5e6f338407f6d4ab00.tar.xz | |
staging: rtl8723bs: remove thread wraper functions and add IS_ERR() check
The rtl8723b_start_thread() and rtl8723b_stop_thread() functions are
wrappers that are only called from one place each. Remove these wrapper
functions and inline the thread handling directly in
rtw_start_drv_threads() and rtw_stop_drv_threads().
This also fixes a bug where kthread_run() was not checked for errors
using IS_ERR(). kthread_run() returns ERR_PTR(-ENOMEM) on failure, not
NULL. Without this check, the SdioXmitThread pointer could contain an
error value, causing issues when rtw_stop_drv_threads() later attempts
to use it.
The inlined code now follows the same pattern as xmitThread and
cmdThread in rtw_start_drv_threads(), with proper IS_ERR() checking.
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
Link: https://patch.msgid.link/20260130001641.17941-4-samasth.norway.ananda@oracle.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/staging/rtl8723bs/hal/hal_intf.c | 11 | ||||
| -rw-r--r-- | drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 19 | ||||
| -rw-r--r-- | drivers/staging/rtl8723bs/include/hal_intf.h | 3 | ||||
| -rw-r--r-- | drivers/staging/rtl8723bs/include/rtl8723b_hal.h | 3 | ||||
| -rw-r--r-- | drivers/staging/rtl8723bs/os_dep/os_intfs.c | 16 |
5 files changed, 14 insertions, 38 deletions
diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c index 4ca950ff20ad..27c0c0198714 100644 --- a/drivers/staging/rtl8723bs/hal/hal_intf.c +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c @@ -218,17 +218,6 @@ void rtw_hal_add_ra_tid(struct adapter *padapter, u32 bitmap, u8 *arg, u8 rssi_l rtl8723b_Add_RateATid(padapter, bitmap, arg, rssi_level); } -/*Start specifical interface thread */ -void rtw_hal_start_thread(struct adapter *padapter) -{ - rtl8723b_start_thread(padapter); -} -/*Start specifical interface thread */ -void rtw_hal_stop_thread(struct adapter *padapter) -{ - rtl8723b_stop_thread(padapter); -} - u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask) { return PHY_QueryBBReg_8723B(padapter, RegAddr, BitMask); diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 528bc05169de..3a8062d31175 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -2916,22 +2916,3 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum hal_def_variable variable, v return bResult; } - -void rtl8723b_start_thread(struct adapter *padapter) -{ - struct xmit_priv *xmitpriv = &padapter->xmitpriv; - - xmitpriv->SdioXmitThread = kthread_run(rtl8723bs_xmit_thread, padapter, "RTWHALXT"); -} - -void rtl8723b_stop_thread(struct adapter *padapter) -{ - struct xmit_priv *xmitpriv = &padapter->xmitpriv; - - /* stop xmit_buf_thread */ - if (xmitpriv->SdioXmitThread) { - complete(&xmitpriv->SdioXmitStart); - wait_for_completion(&xmitpriv->SdioXmitTerminate); - xmitpriv->SdioXmitThread = NULL; - } -} diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h index 82b60899129d..b193854bfe6e 100644 --- a/drivers/staging/rtl8723bs/include/hal_intf.h +++ b/drivers/staging/rtl8723bs/include/hal_intf.h @@ -221,9 +221,6 @@ void rtw_hal_free_recv_priv(struct adapter *padapter); void rtw_hal_update_ra_mask(struct sta_info *psta, u8 rssi_level); void rtw_hal_add_ra_tid(struct adapter *padapter, u32 bitmap, u8 *arg, u8 rssi_level); -void rtw_hal_start_thread(struct adapter *padapter); -void rtw_hal_stop_thread(struct adapter *padapter); - void beacon_timing_control(struct adapter *padapter); u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask); diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h index 06e0a549fa9d..7ec84304a19e 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h @@ -231,9 +231,6 @@ void rtl8723b_InitBeaconParameters(struct adapter *padapter); void _InitBurstPktLen_8723BS(struct adapter *adapter); void _8051Reset8723(struct adapter *padapter); -void rtl8723b_start_thread(struct adapter *padapter); -void rtl8723b_stop_thread(struct adapter *padapter); - int FirmwareDownloadBT(struct adapter *adapter, struct rt_firmware *firmware); void CCX_FwC2HTxRpt_8723b(struct adapter *padapter, u8 *pdata, u8 len); diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index f7f23d1b1709..574d06fec898 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -6,6 +6,7 @@ ******************************************************************************/ #include <drv_types.h> #include <hal_data.h> +#include <rtl8723b_xmit.h> MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Realtek Wireless Lan Driver"); @@ -477,7 +478,13 @@ u32 rtw_start_drv_threads(struct adapter *padapter) else wait_for_completion(&padapter->cmdpriv.terminate_cmdthread_comp); /* wait for cmd_thread to run */ - rtw_hal_start_thread(padapter); + padapter->xmitpriv.SdioXmitThread = kthread_run(rtl8723bs_xmit_thread, + padapter, "RTWHALXT"); + if (IS_ERR(padapter->xmitpriv.SdioXmitThread)) { + padapter->xmitpriv.SdioXmitThread = NULL; + _status = _FAIL; + } + return _status; } @@ -489,7 +496,12 @@ void rtw_stop_drv_threads(struct adapter *padapter) complete(&padapter->xmitpriv.xmit_comp); wait_for_completion(&padapter->xmitpriv.terminate_xmitthread_comp); - rtw_hal_stop_thread(padapter); + /* stop SdioXmitThread */ + if (padapter->xmitpriv.SdioXmitThread) { + complete(&padapter->xmitpriv.SdioXmitStart); + wait_for_completion(&padapter->xmitpriv.SdioXmitTerminate); + padapter->xmitpriv.SdioXmitThread = NULL; + } } static void rtw_init_default_value(struct adapter *padapter) |
