Skip to contentSkip to conversation

Staging: rtl8192u: Simplify if statements

PATCH In review Ksenija Stanojevic 3 participants 3 messages Feb 26, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8192u: Simplify if statements

This patch simplifies if conditions that contain bool variable, using Coccinelle script:
@@
bool x;
symbol true;
@@
- x == true
+ x

---
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/r8192U_core.c +1 -1
index 02707d8..2efcb20 100644
@@ -2822,7 +2822,7 @@ static bool rtl8192_adapter_start(struct net_device *dev)
 		}
 		dm_initialize_txpower_tracking(dev);
 
-		if (priv->bDcut == true) {
+		if (priv->bDcut) {
 			u32 i, TempCCk;
 			u32 tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord);
 			for (i = 0; i < TxBBGainTableLength; i++) {
Signature · 1 line
1.9.1
#1 lore raw
Quoted 8 lines · Ksenija Stanojevic

This patch simplifies if conditions that contain bool variable, using Coccinelle script:
@@
bool x;
symbol true;
@@
- x == true
+ x

Good job on finding the symbol keyword :)

Of course you should also make rules for == false, != true and != false.

julia

Quoted 28 lines
---
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/r8192U_core.c +1 -2
index 02707d8..2efcb20 100644
@@ -2822,7 +2822,7 @@ static bool rtl8192_adapter_start(struct net_device *dev)
 		}
 		dm_initialize_txpower_tracking(dev);
 
-		if (priv->bDcut == true) {
+		if (priv->bDcut) {
 			u32 i, TempCCk;
 			u32 tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord);
 			for (i = 0; i < TxBBGainTableLength; i++) {
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1424977815-7967-1-git-send-email-ksenija.stanojevic%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

maintainer
#2 lore raw
In reply to Ksenija Stanojevic
Quoted 19 lines · Ksenija Stanojevic

This patch simplifies if conditions that contain bool variable, using Coccinelle script:
@@
bool x;
symbol true;
@@
- x == true
+ x

---
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/r8192U_core.c +0 -0
index 02707d8..2efcb20 100644

drivers/staging/rtl8192u/r8192U_core.c static bool rtl8192_adapter_start(struct net_device *dev) · line 2828

Quoted 8 lines
drivers/staging/rtl8192u/r8192U_core.c +1 -1
@@ -2822,7 +2822,7 @@ static bool rtl8192_adapter_start(struct net_device *dev)
 		}
 		dm_initialize_txpower_tracking(dev);
 
-		if (priv->bDcut == true) {
+		if (priv->bDcut) {
 			u32 i, TempCCk;
 			u32 tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord);
 			for (i = 0; i < TxBBGainTableLength; i++) {

This patch does not apply to my tree :(