Skip to contentSkip to conversation

staging: rtl8192u: Remove multiple assignments

PATCH Superseded Gargi Sharma 2 participants 2 messages Mar 11, 2017 – Mar 12, 2017 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: rtl8192u: Remove multiple assignments

This patch removes multiple assignments by factorizing them. This was done with Coccinelle for the if branch. For the else part the change was done manually since Coccinelle only detects constants. Braces were also added to the else part to remove the checkpatch warning, "braces should be on all arms of if-else statements".

@ identifier i1,i2; constant c; @@
- i1=i2=c;
+ i1=c;
+ i2=c;

---
 drivers/staging/rtl8192u/r8192U_dm.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/staging/rtl8192u/r8192U_dm.c +8 -4
index 9209aad..6afc6d6 100644
@@ -725,10 +725,14 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
 	} else {
 		tmpval = (u8)tmpRegA - priv->ThermalMeter[0];
 
-		if (tmpval >= 6) /* higher temperature */
-			tmpOFDMindex = tmpCCK20Mindex = 0; /* max to +6dB */
-		else
-			tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval;
+		if (tmpval >= 6) /* higher temperature */ {
+			tmpOFDMindex = 0;
+			tmpCCK20Mindex = 0;
+		} /* max to +6dB */
+		else {
+			tmpOFDMindex = 6 - tmpval;
+			tmpCCK20Mindex = 6 - tmpval;
+		}
 		tmpCCK40Mindex = 0;
 	}
 	/*DbgPrint("%ddb, tmpOFDMindex = %d, tmpCCK20Mindex = %d, tmpCCK40Mindex = %d",
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 22 lines · Gargi Sharma

This patch removes multiple assignments by factorizing them. This was done with Coccinelle for the if branch. For the else part the change was done manually since Coccinelle only detects constants. Braces were also added to the else part to remove the checkpatch warning, "braces should be on all arms of if-else statements".

@ identifier i1,i2; constant c; @@
- i1=i2=c;
+ i1=c;
+ i2=c;

---
 drivers/staging/rtl8192u/r8192U_dm.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/staging/rtl8192u/r8192U_dm.c +0 -0
index 9209aad..6afc6d6 100644
@@ -725,10 +725,14 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
 	} else {

drivers/staging/rtl8192u/r8192U_dm.c static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) · line 731

Quoted 10 lines
drivers/staging/rtl8192u/r8192U_dm.c +4 -4
 		tmpval = (u8)tmpRegA - priv->ThermalMeter[0];
 
-		if (tmpval >= 6) /* higher temperature */
-			tmpOFDMindex = tmpCCK20Mindex = 0; /* max to +6dB */
-		else
-			tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval;
+		if (tmpval >= 6) /* higher temperature */ {
+			tmpOFDMindex = 0;
+			tmpCCK20Mindex = 0;
+		} /* max to +6dB */

Very odd place to put a comment, don't you agree? Same for the one above...

thanks,

greg k-h