[PATCH 15/17] staging: rtl8723bs: Remove constant result macro is_primary_adapter
From: Philipp Hortmann
Date: Sun Sep 15 2024 - 02:43:58 EST
Remove macro is_primary_adapter that returns always true to shorten code.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@xxxxxxxxx>
---
drivers/staging/rtl8723bs/core/rtw_cmd.c | 3 +--
drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 ++----
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 3 ---
drivers/staging/rtl8723bs/hal/hal_com.c | 21 ++++++++-----------
drivers/staging/rtl8723bs/hal/hal_intf.c | 20 +++++++-----------
drivers/staging/rtl8723bs/include/drv_types.h | 1 -
drivers/staging/rtl8723bs/os_dep/os_intfs.c | 3 +--
7 files changed, 21 insertions(+), 36 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 84ce7307d8f3..a04c66a0e25e 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1258,8 +1258,7 @@ static void dynamic_chk_wk_hdl(struct adapter *padapter)
/* always call rtw_ps_processor() at last one. */
- if (is_primary_adapter(padapter))
- rtw_ps_processor(padapter);
+ rtw_ps_processor(padapter);
}
void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type);
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index cbdb134278d3..5ded183aa08c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -911,8 +911,7 @@ inline void rtw_indicate_scan_done(struct adapter *padapter, bool aborted)
{
rtw_os_indicate_scan_done(padapter, aborted);
- if (is_primary_adapter(padapter) &&
- (!adapter_to_pwrctl(padapter)->bInSuspend) &&
+ if ((!adapter_to_pwrctl(padapter)->bInSuspend) &&
(!check_fwstate(&padapter->mlmepriv,
WIFI_ASOC_STATE|WIFI_UNDER_LINKING))) {
rtw_set_ips_deny(padapter, 0);
@@ -1589,8 +1588,7 @@ void rtw_dynamic_check_timer_handler(struct adapter *adapter)
}
} else {
- if (is_primary_adapter(adapter))
- rtw_dynamic_chk_wk_cmd(adapter);
+ rtw_dynamic_chk_wk_cmd(adapter);
}
/* auto site survey */
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index dbfcbac3d855..6ddd73b9cb29 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -73,9 +73,6 @@ int ips_leave(struct adapter *padapter)
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
int ret;
- if (!is_primary_adapter(padapter))
- return _SUCCESS;
-
mutex_lock(&pwrpriv->lock);
ret = _ips_leave(padapter);
mutex_unlock(&pwrpriv->lock);
diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
index 492889c837d9..54d5225564e4 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -13,23 +13,20 @@
u8 rtw_hal_data_init(struct adapter *padapter)
{
- if (is_primary_adapter(padapter)) { /* if (padapter->isprimary) */
- padapter->hal_data_sz = sizeof(struct hal_com_data);
- padapter->HalData = vzalloc(padapter->hal_data_sz);
- if (!padapter->HalData)
- return _FAIL;
- }
+ padapter->hal_data_sz = sizeof(struct hal_com_data);
+ padapter->HalData = vzalloc(padapter->hal_data_sz);
+ if (!padapter->HalData)
+ return _FAIL;
+
return _SUCCESS;
}
void rtw_hal_data_deinit(struct adapter *padapter)
{
- if (is_primary_adapter(padapter)) { /* if (padapter->isprimary) */
- if (padapter->HalData) {
- vfree(padapter->HalData);
- padapter->HalData = NULL;
- padapter->hal_data_sz = 0;
- }
+ if (padapter->HalData) {
+ vfree(padapter->HalData);
+ padapter->HalData = NULL;
+ padapter->hal_data_sz = 0;
}
}
diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 0a3900548fd2..d675a5eeaddb 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -27,9 +27,8 @@ void rtw_hal_read_chip_version(struct adapter *padapter)
void rtw_hal_def_value_init(struct adapter *padapter)
{
- if (is_primary_adapter(padapter))
- if (padapter->HalFunc.init_default_value)
- padapter->HalFunc.init_default_value(padapter);
+ if (padapter->HalFunc.init_default_value)
+ padapter->HalFunc.init_default_value(padapter);
}
void rtw_hal_free_data(struct adapter *padapter)
@@ -37,24 +36,21 @@ void rtw_hal_free_data(struct adapter *padapter)
/* free HAL Data */
rtw_hal_data_deinit(padapter);
- if (is_primary_adapter(padapter))
- if (padapter->HalFunc.free_hal_data)
- padapter->HalFunc.free_hal_data(padapter);
+ if (padapter->HalFunc.free_hal_data)
+ padapter->HalFunc.free_hal_data(padapter);
}
void rtw_hal_dm_init(struct adapter *padapter)
{
- if (is_primary_adapter(padapter))
- if (padapter->HalFunc.dm_init)
- padapter->HalFunc.dm_init(padapter);
+ if (padapter->HalFunc.dm_init)
+ padapter->HalFunc.dm_init(padapter);
}
void rtw_hal_dm_deinit(struct adapter *padapter)
{
/* cancel dm timer */
- if (is_primary_adapter(padapter))
- if (padapter->HalFunc.dm_deinit)
- padapter->HalFunc.dm_deinit(padapter);
+ if (padapter->HalFunc.dm_deinit)
+ padapter->HalFunc.dm_deinit(padapter);
}
static void rtw_hal_init_opmode(struct adapter *padapter)
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
index 0094eed6c32d..2b12a2313707 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -182,7 +182,6 @@ struct registry_priv {
#include <drv_types_sdio.h>
-#define is_primary_adapter(adapter) (1)
#define get_iface_type(adapter) (IFACE_PORT0)
#define GET_PRIMARY_ADAPTER(padapter) (((struct adapter *)padapter)->dvobj->if1)
#define GET_IFACE_NUMS(padapter) (((struct adapter *)padapter)->dvobj->iface_nums)
diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index fc9b9c5efb50..aa608dee4464 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -633,8 +633,7 @@ void rtw_reset_drv_sw(struct adapter *padapter)
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter);
/* hal_priv */
- if (is_primary_adapter(padapter))
- rtw_hal_def_value_init(padapter);
+ rtw_hal_def_value_init(padapter);
RTW_ENABLE_FUNC(padapter, DF_RX_BIT);
RTW_ENABLE_FUNC(padapter, DF_TX_BIT);
--
2.43.0