Skip to content

Commit 7de30d5

Browse files
Ethan Tidmoregregkh
authored andcommitted
staging: rtl8723bs: remove unused private debug counters
The driver maintains a private `struct debug_priv` embedded within `struct dvobj_priv` to track various error counters (e.g., suspend errors, alloc failures, RX drops). These counters are incremented in various files but the data is never read or exposed to userspace. Remove the unused `debug_priv` structure definition, the instance in `dvobj_priv`, and all associated increment operations across the driver to clean up the code. This also removes the following helper functions which were used solely to update these counters: - rtw_reset_rx_info() - recv_indicatepkts_pkt_loss_cnt() Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://patch.msgid.link/20260131212128.25548-1-ethantidmore06@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c41ac35 commit 7de30d5

10 files changed

Lines changed: 15 additions & 157 deletions

File tree

drivers/staging/rtl8723bs/core/rtw_mlme.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -819,15 +819,6 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv)
819819
spin_unlock_bh(&scan_queue->lock);
820820
}
821821

822-
static void rtw_reset_rx_info(struct debug_priv *pdbgpriv)
823-
{
824-
pdbgpriv->dbg_rx_ampdu_drop_count = 0;
825-
pdbgpriv->dbg_rx_ampdu_forced_indicate_count = 0;
826-
pdbgpriv->dbg_rx_ampdu_loss_count = 0;
827-
pdbgpriv->dbg_rx_dup_mgt_frame_drop_count = 0;
828-
pdbgpriv->dbg_rx_ampdu_window_shift_cnt = 0;
829-
}
830-
831822
static void find_network(struct adapter *adapter)
832823
{
833824
struct wlan_network *pwlan = NULL;
@@ -848,8 +839,6 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue)
848839
{
849840
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
850841
struct wlan_network *tgt_network = &pmlmepriv->cur_network;
851-
struct dvobj_priv *psdpriv = adapter->dvobj;
852-
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
853842

854843
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_AP_STATE)) {
855844
struct sta_info *psta;
@@ -873,8 +862,6 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue)
873862

874863
if (lock_scanned_queue)
875864
adapter->securitypriv.key_mask = 0;
876-
877-
rtw_reset_rx_info(pdbgpriv);
878865
}
879866

880867
/* rtw_indicate_connect: the caller has to lock pmlmepriv->lock */

drivers/staging/rtl8723bs/core/rtw_mlme_ext.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,6 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame)
438438
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
439439
u8 *pframe = precv_frame->u.hdr.rx_data;
440440
struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(pframe));
441-
struct dvobj_priv *psdpriv = padapter->dvobj;
442-
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
443441

444442
if (GetFrameType(pframe) != WIFI_MGT_TYPE)
445443
return;
@@ -463,7 +461,6 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame)
463461
if (GetRetry(pframe)) {
464462
if (precv_frame->u.hdr.attrib.seq_num == psta->RxMgmtFrameSeqNum) {
465463
/* drop the duplicate management frame */
466-
pdbgpriv->dbg_rx_dup_mgt_frame_drop_count++;
467464
return;
468465
}
469466
}

drivers/staging/rtl8723bs/core/rtw_pwrctrl.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ static bool rtw_pwr_unassociated_idle(struct adapter *adapter)
139139
void rtw_ps_processor(struct adapter *padapter)
140140
{
141141
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
142-
struct dvobj_priv *psdpriv = padapter->dvobj;
143-
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
144142
u32 ps_deny = 0;
145143

146144
mutex_lock(&adapter_to_pwrctl(padapter)->lock);
@@ -149,10 +147,8 @@ void rtw_ps_processor(struct adapter *padapter)
149147
if (ps_deny != 0)
150148
goto exit;
151149

152-
if (pwrpriv->bInSuspend) {/* system suspend or autosuspend */
153-
pdbgpriv->dbg_ps_insuspend_cnt++;
150+
if (pwrpriv->bInSuspend) /* system suspend or autosuspend */
154151
return;
155-
}
156152

157153
pwrpriv->ps_processing = true;
158154

drivers/staging/rtl8723bs/core/rtw_recv.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,9 +1782,6 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe)
17821782

17831783
static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num)
17841784
{
1785-
struct adapter *padapter = preorder_ctrl->padapter;
1786-
struct dvobj_priv *psdpriv = padapter->dvobj;
1787-
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
17881785
u8 wsize = preorder_ctrl->wsize_b;
17891786
u16 wend = (preorder_ctrl->indicate_seq + wsize - 1) % 4096u;
17901787

@@ -1810,7 +1807,6 @@ static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_n
18101807
preorder_ctrl->indicate_seq = seq_num + 1 - wsize;
18111808
else
18121809
preorder_ctrl->indicate_seq = 0xFFF - (wsize - (seq_num + 1)) + 1;
1813-
pdbgpriv->dbg_rx_ampdu_window_shift_cnt++;
18141810
}
18151811

18161812
return true;
@@ -1861,15 +1857,6 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, un
18611857

18621858
}
18631859

1864-
static void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u64 current_seq)
1865-
{
1866-
if (current_seq < prev_seq)
1867-
pdbgpriv->dbg_rx_ampdu_loss_count += (4096 + current_seq - prev_seq);
1868-
else
1869-
pdbgpriv->dbg_rx_ampdu_loss_count += (current_seq - prev_seq);
1870-
1871-
}
1872-
18731860
static int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame)
18741861
{
18751862
struct recv_priv *precvpriv;
@@ -1916,8 +1903,6 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor
19161903
int bPktInBuf = false;
19171904
struct recv_priv *precvpriv = &padapter->recvpriv;
19181905
struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
1919-
struct dvobj_priv *psdpriv = padapter->dvobj;
1920-
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
19211906

19221907
/* spin_lock_irqsave(&ppending_recvframe_queue->lock, irql); */
19231908
/* spin_lock(&ppending_recvframe_queue->lock); */
@@ -1927,7 +1912,6 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor
19271912

19281913
/* Handling some condition for forced indicate case. */
19291914
if (bforced == true) {
1930-
pdbgpriv->dbg_rx_ampdu_forced_indicate_count++;
19311915
if (list_empty(phead)) {
19321916
/* spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql); */
19331917
/* spin_unlock(&ppending_recvframe_queue->lock); */
@@ -1937,7 +1921,6 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor
19371921
prframe = (union recv_frame *)plist;
19381922
pattrib = &prframe->u.hdr.attrib;
19391923

1940-
recv_indicatepkts_pkt_loss_cnt(pdbgpriv, preorder_ctrl->indicate_seq, pattrib->seq_num);
19411924
preorder_ctrl->indicate_seq = pattrib->seq_num;
19421925

19431926
}
@@ -1998,8 +1981,6 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *
19981981
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;
19991982
struct recv_reorder_ctrl *preorder_ctrl = prframe->u.hdr.preorder_ctrl;
20001983
struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
2001-
struct dvobj_priv *psdpriv = padapter->dvobj;
2002-
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
20031984

20041985
if (!pattrib->amsdu) {
20051986
/* s1. */
@@ -2042,11 +2023,8 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *
20422023
spin_lock_bh(&ppending_recvframe_queue->lock);
20432024

20442025
/* s2. check if winstart_b(indicate_seq) needs to been updated */
2045-
if (!check_indicate_seq(preorder_ctrl, pattrib->seq_num)) {
2046-
pdbgpriv->dbg_rx_ampdu_drop_count++;
2026+
if (!check_indicate_seq(preorder_ctrl, pattrib->seq_num))
20472027
goto _err_exit;
2048-
}
2049-
20502028

20512029
/* s3. Insert all packet into Reorder Queue to maintain its ordering. */
20522030
if (!enqueue_reorder_recvframe(preorder_ctrl, prframe)) {

drivers/staging/rtl8723bs/hal/hal_com.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -782,21 +782,8 @@ bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt)
782782

783783
void rtw_hal_check_rxfifo_full(struct adapter *adapter)
784784
{
785-
struct dvobj_priv *psdpriv = adapter->dvobj;
786-
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
787-
int save_cnt = false;
788-
789785
/* switch counter to RX fifo */
790786
rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xf0);
791-
save_cnt = true;
792-
/* todo: other chips */
793-
794-
if (save_cnt) {
795-
/* rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xa0); */
796-
pdbgpriv->dbg_rx_fifo_last_overflow = pdbgpriv->dbg_rx_fifo_curr_overflow;
797-
pdbgpriv->dbg_rx_fifo_curr_overflow = rtw_read16(adapter, REG_RXERR_RPT);
798-
pdbgpriv->dbg_rx_fifo_diff_overflow = pdbgpriv->dbg_rx_fifo_curr_overflow-pdbgpriv->dbg_rx_fifo_last_overflow;
799-
}
800787
}
801788

802789
static u32 Array_kfreemap[] = {

drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,6 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw)
304304
const struct firmware *fw;
305305
struct device *device = dvobj_to_dev(padapter->dvobj);
306306
u8 *fwfilepath;
307-
struct dvobj_priv *psdpriv = padapter->dvobj;
308-
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
309307
u8 tmp_ps;
310308

311309
pFirmware = kzalloc(sizeof(struct rt_firmware), GFP_KERNEL);
@@ -324,8 +322,6 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw)
324322
/* 2. read power_state = 0xA0[1:0] */
325323
tmp_ps = rtw_read8(padapter, 0xa0);
326324
tmp_ps &= 0x03;
327-
if (tmp_ps != 0x01)
328-
pdbgpriv->dbg_downloadfw_pwr_state_cnt++;
329325

330326
fwfilepath = "rtlwifi/rtl8723bs_nic.bin";
331327

drivers/staging/rtl8723bs/hal/sdio_halinit.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -886,9 +886,6 @@ static void CardDisableRTL8723BSdio(struct adapter *padapter)
886886

887887
u32 rtl8723bs_hal_deinit(struct adapter *padapter)
888888
{
889-
struct dvobj_priv *psdpriv = padapter->dvobj;
890-
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
891-
892889
if (padapter->hw_init_completed) {
893890
if (adapter_to_pwrctl(padapter)->bips_processing) {
894891
if (padapter->netif_up) {
@@ -921,18 +918,15 @@ u32 rtl8723bs_hal_deinit(struct adapter *padapter)
921918
adapter_to_pwrctl(padapter)->pre_ips_type = 0;
922919

923920
} else {
924-
pdbgpriv->dbg_carddisable_cnt++;
925921
CardDisableRTL8723BSdio(padapter);
926922

927923
adapter_to_pwrctl(padapter)->pre_ips_type = 1;
928924
}
929925

930926
} else {
931-
pdbgpriv->dbg_carddisable_cnt++;
932927
CardDisableRTL8723BSdio(padapter);
933928
}
934-
} else
935-
pdbgpriv->dbg_deinit_fail_cnt++;
929+
}
936930

937931
return _SUCCESS;
938932
}

drivers/staging/rtl8723bs/include/drv_types.h

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -173,45 +173,6 @@ struct registry_priv {
173173
#define GET_IFACE_NUMS(padapter) (((struct adapter *)padapter)->dvobj->iface_nums)
174174
#define GET_ADAPTER(padapter, iface_id) (((struct adapter *)padapter)->dvobj->padapters[iface_id])
175175

176-
struct debug_priv {
177-
u32 dbg_sdio_free_irq_error_cnt;
178-
u32 dbg_sdio_alloc_irq_error_cnt;
179-
u32 dbg_sdio_free_irq_cnt;
180-
u32 dbg_sdio_alloc_irq_cnt;
181-
u32 dbg_sdio_deinit_error_cnt;
182-
u32 dbg_sdio_init_error_cnt;
183-
u32 dbg_suspend_error_cnt;
184-
u32 dbg_suspend_cnt;
185-
u32 dbg_resume_cnt;
186-
u32 dbg_resume_error_cnt;
187-
u32 dbg_deinit_fail_cnt;
188-
u32 dbg_carddisable_cnt;
189-
u32 dbg_carddisable_error_cnt;
190-
u32 dbg_ps_insuspend_cnt;
191-
u32 dbg_dev_unload_inIPS_cnt;
192-
u32 dbg_wow_leave_ps_fail_cnt;
193-
u32 dbg_scan_pwr_state_cnt;
194-
u32 dbg_downloadfw_pwr_state_cnt;
195-
u32 dbg_fw_read_ps_state_fail_cnt;
196-
u32 dbg_leave_ips_fail_cnt;
197-
u32 dbg_leave_lps_fail_cnt;
198-
u32 dbg_h2c_leave32k_fail_cnt;
199-
u32 dbg_diswow_dload_fw_fail_cnt;
200-
u32 dbg_enwow_dload_fw_fail_cnt;
201-
u32 dbg_ips_drvopen_fail_cnt;
202-
u32 dbg_poll_fail_cnt;
203-
u32 dbg_rpwm_toggle_cnt;
204-
u32 dbg_rpwm_timeout_fail_cnt;
205-
u64 dbg_rx_fifo_last_overflow;
206-
u64 dbg_rx_fifo_curr_overflow;
207-
u64 dbg_rx_fifo_diff_overflow;
208-
u64 dbg_rx_ampdu_drop_count;
209-
u64 dbg_rx_ampdu_forced_indicate_count;
210-
u64 dbg_rx_ampdu_loss_count;
211-
u64 dbg_rx_dup_mgt_frame_drop_count;
212-
u64 dbg_rx_ampdu_window_shift_cnt;
213-
};
214-
215176
struct rtw_traffic_statistics {
216177
/* tx statistics */
217178
u64 tx_bytes;
@@ -247,8 +208,6 @@ struct dvobj_priv {
247208

248209
s32 processing_dev_remove;
249210

250-
struct debug_priv drv_dbg;
251-
252211
/* for local/global synchronization */
253212
/* */
254213
spinlock_t lock;

drivers/staging/rtl8723bs/os_dep/os_intfs.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -973,8 +973,6 @@ void rtw_ndev_destructor(struct net_device *ndev)
973973
void rtw_dev_unload(struct adapter *padapter)
974974
{
975975
struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter);
976-
struct dvobj_priv *pobjpriv = padapter->dvobj;
977-
struct debug_priv *pdbgpriv = &pobjpriv->drv_dbg;
978976
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
979977
u8 cnt = 0;
980978

@@ -1003,7 +1001,6 @@ void rtw_dev_unload(struct adapter *padapter)
10031001
/* check HW status and SW state */
10041002
netdev_dbg(padapter->pnetdev,
10051003
"%s: driver in IPS-FWLPS\n", __func__);
1006-
pdbgpriv->dbg_dev_unload_inIPS_cnt++;
10071004
LeaveAllPowerSaveMode(padapter);
10081005
} else {
10091006
netdev_dbg(padapter->pnetdev,
@@ -1086,24 +1083,21 @@ static void rtw_suspend_normal(struct adapter *padapter)
10861083
void rtw_suspend_common(struct adapter *padapter)
10871084
{
10881085
struct dvobj_priv *psdpriv = padapter->dvobj;
1089-
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
10901086
struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(psdpriv);
10911087
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
10921088

10931089
unsigned long start_time = jiffies;
10941090

10951091
netdev_dbg(padapter->pnetdev, " suspend start\n");
1096-
pdbgpriv->dbg_suspend_cnt++;
10971092

10981093
pwrpriv->bInSuspend = true;
10991094

11001095
while (pwrpriv->bips_processing)
11011096
msleep(1);
11021097

1103-
if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) {
1104-
pdbgpriv->dbg_suspend_error_cnt++;
1098+
if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved))
11051099
return;
1106-
}
1100+
11071101
rtw_ps_deny(padapter, PS_DENY_SUSPEND);
11081102

11091103
rtw_cancel_all_timer(padapter);
@@ -1131,8 +1125,6 @@ static int rtw_resume_process_normal(struct adapter *padapter)
11311125
struct net_device *pnetdev;
11321126
struct pwrctrl_priv *pwrpriv;
11331127
struct mlme_priv *pmlmepriv;
1134-
struct dvobj_priv *psdpriv;
1135-
struct debug_priv *pdbgpriv;
11361128

11371129
int ret = _SUCCESS;
11381130

@@ -1144,8 +1136,6 @@ static int rtw_resume_process_normal(struct adapter *padapter)
11441136
pnetdev = padapter->pnetdev;
11451137
pwrpriv = adapter_to_pwrctl(padapter);
11461138
pmlmepriv = &padapter->mlmepriv;
1147-
psdpriv = padapter->dvobj;
1148-
pdbgpriv = &psdpriv->drv_dbg;
11491139
/* interface init */
11501140
/* if (sdio_init(adapter_to_dvobj(padapter)) != _SUCCESS) */
11511141
if ((padapter->intf_init) && (padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS)) {
@@ -1164,7 +1154,6 @@ static int rtw_resume_process_normal(struct adapter *padapter)
11641154

11651155
if (pm_netdev_open(pnetdev, true) != 0) {
11661156
ret = -1;
1167-
pdbgpriv->dbg_resume_error_cnt++;
11681157
goto exit;
11691158
}
11701159

0 commit comments

Comments
 (0)