Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1733085 > unrolled thread
| Started by | Srishti Sharma <srishtishar@gmail.com> |
|---|---|
| First post | 2017-09-15 23:10 +0200 |
| Last post | 2017-09-16 00:00 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/2] Staging: irda: Remove parentheses on the right of assignment Srishti Sharma <srishtishar@gmail.com> - 2017-09-15 23:10 +0200
Re: [PATCH 2/2] Staging: irda: Remove parentheses on the right of assignment Joe Perches <joe@perches.com> - 2017-09-15 23:40 +0200
Re: [Outreachy kernel] Re: [PATCH 2/2] Staging: irda: Remove parentheses on the right of assignment Julia Lawall <julia.lawall@lip6.fr> - 2017-09-16 00:00 +0200
| From | Srishti Sharma <srishtishar@gmail.com> |
|---|---|
| Date | 2017-09-15 23:10 +0200 |
| Subject | [PATCH 2/2] Staging: irda: Remove parentheses on the right of assignment |
| Message-ID | <uq625-8sF-3@gated-at.bofh.it> |
Parentheses are not needed on the right hand side of assignment
statement in most cases. Done using the following semantic
patch by coccinelle.
@@
identifier E,F,G,f;
expression e,r;
@@
(
E = (G == F);
|
E = (e == r);
|
E =
-(
...
-)
;
)
Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
---
drivers/staging/irda/drivers/mcs7780.c | 4 ++--
drivers/staging/irda/net/irqueue.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c
index 2b674d5..d52e9f4 100644
--- a/drivers/staging/irda/drivers/mcs7780.c
+++ b/drivers/staging/irda/drivers/mcs7780.c
@@ -605,7 +605,7 @@ static int mcs_speed_change(struct mcs_cb *mcs)
if (mcs->new_speed <= 115200) {
rval &= ~MCS_FIR;
- rst = (mcs->speed > 115200);
+ rst = mcs->speed > 115200;
if (rst)
mcs_set_reg(mcs, MCS_MINRXPW_REG, 0);
@@ -619,7 +619,7 @@ static int mcs_speed_change(struct mcs_cb *mcs)
} else {
rval |= MCS_FIR;
- rst = (mcs->speed != 4000000);
+ rst = mcs->speed != 4000000;
if (rst)
mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
diff --git a/drivers/staging/irda/net/irqueue.c b/drivers/staging/irda/net/irqueue.c
index 5aab072..14291cb 100644
--- a/drivers/staging/irda/net/irqueue.c
+++ b/drivers/staging/irda/net/irqueue.c
@@ -217,7 +217,7 @@ static __u32 hash( const char* name)
while(*name) {
h = (h<<4) + *name++;
- g = (h & 0xf0000000);
+ g = h & 0xf0000000;
if (g)
h ^=g>>24;
h &=~g;
--
2.7.4
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-09-15 23:40 +0200 |
| Subject | Re: [PATCH 2/2] Staging: irda: Remove parentheses on the right of assignment |
| Message-ID | <uq6v8-cm-11@gated-at.bofh.it> |
| In reply to | #1733085 |
On Sat, 2017-09-16 at 02:36 +0530, Srishti Sharma wrote:
> Parentheses are not needed on the right hand side of assignment
> statement in most cases. Done using the following semantic
> patch by coccinelle.
[]
> @@
> identifier E,F,G,f;
> expression e,r;
> @@
>
> (
> E = (G == F);
> >
>
> E = (e == r);
> >
>
> E =
> -(
> ...
> -)
> ;
> )
[]
> diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c
[]
> @@ -605,7 +605,7 @@ static int mcs_speed_change(struct mcs_cb *mcs)
> if (mcs->new_speed <= 115200) {
> rval &= ~MCS_FIR;
>
> - rst = (mcs->speed > 115200);
> + rst = mcs->speed > 115200;
> if (rst)
> mcs_set_reg(mcs, MCS_MINRXPW_REG, 0);
Coccinelle is a good tool, but its output is limited to
the correctness
and completeness of its input script.
Please look at the suggested modifications of the script
and examine the code for other similar uses.
The else if block immediately below this is:
} else if (mcs->new_speed <= 1152000) {
rval &= ~MCS_FIR;
if ((rst = !(mcs->speed == 576000 || mcs->speed == 11520
00)))
mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
which should also be corrected by this patch.
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <julia.lawall@lip6.fr> |
|---|---|
| Date | 2017-09-16 00:00 +0200 |
| Subject | Re: [Outreachy kernel] Re: [PATCH 2/2] Staging: irda: Remove parentheses on the right of assignment |
| Message-ID | <uq6Ou-lC-7@gated-at.bofh.it> |
| In reply to | #1733106 |
On Fri, 15 Sep 2017, Joe Perches wrote:
> On Sat, 2017-09-16 at 02:36 +0530, Srishti Sharma wrote:
> > Parentheses are not needed on the right hand side of assignment
> > statement in most cases. Done using the following semantic
> > patch by coccinelle.
> []
> > @@
> > identifier E,F,G,f;
> > expression e,r;
> > @@
> >
> > (
> > E = (G == F);
> > >
> >
> > E = (e == r);
> > >
> >
> > E =
> > -(
> > ...
> > -)
> > ;
> > )
> []
> > diff --git a/drivers/staging/irda/drivers/mcs7780.c b/drivers/staging/irda/drivers/mcs7780.c
> []
> > @@ -605,7 +605,7 @@ static int mcs_speed_change(struct mcs_cb *mcs)
> > if (mcs->new_speed <= 115200) {
> > rval &= ~MCS_FIR;
> >
> > - rst = (mcs->speed > 115200);
> > + rst = mcs->speed > 115200;
> > if (rst)
> > mcs_set_reg(mcs, MCS_MINRXPW_REG, 0);
>
> Coccinelle is a good tool, but its output is limited to
> the correctness
> and completeness of its input script.
>
> Please look at the suggested modifications of the script
> and examine the code for other similar uses.
>
> The else if block immediately below this is:
>
> } else if (mcs->new_speed <= 1152000) {
> rval &= ~MCS_FIR;
>
> if ((rst = !(mcs->speed == 576000 || mcs->speed == 11520
> 00)))
> mcs_set_reg(mcs, MCS_MINRXPW_REG, 5);
>
> which should also be corrected by this patch.
You're concerned about the assignment in the if header? Because that was
in 1/2. One could also push the ! under the ||, but I'm not sure that
would be much of an improvement.
julia
>
> --
> 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/1505511108.27581.16.camel%40perches.com.
> For more options, visit https://groups.google.com/d/optout.
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web