2021-04-06 05:36:34

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 00/10] staging: rtl8723bs: completely remove RT_TRACE logs

This patchset removes all RT_TRACE usages left and definitions

The whole private tracing system is not tied to a configuration
symbol and the default behaviour is _trace nothing_. It's verbose
and relies on a private log level tracing doomed to be
removed.

The patchset consist on a first patch applying the following
semantic patch on rtl8723bs directory:

$ cat RT_TRACE.cocci
@@
expression a, b, c;
@@

- RT_TRACE(a, b, (c));

Then follows a patch removing commented out RT_TRACE calls.
Third patch removes RT_TRACE definitions.

All other patches, do some code cleaning on sites left blank
by RT_TRACE removal.

This scheme was suggested by Joe Perches.

https://lore.kernel.org/linux-staging/[email protected]/

Fabio Aiuto (10):
staging: rtl8723bs: remove all RT_TRACE logs in hal/ and os_dep/
staging: rtl8723bs: remove commented out RT_TRACE logs in hal/ and
os_dep/
staging: rtl8723bs: remove RT_TRACE log definitions
staging: rtl8723bs: remove empty if, else blocks after RT_TRACE
deletion
staging: rtl8723bs: remove empty #ifdef blocks after RT_TRACE deletion
staging: rtl8723bs: remove unnecessary bracks after RT_TRACE deletion
staging: rtl8723bs: place constant on the right side of the test
staging: rtl8723bs: rewrite comparisons to null
staging: rtl8723bs: remove empty for cycles
staging: rtl8723bs: remove commented code block

.../staging/rtl8723bs/hal/HalPhyRf_8723B.c | 3 -
drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c | 46 ------
.../staging/rtl8723bs/hal/hal_com_phycfg.c | 20 ---
drivers/staging/rtl8723bs/hal/hal_intf.c | 2 -
.../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 131 +-----------------
.../staging/rtl8723bs/hal/rtl8723b_phycfg.c | 33 -----
.../staging/rtl8723bs/hal/rtl8723b_rf6052.c | 2 -
.../staging/rtl8723bs/hal/rtl8723bs_recv.c | 5 +-
.../staging/rtl8723bs/hal/rtl8723bs_xmit.c | 41 +-----
drivers/staging/rtl8723bs/hal/sdio_halinit.c | 49 +------
drivers/staging/rtl8723bs/hal/sdio_ops.c | 35 +----
drivers/staging/rtl8723bs/include/rtw_debug.h | 18 ---
.../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 6 -
.../staging/rtl8723bs/os_dep/ioctl_linux.c | 69 +--------
drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 4 -
drivers/staging/rtl8723bs/os_dep/os_intfs.c | 52 +------
.../staging/rtl8723bs/os_dep/osdep_service.c | 4 +-
drivers/staging/rtl8723bs/os_dep/recv_linux.c | 12 +-
drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 28 +---
drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 5 -
20 files changed, 24 insertions(+), 541 deletions(-)

--
2.20.1


2021-04-06 05:40:11

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 03/10] staging: rtl8723bs: remove RT_TRACE log definitions

remove RT_TRACE log definitions.

Remove all of the RT_TRACE logs in hal/ and os_dep/ file as they
currently do nothing as they require the code to be modified by
hand in order to be turned on. This obviously has not happened
since the code was merged. Moreover it relies on an unneeded
private log level tracing which overrides the in-kernel public one,
so just remove them as they are unused.

Suggested-by: Joe Perches <[email protected]>
Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/include/rtw_debug.h | 18 ------------------
1 file changed, 18 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/rtw_debug.h b/drivers/staging/rtl8723bs/include/rtw_debug.h
index d3c77798a5eb..6639d79cd7ec 100644
--- a/drivers/staging/rtl8723bs/include/rtw_debug.h
+++ b/drivers/staging/rtl8723bs/include/rtw_debug.h
@@ -131,8 +131,6 @@
#define _MODULE_DEFINE_ _module_efuse_
#endif

-#define RT_TRACE(_Comp, _Level, Fmt) do {} while (0)
-
#define DBG_871X(x, ...) do {} while (0)
#define MSG_8192C(x, ...) do {} while (0)
#define DBG_8192C(x, ...) do {} while (0)
@@ -216,22 +214,6 @@
#endif /* defined(_dbgdump) */
#endif /* DEBUG */

-#ifdef DEBUG_RTL871X
-
-#if defined(_dbgdump) && defined(_MODULE_DEFINE_)
-
- #undef RT_TRACE
- #define RT_TRACE(_Comp, _Level, Fmt)\
- do {\
- if ((_Comp & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) {\
- _dbgdump("%s [0x%08x,%d]", DRIVER_PREFIX, (unsigned int)_Comp, _Level);\
- _dbgdump Fmt;\
- } \
- } while (0)
-
-#endif /* defined(_dbgdump) && defined(_MODULE_DEFINE_) */
-#endif /* DEBUG_RTL871X */
-
void dump_drv_version(void *sel);
void dump_log_level(void *sel);

--
2.20.1

2021-04-06 05:40:21

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 04/10] staging: rtl8723bs: remove empty if, else blocks after RT_TRACE deletion

Remove all if, else if, else blocks left empty after
RT_TRACE macro deletion.

Suggested-by: Joe Perches <[email protected]>
Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 15 ---------------
drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c | 7 -------
drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c | 3 +--
drivers/staging/rtl8723bs/hal/sdio_ops.c | 1 -
4 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index 39fb659bc06f..9c544b5888d0 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -64,9 +64,6 @@ static int _BlockWrite(struct adapter *padapter, void *buffer, u32 buffSize)
blockCount_p1 = buffSize / blockSize_p1;
remainSize_p1 = buffSize % blockSize_p1;

- if (blockCount_p1) {
- }
-
for (i = 0; i < blockCount_p1; i++) {
ret = rtw_write32(padapter, (FW_8723B_START_ADDRESS + i * blockSize_p1), *((u32 *)(bufferPtr + i * blockSize_p1)));
if (ret == _FAIL) {
@@ -81,10 +78,6 @@ static int _BlockWrite(struct adapter *padapter, void *buffer, u32 buffSize)

blockCount_p2 = remainSize_p1/blockSize_p2;
remainSize_p2 = remainSize_p1%blockSize_p2;
-
- if (blockCount_p2) {
- }
-
}

/* 3 Phase #3 */
@@ -2266,8 +2259,6 @@ static bool Hal_GetChnlGroup8723B(u8 Channel, u8 *pGroup)
*pGroup = 3;
else if (12 <= Channel && Channel <= 14)
*pGroup = 4;
- else {
- }
} else {
bIn24G = false;

@@ -2299,9 +2290,6 @@ static bool Hal_GetChnlGroup8723B(u8 Channel, u8 *pGroup)
*pGroup = 12;
else if (173 <= Channel && Channel <= 177)
*pGroup = 13;
- else {
- }
-
}
return bIn24G;
}
@@ -3022,7 +3010,6 @@ static void rtl8723b_fill_default_txdesc(
ptxdesc->spe_rpt = 1;
ptxdesc->sw_define = (u8)(GET_PRIMARY_ADAPTER(padapter)->xmitpriv.seq_no);
}
- } else if (pxmitframe->frame_tag == TXAGG_FRAMETAG) {
} else {
ptxdesc->macid = pattrib->mac_id; /* CAM_ID(MAC_ID) */
ptxdesc->rate_id = pattrib->raid; /* Rate ID */
@@ -4258,8 +4245,6 @@ void rtl8723b_start_thread(struct adapter *padapter)
struct xmit_priv *xmitpriv = &padapter->xmitpriv;

xmitpriv->SdioXmitThread = kthread_run(rtl8723bs_xmit_thread, padapter, "RTWHALXT");
- if (IS_ERR(xmitpriv->SdioXmitThread)) {
- }
}

void rtl8723b_stop_thread(struct adapter *padapter)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
index e5f0e48db557..62dd5b582e1c 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
@@ -550,7 +550,6 @@ void PHY_SetTxPowerIndex(
DBG_871X("Invalid Rate!!\n");
break;
}
- } else {
}
}

@@ -648,8 +647,6 @@ static u8 phy_GetSecondaryChnl_8723B(struct adapter *Adapter)
SCSettingOf40 = VHT_DATA_SC_40_LOWER_OF_80MHZ;
else if (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER)
SCSettingOf40 = VHT_DATA_SC_40_UPPER_OF_80MHZ;
- else
- {}

if (
(pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) &&
@@ -671,15 +668,11 @@ static u8 phy_GetSecondaryChnl_8723B(struct adapter *Adapter)
(pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER)
)
SCSettingOf20 = VHT_DATA_SC_20_UPPERST_OF_80MHZ;
- else
- {}
} else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) {
if (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER)
SCSettingOf20 = VHT_DATA_SC_20_UPPER_OF_80MHZ;
else if (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER)
SCSettingOf20 = VHT_DATA_SC_20_LOWER_OF_80MHZ;
- else
- {}
}

return (SCSettingOf40 << 4) | SCSettingOf20;
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
index d27d56920a11..ce7a72701455 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
@@ -345,8 +345,7 @@ static void rtl8723bs_recv_tasklet(struct tasklet_struct *t)
if (pattrib->physt)
update_recvframe_phyinfo(precvframe, (struct phy_stat *)ptr);

- if (rtw_recv_entry(precvframe) != _SUCCESS) {
- }
+ rtw_recv_entry(precvframe);
} else if (pattrib->pkt_rpt_type == C2H_PACKET) {
struct c2h_evt_hdr_t C2hEvent;

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index 4777793e752d..acbb811ced5a 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -1040,7 +1040,6 @@ void sd_int_hdl(struct adapter *adapter)
SdioLocalCmd52Write4Byte(adapter, SDIO_REG_HISR, v32);

sd_int_dpc(adapter);
- } else {
}
}

--
2.20.1

2021-04-06 05:41:47

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 05/10] staging: rtl8723bs: remove empty #ifdef blocks after RT_TRACE deletion

Remove all empty #ifdef blocks left empty after
RT_TRACE macro deletion.

Suggested-by: Joe Perches <[email protected]>
Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index 9c544b5888d0..9fdaefe6e183 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -2465,8 +2465,6 @@ 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 DEBUG
-#endif
}

for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) {
@@ -2474,9 +2472,6 @@ void Hal_EfuseParseTxPowerInfo_8723B(
pHalData->OFDM_24G_Diff[rfPath][TxCount] = pwrInfo24G.OFDM_Diff[rfPath][TxCount];
pHalData->BW20_24G_Diff[rfPath][TxCount] = pwrInfo24G.BW20_Diff[rfPath][TxCount];
pHalData->BW40_24G_Diff[rfPath][TxCount] = pwrInfo24G.BW40_Diff[rfPath][TxCount];
-
-#ifdef DEBUG
-#endif
}
}

--
2.20.1

2021-04-06 05:46:56

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 08/10] staging: rtl8723bs: rewrite comparisons to null

fix the following post-commit hook checkpatch issues:

CHECK: Comparison to NULL could be written "!pwep"
147: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:442:
+ if (pwep == NULL)

CHECK: Comparison to NULL could be written "!skb"
226: FILE: drivers/staging/rtl8723bs/os_dep/recv_linux.c:204:
+ if (skb == NULL)

CHECK: Comparison to NULL could be written "!dvobj"
275: FILE: drivers/staging/rtl8723bs/os_dep/sdio_intf.c:398:
+ if (dvobj == NULL)

Suggested-by: Joe Perches <[email protected]>
Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 +-
drivers/staging/rtl8723bs/os_dep/recv_linux.c | 2 +-
drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 03360af0645d..297287cff5be 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -439,7 +439,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
wep_key_len = wep_key_len <= 5 ? 5 : 13;
wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial);
pwep = kzalloc(wep_total_len, GFP_KERNEL);
- if (pwep == NULL)
+ if (!pwep)
goto exit;

pwep->KeyLength = wep_key_len;
diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c
index 63a7e7fe2bb5..975aceb7b45b 100644
--- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c
@@ -201,7 +201,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame
pfree_recv_queue = &(precvpriv->free_recv_queue);

skb = precv_frame->u.hdr.pkt;
- if (skb == NULL)
+ if (!skb)
goto _recv_indicatepkt_drop;

skb->data = precv_frame->u.hdr.rx_data;
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index f8e1d15f54ef..deba03ad6c6e 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -395,7 +395,7 @@ static int rtw_drv_init(
struct dvobj_priv *dvobj;

dvobj = sdio_dvobj_init(func);
- if (dvobj == NULL)
+ if (!dvobj)
goto exit;

if1 = rtw_sdio_if1_init(dvobj, id);
--
2.20.1

2021-04-06 05:53:22

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 09/10] staging: rtl8723bs: remove empty for cycles

remove for-cycles left empty after RT_TRACE deletion
and unused index variables

Suggested-by: Joe Perches <[email protected]>
Signed-off-by: Fabio Aiuto <[email protected]>
---
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index 4c94202ac209..eaa9f9e2e6a4 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -3466,7 +3466,6 @@ s32 c2h_handler_8723b(struct adapter *padapter, u8 *buf)
{
struct c2h_evt_hdr_88xx *pC2hEvent = (struct c2h_evt_hdr_88xx *)buf;
s32 ret = _SUCCESS;
- u8 index = 0;

if (!pC2hEvent) {
DBG_8192C("%s(): pC2hEventis NULL\n", __func__);
@@ -3491,8 +3490,6 @@ s32 c2h_handler_8723b(struct adapter *padapter, u8 *buf)
break;

case C2H_HW_INFO_EXCH:
- for (index = 0; index < pC2hEvent->plen; index++) {
- }
break;

case C2H_8723B_BT_INFO:
@@ -3513,8 +3510,6 @@ s32 c2h_handler_8723b(struct adapter *padapter, u8 *buf)

static void process_c2h_event(struct adapter *padapter, struct c2h_evt_hdr_t *pC2hEvent, u8 *c2hBuf)
{
- u8 index = 0;
-
if (!c2hBuf) {
DBG_8192C("%s c2hbuff is NULL\n", __func__);
return;
@@ -3537,8 +3532,6 @@ static void process_c2h_event(struct adapter *padapter, struct c2h_evt_hdr_t *pC
break;

case C2H_HW_INFO_EXCH:
- for (index = 0; index < pC2hEvent->CmdLen; index++) {
- }
break;

case C2H_8723B_BT_INFO:
--
2.20.1

2021-04-06 06:02:03

by Fabio Aiuto

[permalink] [raw]
Subject: [PATCH 10/10] staging: rtl8723bs: remove commented code block

remove commented 5G code block in hal/hal_com_phycfg.c
which contained removed RT_TRACE log

as reported in the driver's TODO file:

- find and remove remaining code valid only for 5 GHz.
Most of the obvious ones have been removed,
but things like channel > 14 still exist.

so just removed obsolete commented code.

Suggested-by: Joe Perches <[email protected]>
Signed-off-by: Fabio Aiuto <[email protected]>
---
.../staging/rtl8723bs/hal/hal_com_phycfg.c | 19 -------------------
1 file changed, 19 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
index f52cc4e7a6e6..a7ecdf501a14 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
@@ -1780,25 +1780,6 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,
DBG_871X("No power limit table of the specified band\n");
}

- /* combine 5G VHT & HT rate */
- /* 5G 20M and 40M HT and VHT can cross reference */
- /*
- if (band_type == BAND_ON_5G && pwr_lmt == MAX_POWER_INDEX) {
- if (idx_bandwidth == 0 || idx_bandwidth == 1) {
- idx_band, idx_bandwidth,
- idx_rate_sctn, rf_path));
- if (idx_rate_sctn == 2)
- pwr_lmt = hal_data->TxPwrLimit_5G[idx_regulation][idx_bandwidth][4][idx_channel][rf_path];
- else if (idx_rate_sctn == 4)
- pwr_lmt = hal_data->TxPwrLimit_5G[idx_regulation][idx_bandwidth][2][idx_channel][rf_path];
- else if (idx_rate_sctn == 3)
- pwr_lmt = hal_data->TxPwrLimit_5G[idx_regulation][idx_bandwidth][5][idx_channel][rf_path];
- else if (idx_rate_sctn == 5)
- pwr_lmt = hal_data->TxPwrLimit_5G[idx_regulation][idx_bandwidth][3][idx_channel][rf_path];
- }
- }
- */
-
/* DBG_871X("TxPwrLmt[Regulation %d][Band %d][BW %d][RFPath %d][Rate 0x%x][Chnl %d] = %d\n", */
/* idx_regulation, hal_data->CurrentBandType, bandwidth, rf_path, data_rate, channel, pwr_lmt); */
return pwr_lmt;
--
2.20.1