[PATCH 13/61] staging: rtl8723bs: remove redundant rtw_get_oper_ch() wrapper

From: Arsenii Pashchenko

Date: Wed Jul 15 2026 - 08:54:15 EST


Remove the rtw_get_oper_ch() helper function since it is just a plain
one-line wrapper around adapter_to_dvobj(adapter)->oper_channel.

Replace all 6 occurrences across the driver with direct access to the
structure member through the adapter_to_dvobj() macro. This simplifies
the code, flattens the driver structure, and removes dead boilerplates.

Signed-off-by: Arsenii Pashchenko <ulijg308@xxxxxxxxx>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 4 ++--
drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 5 +----
drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 1 -
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 6 +++---
5 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 274d99e6a..c8f0beec0 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -267,8 +267,8 @@ void expire_timeout_chk(struct adapter *padapter)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;

/* switch to correct channel of current network before issue keep-alive frames */
- if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) {
- backup_oper_channel = rtw_get_oper_ch(padapter);
+ if (adapter_to_dvobj(padapter)->oper_channel != pmlmeext->cur_channel) {
+ backup_oper_channel = adapter_to_dvobj(padapter)->oper_channel;
r8723bs_select_channel(padapter, pmlmeext->cur_channel);
}

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 7f101adcc..064c9923d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -3869,7 +3869,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str

bssid->configuration.ds_config = HT_info->primary_channel;
} else { /* use current channel */
- bssid->configuration.ds_config = rtw_get_oper_ch(padapter);
+ bssid->configuration.ds_config = adapter_to_dvobj(padapter)->oper_channel;
}
}

@@ -3910,7 +3910,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
}

/* mark bss info receiving from nearby channel as signal_quality 101 */
- if (bssid->configuration.ds_config != rtw_get_oper_ch(padapter))
+ if (bssid->configuration.ds_config != adapter_to_dvobj(padapter)->oper_channel)
bssid->phy_info.signal_quality = 101;

return _SUCCESS;
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 1d37c2d5b..f610fa5b3 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -247,10 +247,7 @@ void set_msr(struct adapter *padapter, u8 type)
rtw_hal_set_hwreg(padapter, HW_VAR_MEDIA_STATUS, (u8 *)(&type));
}

-inline u8 rtw_get_oper_ch(struct adapter *adapter)
-{
- return adapter_to_dvobj(adapter)->oper_channel;
-}
+

inline void rtw_set_oper_ch(struct adapter *adapter, u8 ch)
{
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 09f4d66cc..e949f5efd 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -439,7 +439,6 @@ void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable);

void set_msr(struct adapter *padapter, u8 type);

-u8 rtw_get_oper_ch(struct adapter *adapter);
void rtw_set_oper_ch(struct adapter *adapter, u8 ch);
void rtw_set_oper_bw(struct adapter *adapter, u8 bw);
void rtw_set_oper_choffset(struct adapter *adapter, u8 offset);
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 397440af8..a71eb008f 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1978,7 +1978,7 @@ static int cfg80211_rtw_get_channel(struct wiphy *wiphy, struct wireless_dev *wd
if (!adapter->rtw_wdev)
return -ENODEV;

- channel = rtw_get_oper_ch(adapter);
+ channel = adapter_to_dvobj(adapter)->oper_channel;
if (!channel)
return -ENODATA;

@@ -2452,7 +2452,7 @@ void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len,
int channel;
u8 category, action;

- channel = rtw_get_oper_ch(adapter);
+ channel = adapter_to_dvobj(adapter)->oper_channel;

rtw_action_frame_parse(frame, frame_len, &category, &action);

@@ -2475,7 +2475,7 @@ static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *b
rtw_set_scan_deny(padapter, 1000);

rtw_scan_abort(padapter);
- if (tx_ch != rtw_get_oper_ch(padapter)) {
+ if (tx_ch != adapter_to_dvobj(padapter)->oper_channel) {
if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED))
pmlmeext->cur_channel = tx_ch;
set_channel_bwmode(padapter, tx_ch, HAL_PRIME_CHNL_OFFSET_DONT_CARE, CHANNEL_WIDTH_20);
--
2.55.0