staging: rtl8192e: fix bool comparison in expressions
PATCH 1/1 staging: rtl8192e: fix bool comparison in expressions
There are certain conditional expressions in rtl8192e, where a boolean variable is compared with true/false, in forms such as (foo == true) or (false != bar), which does not comply with checkpatch.pl (CHECK:BOOL_COMPARISON), according to which boolean variables should be themselves used in the condition, rather than comparing with true/false
E.g. in drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c, "if (Type == true)" can be replaced with: "if (Type)"
Replace all such expressions with the bool variables appropriately
---
- the changes made are compile tested
- the patch applies perfectly over next-20201204
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 4 ++-- drivers/staging/rtl8192e/rtllib_rx.c | 4 ++-- drivers/staging/rtl8192e/rtllib_tx.c | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +2 -2
@@ -129,9 +129,9 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) RegRCR =rtl92e_readl (dev,RCR ); priv->ReceiveConfig = RegRCR; -if (Type == true) +if (Type) RegRCR |= (RCR_CBSSID ); -else if (Type == false) +else if (!Type) RegRCR &= (~RCR_CBSSID );rtl92e_writel (dev,RCR , RegRCR);
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +2 -2
@@ -1389,7 +1389,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)rtl92e_dm_watchdog (dev); -if (rtllib_act_scanning (priv->rtllib, false) == false) { +if (!rtllib_act_scanning (priv->rtllib, false)) { if ((ieee->iw_mode == IW_MODE_INFRA) && (ieee->state == RTLLIB_NOLINK) && (ieee->eRFPowerState == eRfOn) && !ieee->is_set_key &&
@@ -2471,7 +2471,7 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev, priv->ops = ops; -if (rtl92e_check_adapter (pdev, dev) == false) +if (!rtl92e_check_adapter (pdev, dev)) goto err_unmap; dev->irq = pdev->irq;
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +2 -2
@@ -1765,7 +1765,7 @@ static void _rtl92e_dm_cts_to_self(struct net_device *dev)unsigned long curTxOkCnt =0 ;unsigned long curRxOkCnt =0 ; -if (priv->rtllib->bCTSToSelfEnable != true) { +if (!priv->rtllib->bCTSToSelfEnable) { pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF ;return ; }
@@ -2447,7 +2447,7 @@ static void _rtl92e_dm_dynamic_tx_power(struct net_device *dev)unsigned int txhipower_threshold =0 ;unsigned int txlowpower_threshold =0 ; -if (priv->rtllib->bdynamic_txpower_enable != true) { +if (!priv->rtllib->bdynamic_txpower_enable) { priv->bDynamicTxHighPower = false; priv->bDynamicTxLowPower = false;return ;
drivers/staging/rtl8192e/rtllib_rx.c +2 -2
@@ -924,7 +924,7 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee, sc =le16_to_cpu (hdr->seq_ctl); frag =WLAN_GET_SEQ_FRAG (sc); -if ((ieee->pHTInfo->bCurRxReorderEnable == false) || +if ((!ieee->pHTInfo->bCurRxReorderEnable) || !ieee->current_network.qos_data.active || !IsDataFrame (skb->data) ||IsLegacyDataFrame (skb->data)) {
@@ -1442,7 +1442,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, }/* Indicate packets to upper layer or Rx Reorder */ -if (ieee->pHTInfo->bCurRxReorderEnable == false || pTS ==NULL || +if (!ieee->pHTInfo->bCurRxReorderEnable || pTS ==NULL || bToOtherSTA)rtllib_rx_indicate_pkt_legacy (ieee, rx_stats, rxb, dst, src);else
drivers/staging/rtl8192e/rtllib_tx.c +4 -4
@@ -297,7 +297,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee,netdev_info (ieee->dev,"%s: can't get TS\n" , __func__);return ; } -if (pTxTs->TxAdmittedBARecord.bValid == false) { +if (!pTxTs->TxAdmittedBARecord.bValid) {if (ieee->wpa_ie_len && (ieee->pairwise_key_type ==KEY_TYPE_NA )) { ;
@@ -307,7 +307,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee,TsStartAddBaProcess (ieee, pTxTs); } goto FORCED_AGG_SETTING; - }else if (pTxTs->bUsingBa == false) { + }else if (!pTxTs->bUsingBa) {if (SN_LESS (pTxTs->TxAdmittedBARecord.BaStartSeqCtrl.field.SeqNum, (pTxTs->TxCurSeq+1 )%4096 )) pTxTs->bUsingBa = true;
@@ -365,9 +365,9 @@ static void rtllib_query_HTCapShortGI(struct rtllib_device *ieee,return ; } -if ((pHTInfo->bCurBW40MHz == true) && pHTInfo->bCurShortGI40MHz) +if (pHTInfo->bCurBW40MHz && pHTInfo->bCurShortGI40MHz) tcb_desc->bUseShortGI = true; -else if ((pHTInfo->bCurBW40MHz == false) && pHTInfo->bCurShortGI20MHz) +else if (!pHTInfo->bCurBW40MHz && pHTInfo->bCurShortGI20MHz) tcb_desc->bUseShortGI = true; }
Signature · 6 lines
2.17.1 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 28 lines · Aditya Srivastava
There are certain conditional expressions in rtl8192e, where a boolean variable is compared with true/false, in forms such as (foo == true) or (false != bar), which does not comply with checkpatch.pl (CHECK:
BOOL_COMPARISON), according to which boolean variables should be themselves used in the condition, rather than comparing with true/falseE.g. in
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c, "if (Type == true)" can be replaced with: "if (Type)"Replace all such expressions with the bool variables appropriately
Signed-off-by Aditya Srivastava <[email protected]>---
- the changes made are compile tested
- the patch applies perfectly over next-20201204drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 4 ++-- drivers/staging/rtl8192e/rtllib_rx.c | 4 ++-- drivers/staging/rtl8192e/rtllib_tx.c | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-)drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +0
-0
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) · line 134
Quoted 8 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +2
-2@@ -129,9 +129,9 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) RegRCR =rtl92e_readl (dev,RCR ); priv->ReceiveConfig = RegRCR; -if (Type == true) +if (Type) RegRCR |= (RCR_CBSSID ); -else if (Type == false) +else if (!Type)
Just else here?
Quoted 52 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +0
-0RegRCR &= (~RCR_CBSSID );rtl92e_writel (dev,RCR , RegRCR);drivers/staging/rtl8192e/rtl8192e/rtl_core.c +2
-2@@ -1389,7 +1389,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)rtl92e_dm_watchdog (dev); -if (rtllib_act_scanning (priv->rtllib, false) == false) { +if (!rtllib_act_scanning (priv->rtllib, false)) { if ((ieee->iw_mode == IW_MODE_INFRA) && (ieee->state == RTLLIB_NOLINK) && (ieee->eRFPowerState == eRfOn) && !ieee->is_set_key &&@@ -2471,7 +2471,7 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev, priv->ops = ops; -if (rtl92e_check_adapter (pdev, dev) == false) +if (!rtl92e_check_adapter (pdev, dev)) goto err_unmap; dev->irq = pdev->irq;drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +2
-2@@ -1765,7 +1765,7 @@ static void _rtl92e_dm_cts_to_self(struct net_device *dev)unsigned long curTxOkCnt =0 ;unsigned long curRxOkCnt =0 ; -if (priv->rtllib->bCTSToSelfEnable != true) { +if (!priv->rtllib->bCTSToSelfEnable) { pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF ;return ; }@@ -2447,7 +2447,7 @@ static void _rtl92e_dm_dynamic_tx_power(struct net_device *dev)unsigned int txhipower_threshold =0 ;unsigned int txlowpower_threshold =0 ; -if (priv->rtllib->bdynamic_txpower_enable != true) { +if (!priv->rtllib->bdynamic_txpower_enable) { priv->bDynamicTxHighPower = false; priv->bDynamicTxLowPower = false;return ;drivers/staging/rtl8192e/rtllib_rx.c +0
-0
drivers/staging/rtl8192e/rtllib_rx.c static int rtllib_rx_check_duplicate(struct rtllib_device *ieee, · line 927
Quoted 5 lines
drivers/staging/rtl8192e/rtllib_rx.c +1
-1@@ -924,7 +924,7 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee, sc =le16_to_cpu (hdr->seq_ctl); frag =WLAN_GET_SEQ_FRAG (sc); - if ((ieee->pHTInfo->bCurRxReorderEnable == false) || + if ((!ieee->pHTInfo->bCurRxReorderEnable) ||
No need for brackets. Atleast after you remove check.
drivers/staging/rtl8192e/rtllib_rx.c static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, · line 1446
Quoted 10 lines
drivers/staging/rtl8192e/rtllib_rx.c +1
-1!ieee->current_network.qos_data.active || !IsDataFrame(skb->data) || IsLegacyDataFrame(skb->data)) {@@ -1442,7 +1442,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, }/* Indicate packets to upper layer or Rx Reorder */ -if (ieee->pHTInfo->bCurRxReorderEnable == false || pTS ==NULL || +if (!ieee->pHTInfo->bCurRxReorderEnable || pTS ==NULL || bToOtherSTA)
Now bToOtherSTA would fit same line. It is ok to fix that also.
Quoted 25 lines
drivers/staging/rtl8192e/rtllib_rx.c +0
-0rtllib_rx_indicate_pkt_legacy (ieee, rx_stats, rxb, dst, src); elsedrivers/staging/rtl8192e/rtllib_tx.c +2
-2@@ -297,7 +297,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee,netdev_info (ieee->dev,"%s: can't get TS\n" , __func__);return ; } -if (pTxTs->TxAdmittedBARecord.bValid == false) { +if (!pTxTs->TxAdmittedBARecord.bValid) {if (ieee->wpa_ie_len && (ieee->pairwise_key_type ==KEY_TYPE_NA )) { ;@@ -307,7 +307,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee,TsStartAddBaProcess (ieee, pTxTs); } goto FORCED_AGG_SETTING; - }else if (pTxTs->bUsingBa == false) { + }else if (!pTxTs->bUsingBa) {if (SN_LESS (pTxTs->TxAdmittedBARecord.BaStartSeqCtrl.field.SeqNum, (pTxTs->TxCurSeq+1 )%4096 )) pTxTs->bUsingBa = true;
drivers/staging/rtl8192e/rtllib_tx.c static void rtllib_query_HTCapShortGI(struct rtllib_device *ieee, · line 372
Quoted 10 lines
drivers/staging/rtl8192e/rtllib_tx.c +2
-2@@ -365,9 +365,9 @@ static void rtllib_query_HTCapShortGI(struct rtllib_device *ieee,return ; } -if ((pHTInfo->bCurBW40MHz == true) && pHTInfo->bCurShortGI40MHz) +if (pHTInfo->bCurBW40MHz && pHTInfo->bCurShortGI40MHz) tcb_desc->bUseShortGI = true; -else if ((pHTInfo->bCurBW40MHz == false) && pHTInfo->bCurShortGI20MHz) +else if (!pHTInfo->bCurBW40MHz && pHTInfo->bCurShortGI20MHz) tcb_desc->bUseShortGI = true; }
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
PATCH v2 1/1 staging: rtl8192e: fix bool comparison in expressions
There are certain conditional expressions in rtl8192e, where a boolean variable is compared with true/false, in forms such as (foo == true) or (false != bar), which does not comply with checkpatch.pl (CHECK:BOOL_COMPARISON), according to which boolean variables should be themselves used in the condition, rather than comparing with true/false
E.g. in drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c, "if (Type == true)" can be replaced with: "if (Type)"
Replace all such expressions with the bool variables appropriately
---
- the changes made are compile tested
- the patch applies perfectly over next-20201218
Changes in v2:
- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c: Replace "else if (!Type)" with "else"
- drivers/staging/rtl8192e/rtllib_rx.c: Remove bracket from "(!ieee->pHTInfo->bCurRxReorderEnable)"
- drivers/staging/rtl8192e/rtllib_rx.c: Put bToOtherSTA on previous line
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 4 ++-- drivers/staging/rtl8192e/rtllib_rx.c | 5 ++--- drivers/staging/rtl8192e/rtllib_tx.c | 8 ++++---- 5 files changed, 12 insertions(+), 13 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +2 -2
@@ -129,9 +129,9 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) RegRCR =rtl92e_readl (dev,RCR ); priv->ReceiveConfig = RegRCR; -if (Type == true) +if (Type) RegRCR |= (RCR_CBSSID ); -else if (Type == false) +else RegRCR &= (~RCR_CBSSID );rtl92e_writel (dev,RCR , RegRCR);
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +2 -2
@@ -1389,7 +1389,7 @@ static void _rtl92e_watchdog_wq_cb(void *data)rtl92e_dm_watchdog (dev); -if (rtllib_act_scanning (priv->rtllib, false) == false) { +if (!rtllib_act_scanning (priv->rtllib, false)) { if ((ieee->iw_mode == IW_MODE_INFRA) && (ieee->state == RTLLIB_NOLINK) && (ieee->eRFPowerState == eRfOn) && !ieee->is_set_key &&
@@ -2471,7 +2471,7 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev, priv->ops = ops; -if (rtl92e_check_adapter (pdev, dev) == false) +if (!rtl92e_check_adapter (pdev, dev)) goto err_unmap; dev->irq = pdev->irq;
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +2 -2
@@ -1765,7 +1765,7 @@ static void _rtl92e_dm_cts_to_self(struct net_device *dev)unsigned long curTxOkCnt =0 ;unsigned long curRxOkCnt =0 ; -if (priv->rtllib->bCTSToSelfEnable != true) { +if (!priv->rtllib->bCTSToSelfEnable) { pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF ;return ; }
@@ -2447,7 +2447,7 @@ static void _rtl92e_dm_dynamic_tx_power(struct net_device *dev)unsigned int txhipower_threshold =0 ;unsigned int txlowpower_threshold =0 ; -if (priv->rtllib->bdynamic_txpower_enable != true) { +if (!priv->rtllib->bdynamic_txpower_enable) { priv->bDynamicTxHighPower = false; priv->bDynamicTxLowPower = false;return ;
drivers/staging/rtl8192e/rtllib_rx.c +2 -3
@@ -924,7 +924,7 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee, sc =le16_to_cpu (hdr->seq_ctl); frag =WLAN_GET_SEQ_FRAG (sc); -if ((ieee->pHTInfo->bCurRxReorderEnable == false) || +if (!ieee->pHTInfo->bCurRxReorderEnable || !ieee->current_network.qos_data.active || !IsDataFrame (skb->data) ||IsLegacyDataFrame (skb->data)) {
@@ -1442,8 +1442,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, }/* Indicate packets to upper layer or Rx Reorder */ -if (ieee->pHTInfo->bCurRxReorderEnable == false || pTS ==NULL || - bToOtherSTA) +if (!ieee->pHTInfo->bCurRxReorderEnable || pTS ==NULL || bToOtherSTA)rtllib_rx_indicate_pkt_legacy (ieee, rx_stats, rxb, dst, src);else RxReorderIndicatePacket (ieee, rxb, pTS, SeqNum);
drivers/staging/rtl8192e/rtllib_tx.c +4 -4
@@ -297,7 +297,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee,netdev_info (ieee->dev,"%s: can't get TS\n" , __func__);return ; } -if (pTxTs->TxAdmittedBARecord.bValid == false) { +if (!pTxTs->TxAdmittedBARecord.bValid) {if (ieee->wpa_ie_len && (ieee->pairwise_key_type ==KEY_TYPE_NA )) { ;
@@ -307,7 +307,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee,TsStartAddBaProcess (ieee, pTxTs); } goto FORCED_AGG_SETTING; - }else if (pTxTs->bUsingBa == false) { + }else if (!pTxTs->bUsingBa) {if (SN_LESS (pTxTs->TxAdmittedBARecord.BaStartSeqCtrl.field.SeqNum, (pTxTs->TxCurSeq+1 )%4096 )) pTxTs->bUsingBa = true;
@@ -365,9 +365,9 @@ static void rtllib_query_HTCapShortGI(struct rtllib_device *ieee,return ; } -if ((pHTInfo->bCurBW40MHz == true) && pHTInfo->bCurShortGI40MHz) +if (pHTInfo->bCurBW40MHz && pHTInfo->bCurShortGI40MHz) tcb_desc->bUseShortGI = true; -else if ((pHTInfo->bCurBW40MHz == false) && pHTInfo->bCurShortGI20MHz) +else if (!pHTInfo->bCurBW40MHz && pHTInfo->bCurShortGI20MHz) tcb_desc->bUseShortGI = true; }
Signature · 6 lines
2.17.1 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees