Skip to content

Commit

Permalink
Add CONFIG_RTW_DEBUG guards
Browse files Browse the repository at this point in the history
There are variables which are only used by debug print macros when
debugging is enabled. Guard them off with CONFIG_RTW_DEBUG to keep
the compiler happy about unused variables.
  • Loading branch information
sevan committed Oct 3, 2022
1 parent 1658e83 commit 7ea31bb
Show file tree
Hide file tree
Showing 25 changed files with 130 additions and 7 deletions.
18 changes: 18 additions & 0 deletions core/rtw_mlme_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ void rtw_txpwr_init_regd(struct rf_ctl_t *rfctl)
, rfctl->country_ent ? rfctl->country_ent->alpha2 : NULL
, rfctl->ChannelPlan);
if (exc) {
#ifdef CONFIG_RTW_DEBUG
u8 has_country = (exc->country[0] == '\0' && exc->country[1] == '\0') ? 0 : 1;
#endif

if (strcmp(exc->regd_name, regd_str(TXPWR_LMT_NONE)) == 0)
rfctl->regd_name = regd_str(TXPWR_LMT_NONE);
Expand Down Expand Up @@ -6163,7 +6165,9 @@ int issue_probereq_p2p_ex(_adapter *adapter, u8 *da, int try_cnt, int wait_ms)
{
int ret;
int i = 0;
#ifdef CONFIG_RTW_DEBUG
systime start = rtw_get_current_time();
#endif

do {
ret = _issue_probereq_p2p(adapter, da, wait_ms > 0 ? _TRUE : _FALSE);
Expand Down Expand Up @@ -8564,7 +8568,9 @@ int issue_probereq_ex(_adapter *padapter, const NDIS_802_11_SSID *pssid, const u
{
int ret = _FAIL;
int i = 0;
#ifdef CONFIG_RTW_DEBUG
systime start = rtw_get_current_time();
#endif

if (rtw_rfctl_is_tx_blocked_by_ch_waiting(adapter_to_rfctl(padapter)))
goto exit;
Expand Down Expand Up @@ -9593,7 +9599,9 @@ int issue_nulldata(_adapter *padapter, unsigned char *da, unsigned int power_mod
{
int ret = _FAIL;
int i = 0;
#ifdef CONFIG_RTW_DEBUG
systime start = rtw_get_current_time();
#endif
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);

Expand Down Expand Up @@ -9747,7 +9755,9 @@ int issue_qos_nulldata(_adapter *padapter, unsigned char *da, u16 tid, u8 ps, in
{
int ret = _FAIL;
int i = 0;
#ifdef CONFIG_RTW_DEBUG
systime start = rtw_get_current_time();
#endif
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);

Expand Down Expand Up @@ -9888,7 +9898,9 @@ int issue_deauth_ex(_adapter *padapter, u8 *da, unsigned short reason, int try_c
{
int ret = _FAIL;
int i = 0;
#ifdef CONFIG_RTW_DEBUG
systime start = rtw_get_current_time();
#endif

if (rtw_rfctl_is_tx_blocked_by_ch_waiting(adapter_to_rfctl(padapter)))
goto exit;
Expand Down Expand Up @@ -10301,7 +10313,9 @@ inline u8 issue_addba_rsp_wait_ack(_adapter *adapter, unsigned char *ra, u8 tid,
{
int ret = _FAIL;
int i = 0;
#ifdef CONFIG_RTW_DEBUG
systime start = rtw_get_current_time();
#endif

if (rtw_rfctl_is_tx_blocked_by_ch_waiting(adapter_to_rfctl(adapter)))
goto exit;
Expand Down Expand Up @@ -10379,7 +10393,9 @@ int issue_del_ba_ex(_adapter *adapter, unsigned char *ra, u8 tid, u16 reason, u8
{
int ret = _FAIL;
int i = 0;
#ifdef CONFIG_RTW_DEBUG
systime start = rtw_get_current_time();
#endif

if (rtw_rfctl_is_tx_blocked_by_ch_waiting(adapter_to_rfctl(adapter)))
goto exit;
Expand Down Expand Up @@ -10657,7 +10673,9 @@ int issue_action_SM_PS_wait_ack(_adapter *padapter, unsigned char *raddr, u8 New
{
int ret = _FAIL;
int i = 0;
#ifdef CONFIG_RTW_DEBUG
systime start = rtw_get_current_time();
#endif

if (rtw_rfctl_is_tx_blocked_by_ch_waiting(adapter_to_rfctl(padapter)))
goto exit;
Expand Down
6 changes: 6 additions & 0 deletions core/rtw_odm.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ void rtw_odm_parse_rx_phy_status_chinfo(union recv_frame *rframe, u8 *phys)
_adapter *adapter = rframe->u.hdr.adapter;
struct dm_struct *phydm = adapter_to_phydm(adapter);
struct rx_pkt_attrib *attrib = &rframe->u.hdr.attrib;
#ifdef CONFIG_RTW_DEBUG
u8 *wlanhdr = get_recvframe_data(rframe);
#endif

if (phydm->support_ic_type & PHYSTS_2ND_TYPE_IC) {
/*
Expand Down Expand Up @@ -247,7 +249,9 @@ void rtw_odm_parse_rx_phy_status_chinfo(union recv_frame *rframe, u8 *phys)
*/

if ((*phys & 0xf) == 0) {
#ifdef CONFIG_RTW_DEBUG
struct phy_sts_rpt_jgr2_type0 *phys_t0 = (struct phy_sts_rpt_jgr2_type0 *)phys;
#endif

if (DBG_RX_PHYSTATUS_CHINFO) {
RTW_PRINT("phys_t%u ta="MAC_FMT" %s, %s(band:%u, ch:%u, l_rxsc:%u)\n"
Expand Down Expand Up @@ -375,7 +379,9 @@ void rtw_odm_parse_rx_phy_status_chinfo(union recv_frame *rframe, u8 *phys)
attrib->ch = pkt_cch;

} else {
#ifdef CONFIG_RTW_DEBUG
struct phy_sts_rpt_jgr2_type2 *phys_t2 = (struct phy_sts_rpt_jgr2_type2 *)phys;
#endif

if (DBG_RX_PHYSTATUS_CHINFO) {
RTW_PRINT("phys_t%u ta="MAC_FMT" %s, %s(band:%u, ch:%u, l_rxsc:%u, ht_rxsc:%u)\n"
Expand Down
2 changes: 2 additions & 0 deletions core/rtw_pwrctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ bool rtw_pwr_unassociated_idle(_adapter *adapter)
void rtw_ps_processor(_adapter *padapter)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
#ifdef CONFIG_RTW_DEBUG
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
#endif
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
#ifdef SUPPORT_HW_RFOFF_DETECTED
Expand Down
4 changes: 4 additions & 0 deletions core/rtw_recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,11 @@ sint recv_decache(union recv_frame *precv_frame)
{
struct sta_info *psta = precv_frame->u.hdr.psta;
struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
#ifdef CONFIG_RTW_DEBUG
#if defined(DBG_RX_SEQ) || defined(DBG_RX_DROP_FRAME)
_adapter *adapter = psta->padapter;
#endif
#endif
sint tid = pattrib->priority;
u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num & 0xffff) << 4) |
(precv_frame->u.hdr.attrib.frag_num & 0xf);
Expand Down
2 changes: 2 additions & 0 deletions core/rtw_wlan_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2796,7 +2796,9 @@ void parsing_eapol_packet(_adapter *padapter, u8 *key_payload, struct sta_info *
struct ieee802_1x_hdr *hdr;
struct wpa_eapol_key *key;
u16 key_info, key_data_length;
#ifdef CONFIG_RTW_DEBUG
char *trx_msg = trx_type ? "send" : "recv";
#endif

hdr = (struct ieee802_1x_hdr *) key_payload;

Expand Down
3 changes: 2 additions & 1 deletion hal/hal_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -13592,8 +13592,9 @@ int Hal_GetPhyEfuseMACAddr(PADAPTER padapter, u8 *mac_addr)
void rtw_dump_cur_efuse(PADAPTER padapter)
{
int mapsize =0;
#ifdef CONFIG_RTW_DEBUG
HAL_DATA_TYPE *hal_data = GET_HAL_DATA(padapter);

#endif
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN , (void *)&mapsize, _FALSE);

if (mapsize <= 0 || mapsize > EEPROM_MAX_SIZE) {
Expand Down
4 changes: 4 additions & 0 deletions hal/hal_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ u8 rtw_hal_read_chip_info(_adapter *padapter)
{
u8 rtn = _SUCCESS;
u8 hci_type = rtw_get_intf_type(padapter);
#ifdef CONFIG_RTW_DEBUG
systime start = rtw_get_current_time();
#endif

/* before access eFuse, make sure card enable has been called */
if ((hci_type == RTW_SDIO || hci_type == RTW_GSPI)
Expand Down Expand Up @@ -704,7 +706,9 @@ s32 rtw_hal_fw_dl(_adapter *padapter, u8 wowlan)
#ifdef RTW_HALMAC
s32 rtw_hal_fw_mem_dl(_adapter *padapter, enum fw_mem mem)
{
#ifdef CONFIG_RTW_DEBUG
systime dlfw_start_time = rtw_get_current_time();
#endif
struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
struct debug_priv *pdbgpriv = &dvobj->drv_dbg;
s32 rst = _FALSE;
Expand Down
4 changes: 4 additions & 0 deletions hal/phydm/halrf/halrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ void halrf_iqk_xym_read(void *dm_void, u8 path, u8 xym_type)
void halrf_iqk_xym_show(struct dm_struct *dm, u8 xym_type)
{
u8 num, path, path_num, i;
#ifdef CONFIG_RTW_DEBUG
struct dm_iqk_info *iqk_info = &dm->IQK_info;
#endif

if (dm->rf_type == RF_1T1R)
path_num = 0x1;
Expand Down Expand Up @@ -381,8 +383,10 @@ void halrf_iqk_dbg(void *dm_void)
u32 tmp;
/*two channel, PATH, TX/RX, 0:pass 1 :fail*/
boolean iqk_result[2][NUM][2];
#ifdef CONFIG_RTW_DEBUG
struct dm_iqk_info *iqk_info = &dm->IQK_info;
struct _hal_rf_ *rf = &dm->rf_table;
#endif

/* IQK INFO */
RF_DBG(dm, DBG_RF_IQK, "%-20s\n", "====== IQK Info ======");
Expand Down
4 changes: 4 additions & 0 deletions hal/phydm/halrf/halrf_kfree.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,10 @@ void phydm_set_kfree_to_rf_8821c(void *dm_void, u8 e_rf_path, boolean wlg_btg,
struct dm_struct *dm = (struct dm_struct *)dm_void;
u8 wlg, btg;
u32 gain_bmask = (BIT(18) | BIT(17) | BIT(16) | BIT(15) | BIT(14));
#ifdef CONFIG_RTW_DEBUG
u32 s_gain_bmask = (BIT(19) | BIT(18) | BIT(17) |
BIT(16) | BIT(15) | BIT(14));
#endif

odm_set_rf_reg(dm, e_rf_path, RF_0xde, BIT(0), 1);
odm_set_rf_reg(dm, e_rf_path, RF_0xde, BIT(5), 1);
Expand Down Expand Up @@ -227,8 +229,10 @@ void phydm_clear_kfree_to_rf_8821c(void *dm_void, u8 e_rf_path, u8 data)
{
struct dm_struct *dm = (struct dm_struct *)dm_void;
u32 gain_bmask = (BIT(18) | BIT(17) | BIT(16) | BIT(15) | BIT(14));
#ifdef CONFIG_RTW_DEBUG
u32 s_gain_bmask = (BIT(19) | BIT(18) | BIT(17) |
BIT(16) | BIT(15) | BIT(14));
#endif

odm_set_rf_reg(dm, e_rf_path, RF_0xde, BIT(0), 1);
odm_set_rf_reg(dm, e_rf_path, RF_0xde, BIT(5), 1);
Expand Down
9 changes: 7 additions & 2 deletions hal/phydm/halrf/rtl8822b/halhwimg8822b_rf.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ check_positive(struct dm_struct *dm,
const u32 condition4
)
{
u32 cond1 = condition1, cond2 = condition2,
cond3 = condition3, cond4 = condition4;
u32 cond1 = condition1;
#ifdef CONFIG_RTW_DEBUG
u32 cond2 = condition2, cond3 = condition3,
cond4 = condition4;
#endif

u8 cut_version_for_para =
(dm->cut_version == ODM_CUT_A) ? 15 : dm->cut_version;
Expand All @@ -66,6 +69,7 @@ check_positive(struct dm_struct *dm,
(dm->support_interface & 0x0F) << 8 |
dm->rfe_type;

#ifdef CONFIG_RTW_DEBUG
u32 driver2 = (dm->type_glna & 0xFF) << 0 |
(dm->type_gpa & 0xFF) << 8 |
(dm->type_alna & 0xFF) << 16 |
Expand All @@ -77,6 +81,7 @@ check_positive(struct dm_struct *dm,
(dm->type_gpa & 0xFF00) |
(dm->type_alna & 0xFF00) << 8 |
(dm->type_apa & 0xFF00) << 16;
#endif

PHYDM_DBG(dm, ODM_COMP_INIT,
"===> %s (cond1, cond2, cond3, cond4) = (0x%X 0x%X 0x%X 0x%X)\n",
Expand Down
2 changes: 2 additions & 0 deletions hal/phydm/halrf/rtl8822b/halrf_8822b.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ void odm_tx_pwr_track_set_pwr8822b(void *dm_void, enum pwrtrack_method method,
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
struct _ADAPTER *adapter = dm->adapter;
#endif
#ifdef CONFIG_RTW_DEBUG
struct dm_rf_calibration_struct *cali_info = &dm->rf_calibrate_info;
#endif
struct _hal_rf_ *rf = &dm->rf_table;
u8 tx_pwr_idx_offset = 0;
u8 tx_pwr_idx = 0;
Expand Down
8 changes: 8 additions & 0 deletions hal/phydm/halrf/rtl8822b/halrf_iqk_8822b.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,9 @@ _iqk_one_shot_8822b(void *dm_void, u8 path, u8 idx)
{
struct dm_struct *dm = (struct dm_struct *)dm_void;
struct dm_iqk_info *iqk = &dm->IQK_info;
#ifdef CONFIG_RTW_DEBUG
u8 delay_count = 0;
#endif
boolean fail = true;
u32 IQK_CMD = 0x0, tmp;
u16 iqk_apply[2] = {0xc94, 0xe94};
Expand Down Expand Up @@ -1656,10 +1658,12 @@ void _iqk_get_rxk2_8822b(struct dm_struct *dm, u8 path, u8 imr_limit, u8 side,
{
u8 i;
u32 tone_index, imr_result;
#ifdef CONFIG_RTW_DEBUG
char *freq[15] = {
"1.25MHz", "3.75MHz", "6.25MHz", "8.75MHz", "11.25MHz",
"13.75MHz", "16.25MHz", "18.75MHz", "21.25MHz", "23.75MHz",
"26.25MHz", "28.75MHz", "31.25MHz", "33.75MHz", "36.25MHz"};
#endif

for (i = 0x0; i < imr_limit; i++) {
if (side == 0)
Expand Down Expand Up @@ -1989,7 +1993,9 @@ void phy_get_iqk_cfir_8822b(void *dm_void, u8 idx, u8 path, boolean debug)
void phy_iqk_dbg_cfir_backup_8822b(void *dm_void)
{
struct dm_struct *dm = (struct dm_struct *)dm_void;
#ifdef CONFIG_RTW_DEBUG
struct dm_iqk_info *iqk_info = &dm->IQK_info;
#endif
u8 path, idx, i;

RF_DBG(dm, DBG_RF_IQK, "[IQK]%-20s\n", "backup TX/RX CFIR");
Expand Down Expand Up @@ -2129,7 +2135,9 @@ void phy_iqk_dbg_cfir_write_8822b(void *dm_void, u8 type, u32 path, u32 idx,
void phy_iqk_dbg_cfir_backup_show_8822b(void *dm_void)
{
struct dm_struct *dm = (struct dm_struct *)dm_void;
#ifdef CONFIG_RTW_DEBUG
struct dm_iqk_info *iqk_info = &dm->IQK_info;
#endif
u8 path, idx, i;

RF_DBG(dm, DBG_RF_IQK, "[IQK]%-20s\n", "backup TX/RX CFIR");
Expand Down
4 changes: 4 additions & 0 deletions hal/phydm/phydm_adaptivity.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,9 @@ void phydm_set_edcca_threshold_api(void *dm_void)
{
#ifdef PHYDM_SUPPORT_ADAPTIVITY
struct dm_struct *dm = (struct dm_struct *)dm_void;
#ifdef CONFIG_RTW_DEBUG
struct phydm_adaptivity_struct *adapt = &dm->adaptivity;
#endif

if (*dm->edcca_mode != PHYDM_EDCCA_ADAPT_MODE)
return;
Expand Down Expand Up @@ -768,8 +770,10 @@ void phydm_adaptivity(void *dm_void)
{
#ifdef PHYDM_SUPPORT_ADAPTIVITY
struct dm_struct *dm = (struct dm_struct *)dm_void;
#ifdef CONFIG_RTW_DEBUG
struct phydm_adaptivity_struct *adapt = &dm->adaptivity;
struct phydm_dig_struct *dig_t = &dm->dm_dig_table;
#endif

if (phydm_edcca_abort(dm))
return;
Expand Down
2 changes: 2 additions & 0 deletions hal/phydm/phydm_ccx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,9 @@ void phydm_env_mntr_watchdog(void *dm_void)
{
#if (defined(NHM_SUPPORT) && defined(CLM_SUPPORT))
struct dm_struct *dm = (struct dm_struct *)dm_void;
#ifdef CONFIG_RTW_DEBUG
struct ccx_info *ccx = &dm->dm_ccx_info;
#endif
boolean nhm_chk_ok = false;
boolean clm_chk_ok = false;

Expand Down
8 changes: 8 additions & 0 deletions hal/phydm/phydm_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,9 @@ void phydm_get_phy_statistic(void *dm_void)
void phydm_basic_dbg_msg_linked(void *dm_void)
{
struct dm_struct *dm = (struct dm_struct *)dm_void;
#ifdef CONFIG_RTW_DEBUG
struct phydm_cfo_track_struct *cfo_t = &dm->dm_cfo_track;
#endif
struct odm_phy_dbg_info *dbg_t = &dm->phy_dbg_info;
u16 macid, client_cnt = 0;
u8 rate = 0;
Expand Down Expand Up @@ -2624,7 +2626,9 @@ void phydm_dm_summary(void *dm_void, u8 macid)
void phydm_basic_dbg_message(void *dm_void)
{
struct dm_struct *dm = (struct dm_struct *)dm_void;
#ifdef CONFIG_RTW_DEBUG
struct phydm_fa_struct *fa_t = &dm->false_alm_cnt;
#endif
#ifdef NHM_SUPPORT
struct ccx_info *ccx = &dm->dm_ccx_info;
u8 nhm_valid = 0;
Expand Down Expand Up @@ -3962,7 +3966,9 @@ void phydm_dump_rf_reg(void *dm_void, u32 *_used, char *output, u32 *_out_len)

void phydm_dump_mac_reg(void *dm_void, u32 *_used, char *output, u32 *_out_len)
{
#ifdef CONFIG_RTW_DEBUG
struct dm_struct *dm = (struct dm_struct *)dm_void;
#endif
u32 addr = 0;
u32 used = *_used;
u32 out_len = *_out_len;
Expand Down Expand Up @@ -5581,13 +5587,15 @@ void phydm_fw_trace_handler_code(void *dm_void, u8 *buffer, u8 cmd_len)
{
#ifdef CONFIG_PHYDM_DEBUG_FUNCTION
struct dm_struct *dm = (struct dm_struct *)dm_void;
#ifdef CONFIG_RTW_DEBUG
u8 function = buffer[0];
u8 dbg_num = buffer[1];
u16 content_0 = (((u16)buffer[3]) << 8) | ((u16)buffer[2]);
u16 content_1 = (((u16)buffer[5]) << 8) | ((u16)buffer[4]);
u16 content_2 = (((u16)buffer[7]) << 8) | ((u16)buffer[6]);
u16 content_3 = (((u16)buffer[9]) << 8) | ((u16)buffer[8]);
u16 content_4 = (((u16)buffer[11]) << 8) | ((u16)buffer[10]);
#endif

if (cmd_len > 12)
PHYDM_DBG(dm, DBG_FW_TRACE,
Expand Down
3 changes: 3 additions & 0 deletions hal/phydm/phydm_dfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,9 @@ phydm_radar_detect_dm_check(
u32 regf70_value = 0, regf74_value = 0;
u32 rega40_value = 0, rega44_value = 0, rega48_value = 0;
u32 rega4c_value = 0, rega50_value = 0, rega54_value = 0;
#ifdef CONFIG_RTW_DEBUG
u32 regdf4_value = 0;
#endif
#if (RTL8721D_SUPPORT)
u32 reg908_value = 0, regdf4_value = 0;
u32 regf54_value = 0, regf58_value = 0, regf5c_value = 0;
Expand Down
Loading

0 comments on commit 7ea31bb

Please sign in to comment.