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

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
......@@ -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;
......
......@@ -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];
......
......@@ -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)) {
......
......@@ -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;
......
......@@ -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]));
......
......@@ -21,7 +21,7 @@
/*
* Functions Config
*/
/* define CONFIG_DEBUG_CFG80211 */
/* define DEBUG_CFG80211 */
#ifndef CONFIG_WIRELESS_EXT
#error CONFIG_WIRELESS_EXT needs to be enabled for this driver to work
......@@ -56,16 +56,18 @@
/*
* Debug Related Config
*/
#undef CONFIG_DEBUG
#undef DEBUG
#ifdef CONFIG_DEBUG
#ifdef DEBUG
#define DBG 1 /* for ODM & BTCOEX debug */
/*#define CONFIG_DEBUG_RTL871X */
#else /* !CONFIG_DEBUG */
/*#define DEBUG_RTL871X */
#else /* !DEBUG */
#define DBG 0 /* for ODM & BTCOEX debug */
#endif /* !CONFIG_DEBUG */
#endif /* !DEBUG */
#define CONFIG_PROC_DEBUG
#ifdef CONFIG_PROC_FS
#define PROC_DEBUG
#endif
/* define DBG_XMIT_BUF */
/* define DBG_XMIT_BUF_EXT */
......@@ -206,7 +206,7 @@
#endif /* defined(_dbgdump) */
#ifdef CONFIG_DEBUG
#ifdef DEBUG
#if defined(_dbgdump)
#undef DBG_871X
#define DBG_871X(...) do {\
......@@ -223,9 +223,9 @@
_dbgdump(DRIVER_PREFIX __VA_ARGS__);\
}while (0)
#endif /* defined(_dbgdump) */
#endif /* CONFIG_DEBUG */
#endif /* DEBUG */
#ifdef CONFIG_DEBUG_RTL871X
#ifdef DEBUG_RTL871X
#if defined(_dbgdump) && defined(_MODULE_DEFINE_)
......@@ -258,7 +258,7 @@
_dbgdump("\n"); \
}
#endif /* defined(_dbgdump) */
#endif /* CONFIG_DEBUG_RTL871X */
#endif /* DEBUG_RTL871X */
#ifdef CONFIG_DBG_COUNTER
#define DBG_COUNTER(counter) counter++
......@@ -275,7 +275,7 @@ void mac_reg_dump(void *sel, struct adapter *adapter);
void bb_reg_dump(void *sel, struct adapter *adapter);
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);
int proc_get_read_reg(struct seq_file *m, void *v);
ssize_t proc_set_read_reg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
......@@ -350,6 +350,6 @@ int proc_get_tx_logs(struct seq_file *m, void *v);
int proc_get_int_logs(struct seq_file *m, void *v);
#endif
#endif /* CONFIG_PROC_DEBUG */
#endif /* PROC_DEBUG */
#endif /* __RTW_DEBUG_H__ */
......@@ -1261,7 +1261,7 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
goto exit;
}
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_871X(FUNC_NDEV_FMT" mac ="MAC_FMT"\n", FUNC_NDEV_ARG(ndev), MAC_ARG(mac));
#endif
......@@ -1396,7 +1396,7 @@ void rtw_cfg80211_indicate_scan_done(struct adapter *adapter, bool aborted)
spin_lock_bh(&pwdev_priv->scan_req_lock);
if (pwdev_priv->scan_request != NULL) {
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_871X("%s with scan req\n", __func__);
#endif
......@@ -1412,7 +1412,7 @@ void rtw_cfg80211_indicate_scan_done(struct adapter *adapter, bool aborted)
pwdev_priv->scan_request = NULL;
} else {
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_871X("%s without scan req\n", __func__);
#endif
}
......@@ -1446,7 +1446,7 @@ void rtw_cfg80211_surveydone_event_callback(struct adapter *padapter)
struct __queue *queue = &(pmlmepriv->scanned_queue);
struct wlan_network *pnetwork = NULL;
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_8192C("%s\n", __func__);
#endif
......@@ -1486,7 +1486,7 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *b
u8 *wps_ie;
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_8192C("%s, ielen =%d\n", __func__, len);
#endif
......@@ -1494,7 +1494,7 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *b
{
if ((wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen)))
{
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_8192C("probe_req_wps_ielen =%d\n", wps_ielen);
#endif
......@@ -1548,7 +1548,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
pwdev_priv = adapter_wdev_data(padapter);
pmlmepriv = &padapter->mlmepriv;
/* ifdef CONFIG_DEBUG_CFG80211 */
/* ifdef DEBUG_CFG80211 */
DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter));
/* endif */
......@@ -1558,7 +1558,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
{
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_871X("%s under WIFI_AP_STATE\n", __func__);
#endif
......@@ -1621,7 +1621,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
memset(ssid, 0, sizeof(struct ndis_802_11_ssid)*RTW_SSID_SCAN_AMOUNT);
/* parsing request ssids, n_ssids */
for (i = 0; i < request->n_ssids && i < RTW_SSID_SCAN_AMOUNT; i++) {
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_8192C("ssid =%s, len =%d\n", ssids[i].ssid, ssids[i].ssid_len);
#endif
memcpy(ssid[i].Ssid, ssids[i].ssid, ssids[i].ssid_len);
......@@ -1631,7 +1631,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
/* parsing channels, n_channels */
memset(ch, 0, sizeof(struct rtw_ieee80211_channel)*RTW_CHANNEL_SCAN_AMOUNT);
for (i = 0;i<request->n_channels && i<RTW_CHANNEL_SCAN_AMOUNT;i++) {
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_871X(FUNC_ADPT_FMT CHAN_FMT"\n", FUNC_ADPT_ARG(padapter), CHAN_ARG(request->channels[i]));
#endif
ch[i].hw_value = request->channels[i]->hw_value;
......@@ -3105,7 +3105,7 @@ static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *b
ack = false;
ret = _FAIL;
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_8192C("%s, ack == _FAIL\n", __func__);
#endif
}
......@@ -3114,7 +3114,7 @@ static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *b
msleep(50);
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_8192C("%s, ack =%d, ok!\n", __func__, ack);
#endif
ret = _SUCCESS;
......@@ -3122,7 +3122,7 @@ static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *b
exit:
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_8192C("%s, ret =%d\n", __func__, ret);
#endif
......@@ -3161,12 +3161,12 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy,
/* cookie generation */
*cookie = (unsigned long) buf;
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_871X(FUNC_ADPT_FMT" len =%zu, ch =%d"
"\n", FUNC_ADPT_ARG(padapter),
len, tx_ch
);
#endif /* CONFIG_DEBUG_CFG80211 */
#endif /* DEBUG_CFG80211 */
/* indicate ack before issue frame to avoid racing with rsp frame */
rtw_cfg80211_mgmt_tx_status(padapter, *cookie, buf, len, ack, GFP_KERNEL);
......@@ -3234,7 +3234,7 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
adapter = (struct adapter *)rtw_netdev_priv(ndev);
#ifdef CONFIG_DEBUG_CFG80211
#ifdef DEBUG_CFG80211
DBG_871X(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter),
frame_type, reg);
#endif
......
......@@ -4831,7 +4831,7 @@ static int rtw_wx_set_priv(struct net_device *dev,
char *extra)
{
#ifdef CONFIG_DEBUG_RTW_WX_SET_PRIV
#ifdef DEBUG_RTW_WX_SET_PRIV
char *ext_dbg;
#endif
......@@ -4860,7 +4860,7 @@ static int rtw_wx_set_priv(struct net_device *dev,
/* ("rtw_wx_set_priv: %s req =%s\n", */
/* dev->name, ext)); */
#ifdef CONFIG_DEBUG_RTW_WX_SET_PRIV
#ifdef DEBUG_RTW_WX_SET_PRIV
if (!(ext_dbg = vmalloc(len)))
{
vfree(ext, len);
......@@ -4918,7 +4918,7 @@ static int rtw_wx_set_priv(struct net_device *dev,
FREE_EXT:
vfree(ext);
#ifdef CONFIG_DEBUG_RTW_WX_SET_PRIV
#ifdef DEBUG_RTW_WX_SET_PRIV
vfree(ext_dbg);
#endif
......
......@@ -17,7 +17,7 @@
#include <rtw_debug.h>
#include "rtw_proc.h"
#ifdef CONFIG_PROC_DEBUG
#ifdef PROC_DEBUG
static struct proc_dir_entry *rtw_proc = NULL;
......@@ -784,4 +784,4 @@ void rtw_adapter_proc_replace(struct net_device *dev)
}
#endif /* CONFIG_PROC_DEBUG */
#endif /* PROC_DEBUG */
......@@ -24,7 +24,7 @@ struct rtw_proc_hdl {
ssize_t (*write)(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
};
#ifdef CONFIG_PROC_DEBUG
#ifdef PROC_DEBUG
int rtw_drv_proc_init(void);
void rtw_drv_proc_deinit(void);
......@@ -32,14 +32,14 @@ struct proc_dir_entry *rtw_adapter_proc_init(struct net_device *dev);
void rtw_adapter_proc_deinit(struct net_device *dev);
void rtw_adapter_proc_replace(struct net_device *dev);
#else //!CONFIG_PROC_DEBUG
#else //!PROC_DEBUG
int rtw_drv_proc_init(void) {return 0;}
void rtw_drv_proc_deinit(void) {}
struct proc_dir_entry *rtw_adapter_proc_init(struct net_device *dev){return NULL;}
void rtw_adapter_proc_deinit(struct net_device *dev){}
void rtw_adapter_proc_replace(struct net_device *dev){}
static inline int rtw_drv_proc_init(void) {return 0;}
static inline void rtw_drv_proc_deinit(void) {}
static inline struct proc_dir_entry *rtw_adapter_proc_init(struct net_device *dev){return NULL;}
static inline void rtw_adapter_proc_deinit(struct net_device *dev){}
static inline void rtw_adapter_proc_replace(struct net_device *dev){}
#endif //!CONFIG_PROC_DEBUG
#endif //!PROC_DEBUG
#endif //__RTW_PROC_H__
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment