Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f55a6d45 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman
Browse files

staging: rtl8723bs: rework debug configuration handling



I ran into this warning during randconfig testing:

drivers/staging/rtl8723bs/os_dep/rtw_proc.c: In function 'rtw_adapter_proc_deinit':
drivers/staging/rtl8723bs/os_dep/rtw_proc.c:738:25: error: unused variable 'drv_proc' [-Werror=unused-variable]
drivers/staging/rtl8723bs/os_dep/rtw_proc.c: In function 'rtw_adapter_proc_replace':
drivers/staging/rtl8723bs/os_dep/rtw_proc.c:762:25: error: unused variable 'drv_proc' [-Werror=unused-variable]

The problem is that the code procfs code gets built even when CONFIG_PROC_FS
is disabled, but some functions are turned into empty stubs then. This
is easily addressed by adding an #ifdef around the definition of the
CONFIG_PROC_DEBUG macro.

However, I could not bear looking at the macro name that clashes with the
Kconfig name space, so I also renamed it to simply PROC_DEBUG, along with
the other rtl8723bs specific CONFIG_DEBUG_* macros that I renamed the same
way. This is consistent with how we handle the same checks in the non-staging
rtlwifi driver.

As the code path for !CONFIG_PROC_DEBUG had not been tested properly, it
turned out to be incorrect and requires adding 'static inline' annotations
for the stub handlers, and moving some variables around.

Fixes: 554c0a3a ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c45112e4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1744,6 +1744,8 @@ u8 rtw_ps_cmd(struct adapter *padapter)
	return res;
}

u32 g_wait_hiq_empty = 0;

static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
{
	struct sta_info *psta_bmc;
+3 −8
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@

u32 GlobalDebugLevel = _drv_err_;

#ifdef CONFIG_DEBUG_RTL871X
#ifdef DEBUG_RTL871X

	u64 GlobalDebugComponents = \
			_module_rtl871x_xmit_c_ |
@@ -52,7 +52,7 @@ u32 GlobalDebugLevel = _drv_err_;
			_module_mp_ |
			_module_efuse_;

#endif /* CONFIG_DEBUG_RTL871X */
#endif /* DEBUG_RTL871X */

#include <rtw_version.h>

@@ -140,7 +140,7 @@ void rf_reg_dump(void *sel, struct adapter *adapter)
	}
}

#ifdef CONFIG_PROC_DEBUG
#ifdef PROC_DEBUG
ssize_t proc_set_write_reg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
{
	struct net_device *dev = data;
@@ -605,9 +605,6 @@ ssize_t proc_set_rate_ctl(struct file *file, const char __user *buffer, size_t c
	return count;
}

u8 g_fwdl_chksum_fail = 0;
u8 g_fwdl_wintint_rdy_fail = 0;

ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
{
	char tmp[32];
@@ -622,8 +619,6 @@ ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, si
	return count;
}

u32 g_wait_hiq_empty = 0;

ssize_t proc_set_wait_hiq_empty(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
{
	char tmp[32];
+3 −3
Original line number Diff line number Diff line
@@ -4844,7 +4844,7 @@ static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssid
		}
		chplan_ap.Len = i;

#ifdef CONFIG_DEBUG_RTL871X
#ifdef DEBUG_RTL871X
		i = 0;
		DBG_871X("%s: AP[%s] channel plan {", __func__, bssid->Ssid.Ssid);
		while ((i < chplan_ap.Len) && (chplan_ap.Channel[i] != 0)) {
@@ -4855,7 +4855,7 @@ static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssid
#endif

		memcpy(chplan_sta, pmlmeext->channel_set, sizeof(chplan_sta));
#ifdef CONFIG_DEBUG_RTL871X
#ifdef DEBUG_RTL871X
		i = 0;
		DBG_871X("%s: STA channel plan {", __func__);
		while ((i < MAX_CHANNEL_NUM) && (chplan_sta[i].ChannelNum != 0)) {
@@ -4992,7 +4992,7 @@ static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssid

		pmlmeext->update_channel_plan_by_ap_done = 1;

#ifdef CONFIG_DEBUG_RTL871X
#ifdef DEBUG_RTL871X
		k = 0;
		DBG_871X("%s: new STA channel plan {", __func__);
		while ((k < MAX_CHANNEL_NUM) && (chplan_new[k].ChannelNum != 0)) {
+2 −2
Original line number Diff line number Diff line
@@ -2267,12 +2267,12 @@ void rtl8723b_download_BTCoex_AP_mode_rsvd_page(struct adapter *padapter)
	DBG_8192C("+" FUNC_ADPT_FMT ": iface_type =%d fw_state = 0x%08X\n",
		FUNC_ADPT_ARG(padapter), get_iface_type(padapter), get_fwstate(&padapter->mlmepriv));

#ifdef CONFIG_DEBUG
#ifdef DEBUG
	if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == false) {
		DBG_8192C(FUNC_ADPT_FMT ": [WARNING] not in AP mode!!\n",
			FUNC_ADPT_ARG(padapter));
	}
#endif /*  CONFIG_DEBUG */
#endif /*  DEBUG */

	pHalData = GET_HAL_DATA(padapter);
	pmlmeext = &padapter->mlmeextpriv;
+8 −4
Original line number Diff line number Diff line
@@ -225,6 +225,8 @@ void _8051Reset8723(struct adapter *padapter)
	DBG_8192C("%s: Finish\n", __func__);
}

u8 g_fwdl_chksum_fail = 0;

static s32 polling_fwdl_chksum(
	struct adapter *adapter, u32 min_cnt, u32 timeout_ms
)
@@ -268,6 +270,8 @@ static s32 polling_fwdl_chksum(
	return ret;
}

u8 g_fwdl_wintint_rdy_fail = 0;

static s32 _FWFreeToGo(struct adapter *adapter, u32 min_cnt, u32 timeout_ms)
{
	s32 ret = _FAIL;
@@ -896,7 +900,7 @@ static void hal_ReadEFuse_WiFi(
	memset(efuseTbl, 0xFF, EFUSE_MAX_MAP_LEN);


#ifdef CONFIG_DEBUG
#ifdef DEBUG
if (0) {
	for (i = 0; i < 256; i++)
		efuse_OneByteRead(padapter, i, &efuseTbl[i], false);
@@ -969,7 +973,7 @@ if (0) {
	for (i = 0; i < _size_byte; i++)
		pbuf[i] = efuseTbl[_offset+i];

#ifdef CONFIG_DEBUG
#ifdef DEBUG
if (1) {
	DBG_871X("Efuse Realmap:\n");
	for (i = 0; i < _size_byte; i++) {
@@ -2602,7 +2606,7 @@ void Hal_EfuseParseTxPowerInfo_8723B(
				pHalData->Index24G_CCK_Base[rfPath][ch] = pwrInfo24G.IndexCCK_Base[rfPath][group];
				pHalData->Index24G_BW40_Base[rfPath][ch] = pwrInfo24G.IndexBW40_Base[rfPath][group];
			}
#ifdef CONFIG_DEBUG
#ifdef DEBUG
			RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("======= Path %d, ChannelIndex %d, Group %d =======\n", rfPath, ch, group));
			RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Index24G_CCK_Base[%d][%d] = 0x%x\n", rfPath, ch, pHalData->Index24G_CCK_Base[rfPath][ch]));
			RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Index24G_BW40_Base[%d][%d] = 0x%x\n", rfPath, ch, pHalData->Index24G_BW40_Base[rfPath][ch]));
@@ -2615,7 +2619,7 @@ void Hal_EfuseParseTxPowerInfo_8723B(
			pHalData->BW20_24G_Diff[rfPath][TxCount] = pwrInfo24G.BW20_Diff[rfPath][TxCount];
			pHalData->BW40_24G_Diff[rfPath][TxCount] = pwrInfo24G.BW40_Diff[rfPath][TxCount];

#ifdef CONFIG_DEBUG
#ifdef DEBUG
			RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("--------------------------------------- 2.4G ---------------------------------------\n"));
			RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("CCK_24G_Diff[%d][%d]= %d\n", rfPath, TxCount, pHalData->CCK_24G_Diff[rfPath][TxCount]));
			RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("OFDM_24G_Diff[%d][%d]= %d\n", rfPath, TxCount, pHalData->OFDM_24G_Diff[rfPath][TxCount]));
Loading