2021-05-19 11:53:55

by Desmond Cheong Zhi Xi

[permalink] [raw]
Subject: [PATCH v2 0/7] Staging: rtl8723bs: fix warnings in HalBtc8723b1Ant.c

This patchset fixes 134 checkpatch.pl warnings in the file drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c

Although checkpatch.pl reports a large number of checks, these are for issues that were present in the original code. In fact, in the process of fixing warnings, the total number of checks decreased from 548 to 545.

All patches are syntax fixes and no logic is changed. As there are a lot of different warnings, to make things easier to review, each patch addresses a different set of warnings in the following order:

- braces {} are not necessary for any arm of this statement
- please, no space before tabs
- suspect code indent for conditional statements
- Statements should start on a tabstop (this type of warning is solved alongside the previous warning type in the same patch because the fix for one warning addresses the other)
- Comparisons should place the constant on the right side of the test
- Missing a blank line after declarations
- Avoid unnecessary line continuations
- Block comments use * on subsequent lines

Change in v2:
- Patch 7: Remove dead code inside block comment instead of changing the comment formatting, as suggested by Dan Carpenter

Desmond Cheong Zhi Xi (7):
Staging: rtl8723bs: remove unnecessary braces in HalBtc8723b1Ant.c
Staging: rtl8723bs: fix spaces in HalBtc8723b1Ant.c
Staging: rtl8723bs: fix indentation in HalBtc8723b1Ant.c
Staging: rtl8723bs: fix comparison formatting in HalBtc8723b1Ant.c
Staging: rtl8723bs: add missing blank line in HalBtc8723b1Ant.c
Staging: rtl8723bs: fix line continuations in HalBtc8723b1Ant.c
Staging: rtl8723bs: remove dead code in HalBtc8723b1Ant.c

.../staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 333 ++++++++----------
1 file changed, 154 insertions(+), 179 deletions(-)

--
2.25.1



2021-05-19 12:03:35

by Desmond Cheong Zhi Xi

[permalink] [raw]
Subject: [PATCH v2 2/7] Staging: rtl8723bs: fix spaces in HalBtc8723b1Ant.c

This commit fixes the following checkpatch.pl errors:

WARNING: please, no space before tabs
+^I/* ^IRx Aggregation related setting */$

WARNING: please, no space before tabs
+^Iu8 ^IH2C_Parameter[1] = {0};$

WARNING: please, no space before tabs
+^Iu8 ^IH2C_Parameter[6] = {0};$

WARNING: please, no space before tabs
+^I/* u32 ^I^IfwVer = 0; */$

WARNING: please, no space before tabs
+/* ^ISoftware Coex Mechanism start */$

WARNING: please, no space before tabs
+/* ^INon-Software Coex Mechanism start */$

WARNING: please, no space before tabs
+^I/* ^IBIT0: "0" for no antenna inverse; "1" for antenna inverse */$

WARNING: please, no space before tabs
+^I/* ^IBIT1: "0" for internal switch; "1" for external switch */$

WARNING: please, no space before tabs
+^I/* ^IBIT2: "0" for one antenna; "1" for two antenna */$

Signed-off-by: Desmond Cheong Zhi Xi <[email protected]>
---
.../staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
index 85bf45cabecd..49f37aa16cc4 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
@@ -231,7 +231,7 @@ static void halbtc8723b1ant_LimitedRx(
u8 rxAggSize = aggBufSize;

/* */
- /* Rx Aggregation related setting */
+ /* Rx Aggregation related setting */
/* */
pBtCoexist->fBtcSet(
pBtCoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, &bRejectRxAgg
@@ -250,7 +250,7 @@ static void halbtc8723b1ant_LimitedRx(

static void halbtc8723b1ant_QueryBtInfo(struct btc_coexist *pBtCoexist)
{
- u8 H2C_Parameter[1] = {0};
+ u8 H2C_Parameter[1] = {0};

pCoexSta->bC2hBtInfoReqSent = true;

@@ -606,7 +606,7 @@ static void halbtc8723b1ant_SetSwPenaltyTxRateAdaptive(
struct btc_coexist *pBtCoexist, bool bLowPenaltyRa
)
{
- u8 H2C_Parameter[6] = {0};
+ u8 H2C_Parameter[6] = {0};

H2C_Parameter[0] = 0x6; /* opCode, 0x6 = Retry_Penalty */

@@ -1038,7 +1038,7 @@ static void halbtc8723b1ant_PsTdma(
u8 rssiAdjustVal = 0;
u8 psTdmaByte4Val = 0x50, psTdmaByte0Val = 0x51, psTdmaByte3Val = 0x10;
s8 nWiFiDurationAdjust = 0x0;
- /* u32 fwVer = 0; */
+ /* u32 fwVer = 0; */

pCoexDm->bCurPsTdmaOn = bTurnOn;
pCoexDm->curPsTdma = type;
@@ -1575,13 +1575,13 @@ static void halbtc8723b1ant_PowerSaveState(

/* */
/* */
-/* Software Coex Mechanism start */
+/* Software Coex Mechanism start */
/* */
/* */

/* */
/* */
-/* Non-Software Coex Mechanism start */
+/* Non-Software Coex Mechanism start */
/* */
/* */
static void halbtc8723b1ant_ActionWifiMultiPort(struct btc_coexist *pBtCoexist)
@@ -2166,9 +2166,9 @@ void EXhalbtc8723b1ant_PowerOnSetting(struct btc_coexist *pBtCoexist)
/* */
/* S0 or S1 setting and Local register setting(By the setting fw can get ant number, S0/S1, ... info) */
/* Local setting bit define */
- /* BIT0: "0" for no antenna inverse; "1" for antenna inverse */
- /* BIT1: "0" for internal switch; "1" for external switch */
- /* BIT2: "0" for one antenna; "1" for two antenna */
+ /* BIT0: "0" for no antenna inverse; "1" for antenna inverse */
+ /* BIT1: "0" for internal switch; "1" for external switch */
+ /* BIT2: "0" for one antenna; "1" for two antenna */
/* NOTE: here default all internal switch and 1-antenna ==> BIT1 = 0 and BIT2 = 0 */
if (pBtCoexist->chipInterface == BTC_INTF_USB) {
/* fixed at S0 for USB interface */
--
2.25.1


2021-05-19 12:04:29

by Desmond Cheong Zhi Xi

[permalink] [raw]
Subject: [PATCH v2 3/7] Staging: rtl8723bs: fix indentation in HalBtc8723b1Ant.c

This commit fixes the following checkpatch.pl errors:

WARNING: suspect code indent for conditional statements (32, 33)
+ if (nCCKLockCounter < 5)
+ nCCKLockCounter++;

WARNING: suspect code indent for conditional statements (32, 33)
+ if (nCCKLockCounter > 0)
+ nCCKLockCounter--;

WARNING: suspect code indent for conditional statements (24, 26)
+ if (nCCKLockCounter > 0)
+ nCCKLockCounter--;

WARNING: suspect code indent for conditional statements (16, 17)
+ if (nCCKLockCounter >= 5)
+ pCoexSta->bCCKLock = true;

WARNING: suspect code indent for conditional statements (16, 17)
+ else
+ pCoexSta->bCCKLock = false;

WARNING: suspect code indent for conditional statements (16, 17)
+ if (nCCKLockCounter == 0)
+ pCoexSta->bCCKLock = false;

WARNING: suspect code indent for conditional statements (16, 17)
+ else
+ pCoexSta->bCCKLock = true;

WARNING: suspect code indent for conditional statements (16, 25)
+ if (bScan || bLink || bRoam) {
+ if (bScan)

WARNING: Statements should start on a tabstop
+ if (bScan)

WARNING: Statements should start on a tabstop
+ else

Signed-off-by: Desmond Cheong Zhi Xi <[email protected]>
---
.../staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
index 49f37aa16cc4..63d0eec572ec 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
@@ -361,15 +361,15 @@ static void halbtc8723b1ant_MonitorWiFiCtr(struct btc_coexist *pBtCoexist)
)
) {
if (nCCKLockCounter < 5)
- nCCKLockCounter++;
+ nCCKLockCounter++;
} else {
if (nCCKLockCounter > 0)
- nCCKLockCounter--;
+ nCCKLockCounter--;
}

} else {
if (nCCKLockCounter > 0)
- nCCKLockCounter--;
+ nCCKLockCounter--;
}
} else {
if (nCCKLockCounter > 0)
@@ -379,14 +379,14 @@ static void halbtc8723b1ant_MonitorWiFiCtr(struct btc_coexist *pBtCoexist)
if (!pCoexSta->bPreCCKLock) {

if (nCCKLockCounter >= 5)
- pCoexSta->bCCKLock = true;
+ pCoexSta->bCCKLock = true;
else
- pCoexSta->bCCKLock = false;
+ pCoexSta->bCCKLock = false;
} else {
if (nCCKLockCounter == 0)
- pCoexSta->bCCKLock = false;
+ pCoexSta->bCCKLock = false;
else
- pCoexSta->bCCKLock = true;
+ pCoexSta->bCCKLock = true;
}

pCoexSta->bPreCCKLock = pCoexSta->bCCKLock;
@@ -2084,9 +2084,9 @@ static void halbtc8723b1ant_RunCoexistMechanism(struct btc_coexist *pBtCoexist)
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam);

if (bScan || bLink || bRoam) {
- if (bScan)
+ if (bScan)
halbtc8723b1ant_ActionWifiNotConnectedScan(pBtCoexist);
- else
+ else
halbtc8723b1ant_ActionWifiNotConnectedAssoAuth(pBtCoexist);
} else
halbtc8723b1ant_ActionWifiNotConnected(pBtCoexist);
--
2.25.1


2021-05-19 12:04:56

by Desmond Cheong Zhi Xi

[permalink] [raw]
Subject: [PATCH v2 5/7] Staging: rtl8723bs: add missing blank line in HalBtc8723b1Ant.c

This commit fixes the following checkpatch.pl warning:

WARNING: Missing a blank line after declarations
+ struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo;
+ halbtc8723b1ant_BtRssiState(2, 28, 0);

Signed-off-by: Desmond Cheong Zhi Xi <[email protected]>
---
drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
index 97831d04959b..cf36a7de4735 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
@@ -1664,6 +1664,7 @@ static void halbtc8723b1ant_ActionWifiConnectedBtAclBusy(
)
{
struct btc_bt_link_info *pBtLinkInfo = &pBtCoexist->btLinkInfo;
+
halbtc8723b1ant_BtRssiState(2, 28, 0);

if ((pCoexSta->lowPriorityRx >= 1000) && (pCoexSta->lowPriorityRx != 65535))
--
2.25.1


2021-05-19 12:04:58

by Desmond Cheong Zhi Xi

[permalink] [raw]
Subject: [PATCH v2 4/7] Staging: rtl8723bs: fix comparison formatting in HalBtc8723b1Ant.c

This commit fixes the following checkpatch.pl warnings:

WARNING: Comparisons should place the constant on the right side of the test
+ BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ if (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE == wifiStatus) {

WARNING: Comparisons should place the constant on the right side of the test
+ if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) {

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) {

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus &&

WARNING: Comparisons should place the constant on the right side of the test
+ if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) {

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) {

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ ((bWifiUnderBMode) ? "11b" : ((BTC_WIFI_BW_LEGACY == wifiBw) ? "11bg" : (((BTC_WIFI_BW_HT40 == wifiBw) ? "HT40" : "HT20")))),

WARNING: Comparisons should place the constant on the right side of the test
+ ((!bWifiBusy) ? "idle" : ((BTC_WIFI_TRAFFIC_TX == wifiTrafficDir) ? "uplink" : "downlink")),

WARNING: Comparisons should place the constant on the right side of the test
+ ((pBtCoexist->btInfo.bBtDisabled) ? ("disabled") : ((pCoexSta->bC2hBtInquiryPage) ? ("inquiry/page scan") : ((BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) ? "non-connected idle" :

WARNING: Comparisons should place the constant on the right side of the test
+ ((BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) ? "connected-idle" : "busy")))),

WARNING: Comparisons should place the constant on the right side of the test
+ if (BTC_IPS_ENTER == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ } else if (BTC_IPS_LEAVE == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ if (BTC_LPS_ENABLE == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ } else if (BTC_LPS_DISABLE == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ if (BTC_SCAN_START == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ if (BTC_SCAN_START == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ } else if (BTC_SCAN_FINISH == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ if (BTC_ASSOCIATE_START == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ if (BTC_ASSOCIATE_START == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ } else if (BTC_ASSOCIATE_FINISH == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ if (BTC_MEDIA_CONNECT == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ if ((BTC_MEDIA_CONNECT == type) && (wifiCentralChnl <= 14)) {

WARNING: Comparisons should place the constant on the right side of the test
+ if (BTC_WIFI_BW_HT40 == wifiBw)

WARNING: Comparisons should place the constant on the right side of the test
+ BTC_PACKET_DHCP == type ||

WARNING: Comparisons should place the constant on the right side of the test
+ BTC_PACKET_EAPOL == type ||

WARNING: Comparisons should place the constant on the right side of the test
+ BTC_PACKET_ARP == type

WARNING: Comparisons should place the constant on the right side of the test
+ if (BTC_PACKET_ARP == type) {

WARNING: Comparisons should place the constant on the right side of the test
+ BTC_PACKET_DHCP == type ||

WARNING: Comparisons should place the constant on the right side of the test
+ BTC_PACKET_EAPOL == type ||

WARNING: Comparisons should place the constant on the right side of the test
+ ((BTC_PACKET_ARP == type) && (pCoexSta->bWiFiIsHighPriTask))

WARNING: Comparisons should place the constant on the right side of the test
+ if (BT_INFO_SRC_8723B_1ANT_WIFI_FW != rspSource) {

WARNING: Comparisons should place the constant on the right side of the test
+ if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY != pCoexDm->btStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||

WARNING: Comparisons should place the constant on the right side of the test
+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)

WARNING: Comparisons should place the constant on the right side of the test
+ if (BTC_WIFI_PNP_SLEEP == pnpState) {

WARNING: Comparisons should place the constant on the right side of the test
+ } else if (BTC_WIFI_PNP_WAKE_UP == pnpState) {

Signed-off-by: Desmond Cheong Zhi Xi <[email protected]>
---
.../staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 112 +++++++++---------
1 file changed, 56 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
index 63d0eec572ec..97831d04959b 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
@@ -1317,35 +1317,35 @@ static bool halbtc8723b1ant_IsCommonAction(struct btc_coexist *pBtCoexist)

if (
!bWifiConnected &&
- BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus
+ pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE
) {
/* halbtc8723b1ant_SwMechanism(pBtCoexist, false); */

bCommon = true;
} else if (
bWifiConnected &&
- (BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE)
) {
/* halbtc8723b1ant_SwMechanism(pBtCoexist, false); */

bCommon = true;
} else if (
!bWifiConnected &&
- (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE)
) {
/* halbtc8723b1ant_SwMechanism(pBtCoexist, false); */

bCommon = true;
} else if (
bWifiConnected &&
- (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE)
) {
/* halbtc8723b1ant_SwMechanism(pBtCoexist, false); */

bCommon = true;
} else if (
!bWifiConnected &&
- (BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE != pCoexDm->btStatus)
+ (pCoexDm->btStatus != BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE)
) {
/* halbtc8723b1ant_SwMechanism(pBtCoexist, false); */

@@ -1367,9 +1367,9 @@ static void halbtc8723b1ant_TdmaDurationAdjustForAcl(
u8 retryCount = 0, btInfoExt;

if (
- (BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN == wifiStatus) ||
- (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN == wifiStatus) ||
- (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT == wifiStatus)
+ (wifiStatus == BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN) ||
+ (wifiStatus == BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN) ||
+ (wifiStatus == BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT)
) {
if (
pCoexDm->curPsTdma != 1 &&
@@ -1676,7 +1676,7 @@ static void halbtc8723b1ant_ActionWifiConnectedBtAclBusy(
pCoexDm->bAutoTdmaAdjust = false;
return;
} else if (pBtLinkInfo->bA2dpOnly) { /* A2DP */
- if (BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE == wifiStatus) {
+ if (wifiStatus == BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE) {
halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 32);
halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
pCoexDm->bAutoTdmaAdjust = false;
@@ -1731,7 +1731,7 @@ static void halbtc8723b1ant_ActionWifiNotConnectedScan(
halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);

/* tdma and coex table */
- if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) {
+ if (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_BUSY) {
if (pBtLinkInfo->bA2dpExist) {
halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 32);
halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
@@ -1743,8 +1743,8 @@ static void halbtc8723b1ant_ActionWifiNotConnectedScan(
halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
}
} else if (
- (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_SCO_BUSY) ||
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY)
) {
halbtc8723b1ant_ActionBtScoHidOnlyBusy(
pBtCoexist, BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN
@@ -1788,7 +1788,7 @@ static void halbtc8723b1ant_ActionWifiConnectedScan(struct btc_coexist *pBtCoexi
halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);

/* tdma and coex table */
- if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) {
+ if (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_BUSY) {
if (pBtLinkInfo->bA2dpExist) {
halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 32);
halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
@@ -1800,8 +1800,8 @@ static void halbtc8723b1ant_ActionWifiConnectedScan(struct btc_coexist *pBtCoexi
halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 4);
}
} else if (
- (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_SCO_BUSY) ||
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY)
) {
halbtc8723b1ant_ActionBtScoHidOnlyBusy(
pBtCoexist, BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN
@@ -1867,7 +1867,7 @@ static void halbtc8723b1ant_ActionWifiConnected(struct btc_coexist *pBtCoexist)
/* power save state */
if (
!bApEnable &&
- BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus &&
+ pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_BUSY &&
!pBtCoexist->btLinkInfo.bHidOnly
) {
if (pBtCoexist->btLinkInfo.bA2dpOnly) { /* A2DP */
@@ -1898,14 +1898,14 @@ static void halbtc8723b1ant_ActionWifiConnected(struct btc_coexist *pBtCoexist)

/* tdma and coex table */
if (!bWifiBusy) {
- if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) {
+ if (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_BUSY) {
halbtc8723b1ant_ActionWifiConnectedBtAclBusy(
pBtCoexist,
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE
);
} else if (
- (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_SCO_BUSY) ||
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY)
) {
halbtc8723b1ant_ActionBtScoHidOnlyBusy(pBtCoexist,
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE);
@@ -1918,14 +1918,14 @@ static void halbtc8723b1ant_ActionWifiConnected(struct btc_coexist *pBtCoexist)
halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7);
}
} else {
- if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) {
+ if (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_BUSY) {
halbtc8723b1ant_ActionWifiConnectedBtAclBusy(
pBtCoexist,
BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY
);
} else if (
- (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_SCO_BUSY) ||
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY)
) {
halbtc8723b1ant_ActionBtScoHidOnlyBusy(
pBtCoexist,
@@ -2010,9 +2010,9 @@ static void halbtc8723b1ant_RunCoexistMechanism(struct btc_coexist *pBtCoexist)
return;

if (
- (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_BUSY) ||
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_SCO_BUSY) ||
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY)
){
bIncreaseScanDevNum = true;
}
@@ -2361,8 +2361,8 @@ void EXhalbtc8723b1ant_DisplayCoexInfo(struct btc_coexist *pBtCoexist)
BT_TMP_BUF_SIZE,
"\r\n %-35s = %s / %s/ %s/ AP =%d/ %s ", "Wifi status", \
(bWifiUnder5G ? "5G" : "2.4G"),
- ((bWifiUnderBMode) ? "11b" : ((BTC_WIFI_BW_LEGACY == wifiBw) ? "11bg" : (((BTC_WIFI_BW_HT40 == wifiBw) ? "HT40" : "HT20")))),
- ((!bWifiBusy) ? "idle" : ((BTC_WIFI_TRAFFIC_TX == wifiTrafficDir) ? "uplink" : "downlink")),
+ ((bWifiUnderBMode) ? "11b" : ((wifiBw == BTC_WIFI_BW_LEGACY) ? "11bg" : (((wifiBw == BTC_WIFI_BW_HT40) ? "HT40" : "HT20")))),
+ ((!bWifiBusy) ? "idle" : ((wifiTrafficDir == BTC_WIFI_TRAFFIC_TX) ? "uplink" : "downlink")),
pCoexSta->nScanAPNum,
(pCoexSta->bCCKLock) ? "Lock" : "noLock"
);
@@ -2389,8 +2389,8 @@ void EXhalbtc8723b1ant_DisplayCoexInfo(struct btc_coexist *pBtCoexist)
cliBuf,
BT_TMP_BUF_SIZE,
"\r\n %-35s = [%s/ %d/ %d/ %d] ", "BT [status/ rssi/ retryCnt/ popCnt]", \
- ((pBtCoexist->btInfo.bBtDisabled) ? ("disabled") : ((pCoexSta->bC2hBtInquiryPage) ? ("inquiry/page scan") : ((BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) ? "non-connected idle" :
- ((BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) ? "connected-idle" : "busy")))),
+ ((pBtCoexist->btInfo.bBtDisabled) ? ("disabled") : ((pCoexSta->bC2hBtInquiryPage) ? ("inquiry/page scan") : ((pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE) ? "non-connected idle" :
+ ((pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE) ? "connected-idle" : "busy")))),
pCoexSta->btRssi, pCoexSta->btRetryCnt, pCoexSta->popEventCnt
);
CL_PRINTF(cliBuf);
@@ -2680,13 +2680,13 @@ void EXhalbtc8723b1ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type)
if (pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
return;

- if (BTC_IPS_ENTER == type) {
+ if (type == BTC_IPS_ENTER) {
pCoexSta->bUnderIps = true;

halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, false, 0);
halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0);
halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, false, true);
- } else if (BTC_IPS_LEAVE == type) {
+ } else if (type == BTC_IPS_LEAVE) {
pCoexSta->bUnderIps = false;

halbtc8723b1ant_InitHwConfig(pBtCoexist, false, false);
@@ -2700,9 +2700,9 @@ void EXhalbtc8723b1ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type)
if (pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
return;

- if (BTC_LPS_ENABLE == type)
+ if (type == BTC_LPS_ENABLE)
pCoexSta->bUnderLps = true;
- else if (BTC_LPS_DISABLE == type)
+ else if (type == BTC_LPS_DISABLE)
pCoexSta->bUnderLps = false;
}

@@ -2720,7 +2720,7 @@ void EXhalbtc8723b1ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type)
if (pBtCoexist->bManualControl || pBtCoexist->bStopCoexDm)
return;

- if (BTC_SCAN_START == type) {
+ if (type == BTC_SCAN_START) {
pCoexSta->bWiFiIsHighPriTask = true;

halbtc8723b1ant_PsTdma(pBtCoexist, FORCE_EXEC, false, 8); /* Force antenna setup for no scan result issue */
@@ -2763,12 +2763,12 @@ void EXhalbtc8723b1ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type)
return;
}

- if (BTC_SCAN_START == type) {
+ if (type == BTC_SCAN_START) {
if (!bWifiConnected) /* non-connected scan */
halbtc8723b1ant_ActionWifiNotConnectedScan(pBtCoexist);
else /* wifi is connected */
halbtc8723b1ant_ActionWifiConnectedScan(pBtCoexist);
- } else if (BTC_SCAN_FINISH == type) {
+ } else if (type == BTC_SCAN_FINISH) {
if (!bWifiConnected) /* non-connected scan */
halbtc8723b1ant_ActionWifiNotConnected(pBtCoexist);
else
@@ -2791,7 +2791,7 @@ void EXhalbtc8723b1ant_ConnectNotify(struct btc_coexist *pBtCoexist, u8 type)
)
return;

- if (BTC_ASSOCIATE_START == type) {
+ if (type == BTC_ASSOCIATE_START) {
pCoexSta->bWiFiIsHighPriTask = true;
pCoexDm->nArpCnt = 0;
} else {
@@ -2817,9 +2817,9 @@ void EXhalbtc8723b1ant_ConnectNotify(struct btc_coexist *pBtCoexist, u8 type)
return;
}

- if (BTC_ASSOCIATE_START == type) {
+ if (type == BTC_ASSOCIATE_START) {
halbtc8723b1ant_ActionWifiNotConnectedAssoAuth(pBtCoexist);
- } else if (BTC_ASSOCIATE_FINISH == type) {
+ } else if (type == BTC_ASSOCIATE_FINISH) {
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected);
if (!bWifiConnected) /* non-connected scan */
halbtc8723b1ant_ActionWifiNotConnected(pBtCoexist);
@@ -2842,7 +2842,7 @@ void EXhalbtc8723b1ant_MediaStatusNotify(struct btc_coexist *pBtCoexist, u8 type
)
return;

- if (BTC_MEDIA_CONNECT == type) {
+ if (type == BTC_MEDIA_CONNECT) {
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_B_MODE, &bWifiUnderBMode);

/* Set CCK Tx/Rx high Pri except 11b mode */
@@ -2867,13 +2867,13 @@ void EXhalbtc8723b1ant_MediaStatusNotify(struct btc_coexist *pBtCoexist, u8 type

/* only 2.4G we need to inform bt the chnl mask */
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_CENTRAL_CHNL, &wifiCentralChnl);
- if ((BTC_MEDIA_CONNECT == type) && (wifiCentralChnl <= 14)) {
+ if ((type == BTC_MEDIA_CONNECT) && (wifiCentralChnl <= 14)) {
/* H2C_Parameter[0] = 0x1; */
H2C_Parameter[0] = 0x0;
H2C_Parameter[1] = wifiCentralChnl;
pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw);

- if (BTC_WIFI_BW_HT40 == wifiBw)
+ if (wifiBw == BTC_WIFI_BW_HT40)
H2C_Parameter[2] = 0x30;
else
H2C_Parameter[2] = 0x20;
@@ -2902,11 +2902,11 @@ void EXhalbtc8723b1ant_SpecialPacketNotify(struct btc_coexist *pBtCoexist, u8 ty
return;

if (
- BTC_PACKET_DHCP == type ||
- BTC_PACKET_EAPOL == type ||
- BTC_PACKET_ARP == type
+ type == BTC_PACKET_DHCP ||
+ type == BTC_PACKET_EAPOL ||
+ type == BTC_PACKET_ARP
) {
- if (BTC_PACKET_ARP == type) {
+ if (type == BTC_PACKET_ARP) {
pCoexDm->nArpCnt++;

if (pCoexDm->nArpCnt >= 10) /* if APR PKT > 10 after connect, do not go to ActionWifiConnectedSpecialPacket(pBtCoexist) */
@@ -2946,9 +2946,9 @@ void EXhalbtc8723b1ant_SpecialPacketNotify(struct btc_coexist *pBtCoexist, u8 ty
}

if (
- BTC_PACKET_DHCP == type ||
- BTC_PACKET_EAPOL == type ||
- ((BTC_PACKET_ARP == type) && (pCoexSta->bWiFiIsHighPriTask))
+ type == BTC_PACKET_DHCP ||
+ type == BTC_PACKET_EAPOL ||
+ ((type == BTC_PACKET_ARP) && (pCoexSta->bWiFiIsHighPriTask))
)
halbtc8723b1ant_ActionWifiConnectedSpecialPacket(pBtCoexist);
}
@@ -2975,7 +2975,7 @@ void EXhalbtc8723b1ant_BtInfoNotify(
btInfo = tmpBuf[i];
}

- if (BT_INFO_SRC_8723B_1ANT_WIFI_FW != rspSource) {
+ if (rspSource != BT_INFO_SRC_8723B_1ANT_WIFI_FW) {
pCoexSta->btRetryCnt = pCoexSta->btInfoC2h[rspSource][2] & 0xf;

if (pCoexSta->btRetryCnt >= 1)
@@ -3068,7 +3068,7 @@ void EXhalbtc8723b1ant_BtInfoNotify(
) {
pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_SCO_BUSY;
} else if (btInfo & BT_INFO_8723B_1ANT_B_ACL_BUSY) {
- if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY != pCoexDm->btStatus)
+ if (pCoexDm->btStatus != BT_8723B_1ANT_BT_STATUS_ACL_BUSY)
pCoexDm->bAutoTdmaAdjust = false;

pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_ACL_BUSY;
@@ -3077,9 +3077,9 @@ void EXhalbtc8723b1ant_BtInfoNotify(
}

if (
- (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) ||
- (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_BUSY) ||
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_SCO_BUSY) ||
+ (pCoexDm->btStatus == BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY)
)
bBtBusy = true;
else
@@ -3104,14 +3104,14 @@ void EXhalbtc8723b1ant_HaltNotify(struct btc_coexist *pBtCoexist)

void EXhalbtc8723b1ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState)
{
- if (BTC_WIFI_PNP_SLEEP == pnpState) {
+ if (pnpState == BTC_WIFI_PNP_SLEEP) {
halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0);
halbtc8723b1ant_PsTdma(pBtCoexist, NORMAL_EXEC, false, 0);
halbtc8723b1ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2);
halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, false, true);

pBtCoexist->bStopCoexDm = true;
- } else if (BTC_WIFI_PNP_WAKE_UP == pnpState) {
+ } else if (pnpState == BTC_WIFI_PNP_WAKE_UP) {
pBtCoexist->bStopCoexDm = false;
halbtc8723b1ant_InitHwConfig(pBtCoexist, false, false);
halbtc8723b1ant_InitCoexDm(pBtCoexist);
--
2.25.1


2021-05-19 12:05:40

by Desmond Cheong Zhi Xi

[permalink] [raw]
Subject: [PATCH v2 7/7] Staging: rtl8723bs: remove dead code in HalBtc8723b1Ant.c

This commit removes dead code to resolve the following checkpatch.pl
warning:

WARNING: Block comments use * on subsequent lines
+ /*
+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Latest error condition(should be 0)", \

Signed-off-by: Desmond Cheong Zhi Xi <[email protected]>
---
drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
index cc7f558903ac..e5464a27c052 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
+++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
@@ -2509,12 +2509,6 @@ void EXhalbtc8723b1ant_DisplayCoexInfo(struct btc_coexist *pBtCoexist)
CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d", "IgnWlanAct",
pCoexDm->bCurIgnoreWlanAct);
CL_PRINTF(cliBuf);
-
- /*
- CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Latest error condition(should be 0)", \
- pCoexDm->errorCondition);
- CL_PRINTF(cliBuf);
- */
}

/* Hw setting */
--
2.25.1


2021-05-19 16:26:27

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v2 0/7] Staging: rtl8723bs: fix warnings in HalBtc8723b1Ant.c

On Tue, May 18, 2021 at 12:41:12AM -0400, Desmond Cheong Zhi Xi wrote:
> This patchset fixes 134 checkpatch.pl warnings in the file drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c
>
> Although checkpatch.pl reports a large number of checks, these are for issues that were present in the original code. In fact, in the process of fixing warnings, the total number of checks decreased from 548 to 545.
>
> All patches are syntax fixes and no logic is changed. As there are a lot of different warnings, to make things easier to review, each patch addresses a different set of warnings in the following order:
>
> - braces {} are not necessary for any arm of this statement
> - please, no space before tabs
> - suspect code indent for conditional statements
> - Statements should start on a tabstop (this type of warning is solved alongside the previous warning type in the same patch because the fix for one warning addresses the other)
> - Comparisons should place the constant on the right side of the test
> - Missing a blank line after declarations
> - Avoid unnecessary line continuations
> - Block comments use * on subsequent lines
>
> Change in v2:
> - Patch 7: Remove dead code inside block comment instead of changing the comment formatting, as suggested by Dan Carpenter

Thanks!

Reviewed-by: Dan Carpenter <[email protected]>

regards,
dan carpenter