Skip to contentSkip to conversation

staging: rtl8192e: Remove multiple assignments

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

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192e: Remove multiple assignments

This patch removes multiple assignments by factorizing them. This was done with Coccinelle. 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/rtl8192e/rtl8192e/rtl_dm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +5 -3
index d101974..32e51be 100644
@@ -887,10 +887,12 @@ static void _rtl92e_dm_tx_power_tracking_cb_thermal(struct net_device *dev)
 			tmpCCK40Mindex = CCK_Table_length-1;
 	} else {
 		tmpval = (u8)tmpRegA - priv->ThermalMeter[0];
-		if (tmpval >= 6)
-			tmpOFDMindex = tmpCCK20Mindex = 0;
-		else
+		if (tmpval >= 6) {
+			tmpOFDMindex = 0;
+			tmpCCK20Mindex = 0;
+		} else {
 			tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval;
+		}
 		tmpCCK40Mindex = 0;
 	}
 	if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
Signature · 1 line
2.7.4
#1 lore raw
Quoted 21 lines · Gargi Sharma

This patch removes multiple assignments by factorizing them. This was done with Coccinelle. 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/rtl8192e/rtl8192e/rtl_dm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +0 -0
index d101974..32e51be 100644
@@ -887,10 +887,12 @@ static void _rtl92e_dm_tx_power_tracking_cb_thermal(struct net_device *dev)
 			tmpCCK40Mindex = CCK_Table_length-1;

drivers/staging/rtl8192e/rtl8192e/rtl_dm.c static void _rtl92e_dm_tx_power_tracking_cb_thermal(struct net_device *dev) · line 894

Quoted 10 lines
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +4 -3
 	} else {
 		tmpval = (u8)tmpRegA - priv->ThermalMeter[0];
-		if (tmpval >= 6)
-			tmpOFDMindex = tmpCCK20Mindex = 0;
-		else
+		if (tmpval >= 6) {
+			tmpOFDMindex = 0;
+			tmpCCK20Mindex = 0;
+		} else {
 			tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval;

Coccinelle doesn't find it because the right hand side of the assignment is not a constant, but you could do the else branch as well (and mention in the commit message that you did this part additionally).

julia

Quoted 14 lines
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +1 -1
+		}
 		tmpCCK40Mindex = 0;
 	}
 	if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
--

2.7.4

--
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/1489241955-12103-1-git-send-email-gs051095%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 31 lines · Julia Lawall
Quoted 27 lines · Gargi Sharma

This patch removes multiple assignments by factorizing them. This was done with Coccinelle. 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/rtl8192e/rtl8192e/rtl_dm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +1 -3
index d101974..32e51be 100644
@@ -887,10 +887,12 @@ static void _rtl92e_dm_tx_power_tracking_cb_thermal(struct net_device *dev)
                      tmpCCK40Mindex = CCK_Table_length-1;
      } else {
              tmpval = (u8)tmpRegA - priv->ThermalMeter[0];
-             if (tmpval >= 6)
-                     tmpOFDMindex = tmpCCK20Mindex = 0;
-             else
+             if (tmpval >= 6) {
Quoted 8 lines

drivers/staging/rtl8192e/rtl8192e/rtl_dm.c static void _rtl92e_dm_tx_power_tracking_cb_thermal(struct net_device *dev) · line 894

Quoted 4 lines
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +3 -0
+                     tmpOFDMindex = 0;
+                     tmpCCK20Mindex = 0;
+             } else {
                      tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval;

Coccinelle doesn't find it because the right hand side of the assignment is not a constant, but you could do the else branch as well (and mention in the commit message that you did this part additionally).

Oh yeah sure. I missed it completely. :')

Thanks,
Gargi

Quoted 24 lines

julia

Quoted 7 lines
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +1 -1
+             }
              tmpCCK40Mindex = 0;
      }
      if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
--

2.7.4

Quoted 7 lines

--
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/1489241955-12103-1-git-send-email-gs051095%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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/alpine.DEB.2.20.1703111550410.3127%40hadrien.
For more options, visit https://groups.google.com/d/optout.