[PATCH 1/5] staging: r8188eu: convert/remove DBG_88E calls in core/rtw_ap.c

From: Phillip Potter
Date: Fri Jan 07 2022 - 19:56:03 EST


Convert DBG_88E macro calls in core/rtw_ap.c to use netdev_dbg when they
may display useful information, and remove erroneous DBG_88E calls
entirely.

This leaves six empty static functions which only had DBG_88E calls,
so just remove them:

update_bcn_fixed_ie
update_bcn_htcap_ie
update_bcn_htinfo_ie
update_bcn_rsn_ie
update_bcn_wpa_ie
update_bcn_wmm_ie

also modifying the if blocks/switch cases that invoke them to no longer do
so. This goes further towards the goal of removing this non-standard
debugging code.

Signed-off-by: Phillip Potter <phil@xxxxxxxxxxxxxxxx>
---
drivers/staging/r8188eu/core/rtw_ap.c | 145 ++++++++++----------------
1 file changed, 56 insertions(+), 89 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c
index 1675e2e8439c..1486ec613458 100644
--- a/drivers/staging/r8188eu/core/rtw_ap.c
+++ b/drivers/staging/r8188eu/core/rtw_ap.c
@@ -179,8 +179,9 @@ void expire_timeout_chk(struct adapter *padapter)
list_del_init(&psta->auth_list);
pstapriv->auth_list_cnt--;

- DBG_88E("auth expire %6ph\n",
- psta->hwaddr);
+ netdev_dbg(padapter->pnetdev,
+ "auth expire %6ph\n",
+ psta->hwaddr);

spin_unlock_bh(&pstapriv->auth_list_lock);

@@ -249,16 +250,19 @@ void expire_timeout_chk(struct adapter *padapter)
list_del_init(&psta->asoc_list);
pstapriv->asoc_list_cnt--;

- DBG_88E("asoc expire %pM, state = 0x%x\n", (psta->hwaddr), psta->state);
+ netdev_dbg(padapter->pnetdev,
+ "asoc expire %pM, state = 0x%x\n",
+ (psta->hwaddr), psta->state);
updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING);
} else {
/* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */
if (psta->sleepq_len > (NR_XMITFRAME / pstapriv->asoc_list_cnt) &&
padapter->xmitpriv.free_xmitframe_cnt < (NR_XMITFRAME / pstapriv->asoc_list_cnt / 2)) {
- DBG_88E("%s sta:%pM, sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", __func__,
- (psta->hwaddr), psta->sleepq_len,
- padapter->xmitpriv.free_xmitframe_cnt,
- pstapriv->asoc_list_cnt);
+ netdev_dbg(padapter->pnetdev,
+ "sta:%pM, sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n",
+ (psta->hwaddr), psta->sleepq_len,
+ padapter->xmitpriv.free_xmitframe_cnt,
+ pstapriv->asoc_list_cnt);
wakeup_sta_to_xmit(padapter, psta);
}
}
@@ -288,19 +292,25 @@ void expire_timeout_chk(struct adapter *padapter)

psta->keep_alive_trycnt++;
if (ret == _SUCCESS) {
- DBG_88E("asoc check, sta(%pM) is alive\n", (psta->hwaddr));
+ netdev_dbg(padapter->pnetdev,
+ "asoc check, sta(%pM) is alive\n",
+ (psta->hwaddr));
psta->expire_to = pstapriv->expire_to;
psta->keep_alive_trycnt = 0;
continue;
} else if (psta->keep_alive_trycnt <= 3) {
- DBG_88E("ack check for asoc expire, keep_alive_trycnt =%d\n", psta->keep_alive_trycnt);
+ netdev_dbg(padapter->pnetdev,
+ "ack check for asoc expire, keep_alive_trycnt =%d\n",
+ psta->keep_alive_trycnt);
psta->expire_to = 1;
continue;
}

psta->keep_alive_trycnt = 0;

- DBG_88E("asoc expire %pM, state = 0x%x\n", (psta->hwaddr), psta->state);
+ netdev_dbg(padapter->pnetdev,
+ "asoc expire %pM, state = 0x%x\n",
+ (psta->hwaddr), psta->state);
spin_lock_bh(&pstapriv->asoc_list_lock);
list_del_init(&psta->asoc_list);
pstapriv->asoc_list_cnt--;
@@ -380,8 +390,9 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)

tx_ra_bitmap |= ((raid << 28) & 0xf0000000);

- DBG_88E("%s => mac_id:%d , raid:%d , bitmap = 0x%x, arg = 0x%x\n",
- __func__, psta->mac_id, raid, tx_ra_bitmap, arg);
+ netdev_dbg(padapter->pnetdev,
+ "mac_id:%d, raid:%d, bitmap = 0x%x, arg = 0x%x\n",
+ psta->mac_id, raid, tx_ra_bitmap, arg);

/* bitmap[0:27] = tx_rate_bitmap */
/* bitmap[28:31]= Rate Adaptive id */
@@ -397,7 +408,9 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
psta->init_rate = init_rate;

} else {
- DBG_88E("station aid %d exceed the max number\n", psta->aid);
+ netdev_dbg(padapter->pnetdev,
+ "station aid %d exceed the max number\n",
+ psta->aid);
}
}

@@ -455,7 +468,9 @@ void update_bmc_sta(struct adapter *padapter)
arg = psta->mac_id & 0x1f;
arg |= BIT(7);
tx_ra_bitmap |= ((raid << 28) & 0xf0000000);
- DBG_88E("update_bmc_sta, mask = 0x%x, arg = 0x%x\n", tx_ra_bitmap, arg);
+ netdev_dbg(padapter->pnetdev,
+ "mask = 0x%x, arg = 0x%x\n",
+ tx_ra_bitmap, arg);

/* bitmap[0:27] = tx_rate_bitmap */
/* bitmap[28:31]= Rate Adaptive id */
@@ -474,7 +489,7 @@ void update_bmc_sta(struct adapter *padapter)
spin_unlock_bh(&psta->lock);

} else {
- DBG_88E("add_RATid_bmc_sta error!\n");
+ netdev_dbg(padapter->pnetdev, "add_RATid_bmc_sta error!\n");
}
}

@@ -496,7 +511,6 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
u16 ap_cap_info;

psta->mac_id = psta->aid + 1;
- DBG_88E("%s\n", __func__);

/* ap mode */
rtl8188e_SetHalODMVar(padapter, psta, true);
@@ -552,11 +566,6 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
spin_unlock_bh(&psta->lock);
}

-static void update_bcn_fixed_ie(struct adapter *padapter)
-{
- DBG_88E("%s\n", __func__);
-}
-
static void update_bcn_erpinfo_ie(struct adapter *padapter)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -566,7 +575,7 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter)
unsigned char *p, *ie = pnetwork->IEs;
u32 len = 0;

- DBG_88E("%s, ERP_enable =%d\n", __func__, pmlmeinfo->ERP_enable);
+ netdev_dbg(padapter->pnetdev, "ERP_enable = %d\n", pmlmeinfo->ERP_enable);

if (!pmlmeinfo->ERP_enable)
return;
@@ -591,31 +600,6 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter)
}
}

-static void update_bcn_htcap_ie(struct adapter *padapter)
-{
- DBG_88E("%s\n", __func__);
-}
-
-static void update_bcn_htinfo_ie(struct adapter *padapter)
-{
- DBG_88E("%s\n", __func__);
-}
-
-static void update_bcn_rsn_ie(struct adapter *padapter)
-{
- DBG_88E("%s\n", __func__);
-}
-
-static void update_bcn_wpa_ie(struct adapter *padapter)
-{
- DBG_88E("%s\n", __func__);
-}
-
-static void update_bcn_wmm_ie(struct adapter *padapter)
-{
- DBG_88E("%s\n", __func__);
-}
-
static void update_bcn_wps_ie(struct adapter *padapter)
{
u8 *pwps_ie = NULL, *pwps_ie_src;
@@ -628,8 +612,6 @@ static void update_bcn_wps_ie(struct adapter *padapter)
unsigned char *ie = pnetwork->IEs;
u32 ielen = pnetwork->IELength;

- DBG_88E("%s\n", __func__);
-
pwps_ie = rtw_get_wps_ie(ie + _FIXED_IE_LENGTH_, ielen - _FIXED_IE_LENGTH_, NULL, &wps_ielen);

if (!pwps_ie || wps_ielen == 0)
@@ -673,18 +655,12 @@ static void update_bcn_p2p_ie(struct adapter *padapter)

static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui)
{
- DBG_88E("%s\n", __func__);
-
- if (!memcmp(RTW_WPA_OUI, oui, 4))
- update_bcn_wpa_ie(padapter);
- else if (!memcmp(WMM_OUI, oui, 4))
- update_bcn_wmm_ie(padapter);
- else if (!memcmp(WPS_OUI, oui, 4))
+ if (!memcmp(WPS_OUI, oui, 4))
update_bcn_wps_ie(padapter);
else if (!memcmp(P2P_OUI, oui, 4))
update_bcn_p2p_ie(padapter);
else
- DBG_88E("unknown OUI type!\n");
+ netdev_dbg(padapter->pnetdev, "unknown/unused OUI type!\n");
}

void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
@@ -704,24 +680,12 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)
spin_lock_bh(&pmlmepriv->bcn_update_lock);

switch (ie_id) {
- case 0xFF:
- update_bcn_fixed_ie(padapter);/* 8: TimeStamp, 2: Beacon Interval 2:Capability */
- break;
case _TIM_IE_:
update_BCNTIM(padapter);
break;
case _ERPINFO_IE_:
update_bcn_erpinfo_ie(padapter);
break;
- case _HT_CAPABILITY_IE_:
- update_bcn_htcap_ie(padapter);
- break;
- case _RSN_IE_2_:
- update_bcn_rsn_ie(padapter);
- break;
- case _HT_ADD_INFO_IE_:
- update_bcn_htinfo_ie(padapter);
- break;
case _VENDOR_SPECIFIC_IE_:
update_bcn_vendor_spec_ie(padapter, oui);
break;
@@ -759,8 +723,9 @@ static int rtw_ht_operation_update(struct adapter *padapter)
if (pmlmepriv->htpriv.ht_option)
return 0;

- DBG_88E("%s current operation mode = 0x%X\n",
- __func__, pmlmepriv->ht_op_mode);
+ netdev_dbg(padapter->pnetdev,
+ "current operation mode = 0x%X\n",
+ pmlmepriv->ht_op_mode);

if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT) &&
pmlmepriv->num_sta_ht_no_gf) {
@@ -811,8 +776,9 @@ static int rtw_ht_operation_update(struct adapter *padapter)
op_mode_changes++;
}

- DBG_88E("%s new operation mode = 0x%X changes =%d\n",
- __func__, pmlmepriv->ht_op_mode, op_mode_changes);
+ netdev_dbg(padapter->pnetdev,
+ "new operation mode = 0x%X changes = %d\n",
+ pmlmepriv->ht_op_mode, op_mode_changes);

return op_mode_changes;
}
@@ -928,8 +894,9 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
if (psta->flags & WLAN_STA_HT) {
u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info);

- DBG_88E("HT: STA %pM HT Capabilities Info: 0x%04x\n",
- (psta->hwaddr), ht_capab);
+ netdev_dbg(padapter->pnetdev,
+ "HT: STA %pM HT Capabilities Info: 0x%04x\n",
+ (psta->hwaddr), ht_capab);

if (psta->no_ht_set) {
psta->no_ht_set = 0;
@@ -941,9 +908,9 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
psta->no_ht_gf_set = 1;
pmlmepriv->num_sta_ht_no_gf++;
}
- DBG_88E("%s STA %pM - no greenfield, num of non-gf stations %d\n",
- __func__, (psta->hwaddr),
- pmlmepriv->num_sta_ht_no_gf);
+ netdev_dbg(padapter->pnetdev,
+ "STA %pM - no greenfield, num of non-gf stations %d\n",
+ (psta->hwaddr), pmlmepriv->num_sta_ht_no_gf);
}

if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH_20_40) == 0) {
@@ -951,9 +918,9 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
psta->ht_20mhz_set = 1;
pmlmepriv->num_sta_ht_20mhz++;
}
- DBG_88E("%s STA %pM - 20 MHz HT, num of 20MHz HT STAs %d\n",
- __func__, (psta->hwaddr),
- pmlmepriv->num_sta_ht_20mhz);
+ netdev_dbg(padapter->pnetdev,
+ "STA %pM - 20 MHz HT, num of 20MHz HT STAs %d\n",
+ (psta->hwaddr), pmlmepriv->num_sta_ht_20mhz);
}
} else {
if (!psta->no_ht_set) {
@@ -961,9 +928,9 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
pmlmepriv->num_sta_no_ht++;
}
if (pmlmepriv->htpriv.ht_option) {
- DBG_88E("%s STA %pM - no HT, num of non-HT stations %d\n",
- __func__, (psta->hwaddr),
- pmlmepriv->num_sta_no_ht);
+ netdev_dbg(padapter->pnetdev,
+ "STA %pM - no HT, num of non-HT stations %d\n",
+ (psta->hwaddr), pmlmepriv->num_sta_no_ht);
}
}

@@ -975,7 +942,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
/* update associcated stations cap. */
associated_clients_update(padapter, beacon_updated);

- DBG_88E("%s, updated =%d\n", __func__, beacon_updated);
+ netdev_dbg(padapter->pnetdev, "updated = %d\n", beacon_updated);
}

u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
@@ -1038,7 +1005,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)

/* update associcated stations cap. */

- DBG_88E("%s, updated =%d\n", __func__, beacon_updated);
+ netdev_dbg(padapter->pnetdev, "updated = %d\n", beacon_updated);

return beacon_updated;
}
@@ -1093,8 +1060,6 @@ int rtw_sta_flush(struct adapter *padapter)
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

- DBG_88E(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev));
-
if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE)
return ret;

@@ -1236,7 +1201,9 @@ void stop_ap_mode(struct adapter *padapter)
}
spin_unlock_bh(&pacl_node_q->lock);

- DBG_88E("%s, free acl_node_queue, num =%d\n", __func__, pacl_list->num);
+ netdev_dbg(padapter->pnetdev,
+ "free acl_node_queue, num = %d\n",
+ pacl_list->num);

rtw_sta_flush(padapter);

--
2.33.1