* [PATCH] staging: rtl8192e: Remove multiple assignments
@ 2016-03-05 21:02 Bhaktipriya Shridhar
2016-03-11 17:21 ` [Outreachy kernel] " Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Bhaktipriya Shridhar @ 2016-03-05 21:02 UTC (permalink / raw)
To: outreachy-kernel
This patch removes multiple assignments by factorizing them.
This was done with Coccinelle.
@ identifier i1,i2; constant c; @@
- i1=i2=c;
+ i1=c;
+ i2=c;
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
---
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index b6b714d..6834652 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -887,8 +887,10 @@ 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;
+ if (tmpval >= 6) {
+ tmpOFDMindex = 0;
+ tmpCCK20Mindex = 0;
+ }
else
tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval;
tmpCCK40Mindex = 0;
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [Outreachy kernel] [PATCH] staging: rtl8192e: Remove multiple assignments
2016-03-05 21:02 [PATCH] staging: rtl8192e: Remove multiple assignments Bhaktipriya Shridhar
@ 2016-03-11 17:21 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2016-03-11 17:21 UTC (permalink / raw)
To: Bhaktipriya Shridhar; +Cc: outreachy-kernel
On Sun, Mar 06, 2016 at 02:32:23AM +0530, Bhaktipriya Shridhar wrote:
> This patch removes multiple assignments by factorizing them.
>
> This was done with Coccinelle.
>
> @ identifier i1,i2; constant c; @@
> - i1=i2=c;
> + i1=c;
> + i2=c;
>
> Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
> ---
> drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> index b6b714d..6834652 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> @@ -887,8 +887,10 @@ 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;
> + if (tmpval >= 6) {
> + tmpOFDMindex = 0;
> + tmpCCK20Mindex = 0;
> + }
> else
Your brace placement is wrong here :(
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] staging: rtl8192e: Remove multiple assignments
@ 2017-03-11 14:19 Gargi Sharma
2017-03-11 14:51 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Gargi Sharma @ 2017-03-11 14:19 UTC (permalink / raw)
To: outreachy-kernel; +Cc: gregkh, 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;
Signed-off-by: Gargi Sharma <gs051095@gmail.com>
---
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index d101974..32e51be 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -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)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [Outreachy kernel] [PATCH] staging: rtl8192e: Remove multiple assignments
2017-03-11 14:19 Gargi Sharma
@ 2017-03-11 14:51 ` Julia Lawall
2017-03-11 14:53 ` Gargi Sharma
0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2017-03-11 14:51 UTC (permalink / raw)
To: Gargi Sharma; +Cc: outreachy-kernel, gregkh
On Sat, 11 Mar 2017, Gargi Sharma wrote:
> 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;
>
> Signed-off-by: Gargi Sharma <gs051095@gmail.com>
> ---
> drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> index d101974..32e51be 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> @@ -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;
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
> + }
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Outreachy kernel] [PATCH] staging: rtl8192e: Remove multiple assignments
2017-03-11 14:51 ` [Outreachy kernel] " Julia Lawall
@ 2017-03-11 14:53 ` Gargi Sharma
0 siblings, 0 replies; 4+ messages in thread
From: Gargi Sharma @ 2017-03-11 14:53 UTC (permalink / raw)
To: Julia Lawall; +Cc: outreachy-kernel, Greg KH
On Sat, Mar 11, 2017 at 8:21 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Sat, 11 Mar 2017, Gargi Sharma wrote:
>
>> 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;
>>
>> Signed-off-by: Gargi Sharma <gs051095@gmail.com>
>> ---
>> drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
>> index d101974..32e51be 100644
>> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
>> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
>> @@ -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;
>
> 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
>
> julia
>
>> + }
>> 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 outreachy-kernel+unsubscribe@googlegroups.com.
>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-11 14:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-05 21:02 [PATCH] staging: rtl8192e: Remove multiple assignments Bhaktipriya Shridhar
2016-03-11 17:21 ` [Outreachy kernel] " Greg KH
-- strict thread matches above, loose matches on Subject: below --
2017-03-11 14:19 Gargi Sharma
2017-03-11 14:51 ` [Outreachy kernel] " Julia Lawall
2017-03-11 14:53 ` Gargi Sharma
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.