staging: nvec: Replace udelay by usleep_range
PATCH 1/1 staging: nvec: Replace udelay by usleep_range
Replace udelay by usleep_range. Fixes the checkpatch issue:usleep_range is preferred over udelay
In Documentation/timers/timers-howto.txt, it is mentioned that udelay should be used for a few microseconds(less than 10), and usleep_range should be preferred for 10 microseconds to 20 milliseconds.
--- drivers/staging/nvec/nvec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/nvec/nvec.c +2 -2
@@ -631,7 +631,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)break ;case 2 :/* first byte after command */ if (status == (I2C_SL_IRQ |RNW |RCVD )) { -udelay (33 ); +usleep_range (33 ,43 );if (nvec->rx->data[0 ] !=0x01 ) {dev_err (nvec->dev,"Read without prior read command\n" );
@@ -718,7 +718,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)* We experience less incomplete messages with this delay than without * it, but we don't know why. Help is appreciated. */ -udelay (100 ); +usleep_range (100 ,200 );return IRQ_HANDLED ; }
Signature · 1 line
2.9.3
Quoted 20 lines · Sreya Mittal
Replace udelay by
usleep_range.
Fixes the checkpatch issue:usleep_rangeis preferred over udelayIn
Documentation/timers/timers-howto.txt,
it is mentioned that udelay should be used
for a few microseconds(less than 10), andusleep_rangeshould be preferred for 10
microseconds to 20 milliseconds.Signed-off-by Sreya Mittal <[email protected]>--- drivers/staging/nvec/nvec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/nvec/nvec.c +0
-0
drivers/staging/nvec/nvec.c static irqreturn_t nvec_interrupt(int irq, void *dev) · line 634
Quoted 5 lines
drivers/staging/nvec/nvec.c +1
-1@@ -631,7 +631,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)break ;case 2 :/* first byte after command */ if (status == (I2C_SL_IRQ |RNW |RCVD )) { -udelay (33 ); +usleep_range (33 ,43 );
The key point is how do you choose the upper bound. If you don't have a good rationale for your choice, it would be better not to make the change.
julia
Quoted 22 lines
drivers/staging/nvec/nvec.c +1
-2if (nvec->rx->data[0 ] !=0x01 ) {dev_err (nvec->dev,"Read without prior read command\n" );@@ -718,7 +718,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)* We experience less incomplete messages with this delay than without * it, but we don't know why. Help is appreciated. */ -udelay (100 ); +usleep_range (100 ,200 );return IRQ_HANDLED ; } --2.9.3
--
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/20170307125256.3998-1-sreyamittal5%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 26 lines · Julia Lawall
drivers/staging/nvec/nvec.c static irqreturn_t nvec_interrupt(int irq, void
Quoted 20 lines · Sreya Mittal
Replace udelay by
usleep_range. Fixes the checkpatch issue:usleep_rangeis preferred over udelayIn
Documentation/timers/timers-howto.txt, it is mentioned that udelay should be used for a few microseconds(less than 10), andusleep_rangeshould be preferred for 10 microseconds to 20 milliseconds.Signed-off-by Sreya Mittal <[email protected] <javascript:>>---
drivers/staging/nvec/nvec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/nvec/nvec.c +0
-0@@ -631,7 +631,7 @@ static irqreturn_t nvec_interrupt(int irq, void*dev)
Quoted 9 lines
drivers/staging/nvec/nvec.c static irqreturn_t nvec_interrupt(int irq, void *dev) · line 634
Quoted 5 lines
drivers/staging/nvec/nvec.c +1
-1break ;case 2 :/* first byte after command */ if (status == (I2C_SL_IRQ |RNW |RCVD )) { -udelay (33 ); +usleep_range (33 ,43 );The key point is how do you choose the upper bound. If you don't have a good rationale for your choice, it would be better not to make the change.
Could you please give some hint(s) regarding the choice of upper bound and what possibly can be a good rationale for it?
Sreya
Quoted 34 lines
julia
drivers/staging/nvec/nvec.c static irqreturn_t nvec_interrupt(int irq, void *dev)
Quoted 3 lines
drivers/staging/nvec/nvec.c +0
-0if (nvec->rx->data[0 ] !=0x01 ) { dev_err(nvec->dev, "Read without prior readcommand\n");
drivers/staging/nvec/nvec.c static irqreturn_t nvec_interrupt(int irq, void
Quoted 1 line
drivers/staging/nvec/nvec.c +0
-0@@ -718,7 +718,7 @@ static irqreturn_t nvec_interrupt(int irq, void*dev)
drivers/staging/nvec/nvec.c static irqreturn_t nvec_interrupt(int irq, void · line 718
Quoted 1 line
drivers/staging/nvec/nvec.c +0
-0* We experience less incomplete messages with this delay than without
Quoted 12 lines
drivers/staging/nvec/nvec.c +1
-1* it, but we don't know why. Help is appreciated. */ -udelay (100 ); +usleep_range (100 ,200 );return IRQ_HANDLED ; }Signature · 4 lines
2.9.3 -- You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected] <javascript:>.
Quoted 1 line
To post to this group, send email to [email protected]
<javascript:>.
Quoted 1 line
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20170307125256.3998-1-sreyamittal5%40gmail.com.
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
Marc Dietrich
maintainerRe: [Outreachy kernel] [PATCH] staging: nvec: Replace udelay byusleep_range
Am Dienstag, 7. März 2017, 20:14:06 CET schrieb Sreya Mittal:
Quoted 32 lines · Julia Lawall
Quoted 31 lines · Sreya Mittal
drivers/staging/nvec/nvec.c static irqreturn_t nvec_interrupt(int irq, void
Quoted 21 lines
Replace udelay by
usleep_range. Fixes the checkpatch issue:usleep_rangeis preferred over udelayIn
Documentation/timers/timers-howto.txt, it is mentioned that udelay should be used for a few microseconds(less than 10), andusleep_rangeshould be preferred for 10 microseconds to 20 milliseconds.Signed-off-by Sreya Mittal <[email protected] <javascript:>>---
drivers/staging/nvec/nvec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/nvec/nvec.c +0
-0@@ -631,7 +631,7 @@ static irqreturn_t nvec_interrupt(int irq, void*dev)
Quoted 6 lines
drivers/staging/nvec/nvec.c +0
-0break ;case 2 :/* first byte after command */ if (status == (I2C_SL_IRQ |RNW |RCVD )) {
Quoted 8 lines
Quoted 5 lines
drivers/staging/nvec/nvec.c static irqreturn_t nvec_interrupt(int irq, void *dev) · line 634
Quoted 2 lines
drivers/staging/nvec/nvec.c +1
-1-udelay (33 ); +usleep_range (33 ,43 );The key point is how do you choose the upper bound. If you don't have a good rationale for your choice, it would be better not to make the change.
Could you please give some hint(s) regarding the choice of upper bound and what possibly can be a good rationale for it?
I n'acked a similar patch a few days ago. See https://lkml.org/lkml/2017/3/2/293.
Maybe it would be good to add a hint to the relevant tutorials to first check if a similar patch has been submitted before.
Marc
Sreya
Quoted 44 lines
Quoted 44 lines
julia
Quoted 5 lines
if (nvec->rx->data[0] != 0x01) { dev_err(nvec->dev, "Read without prior readcommand\n");
drivers/staging/nvec/nvec.c static irqreturn_t nvec_interrupt(int irq, void
Quoted 1 line
drivers/staging/nvec/nvec.c +0
-0@@ -718,7 +718,7 @@ static irqreturn_t nvec_interrupt(int irq, void*dev)
drivers/staging/nvec/nvec.c static irqreturn_t nvec_interrupt(int irq, void · line 718
Quoted 1 line
drivers/staging/nvec/nvec.c +0
-0* We experience less incomplete messages with this delay than without
Quoted 9 lines
drivers/staging/nvec/nvec.c +1
-1* it, but we don't know why. Help is appreciated. */ -udelay (100 ); +usleep_range (100 ,200 );return IRQ_HANDLED ;}
Groups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected] <javascript:>.
Quoted 1 line
To post to this group, send email to [email protected]
<javascript:>.
Quoted 1 line
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20170307125256.3998-1-s
reyamittal5%40gmail.com.>Quoted 1 line
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH] staging: nvec: Replace udelay byusleep_range
Quoted 93 lines · Marc Dietrich
Am Dienstag, 7. März 2017, 20:14:06 CET schrieb Sreya Mittal:
Quoted 30 lines · Julia Lawall
Quoted 28 lines · Sreya Mittal
Quoted 26 lines
Replace udelay by
usleep_range.Fixes the checkpatch issue:
usleep_rangeis preferred over udelayIn
Documentation/timers/timers-howto.txt,it is mentioned that udelay should be used
for a few microseconds(less than 10), and
usleep_rangeshould be preferred for 10microseconds to 20 milliseconds.
Signed-off-by Sreya Mittal <[email protected] <javascript:>>---
Quoted 7 lines
Quoted 7 lines
Review
Quoted 7 lines
drivers/staging/nvec/nvec.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/staging/nvec/nvec.cQuoted 28 lines
Quoted 27 lines
Review static irqreturn_t nvec_interrupt(int irq, void
Quoted 7 lines
index c1feccf..5fab241 100644
---
a/drivers/staging/nvec/nvec.c+++
b/drivers/staging/nvec/nvec.c(quoted diff) +0
-0@@ -631,7 +631,7 @@ static irqreturn_t nvec_interrupt(int irq, void*dev)
Quoted 13 lines
(quoted diff) +0
-0break;case 2: /* first byte after command */
if (status == (
I2C_SL_IRQ| RNW | RCVD)) {- udelay(33);
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+
usleep_range(33, 43);The key point is how do you choose the upper bound. If you don't have a
good rationale for your choice, it would be better not to make the
change.
Quoted 3 lines
Could you please give some hint(s) regarding the choice of upper bound
and
Quoted 1 line
what possibly can be a good rationale for it?
I n'acked a similar patch a few days ago. See
https://lkml.org/lkml/2017/3/2/293.
Quoted 7 lines
Maybe it would be good to add a hint to the relevant tutorials to first check if a similar patch has been submitted before.
Marc
Hi,
Thank you for the link. My bad that I didn't check whether a similar patch has been submitted before.
Sreya
Quoted 100 lines
Sreya
Quoted 58 lines
Quoted 57 lines
julia
Quoted 9 lines
if (nvec->rx->data[0] !=
0x01) {dev_err(nvec->dev,
"Read without prior read
command\n");
Review static irqreturn_t nvec_interrupt(int irq, void
Quoted 1 line
(quoted diff) +0
-0@@ -718,7 +718,7 @@ static irqreturn_t nvec_interrupt(int irq, void*dev)
Review static irqreturn_t nvec_interrupt(int irq, void · line 718
Quoted 1 line
(quoted diff) +0
-0* We experience less incomplete messages with this delay thanwithout
Quoted 17 lines
(quoted diff) +1
-1* it, but we don't know why. Help is appreciated. */ - udelay(100); + usleep_range(100,200);return
IRQ_HANDLED;}
Quoted 5 lines
Quoted 5 lines
Groups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it,
send
Quoted 14 lines
Quoted 13 lines
an email to [email protected] <javascript:>.
Quoted 1 line
To post to this group, send email to [email protected]
<javascript:>.
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20170307125256.3998-1-s
Quoted 3 lines
Quoted 3 lines
reyamittal5%40gmail.com.>
Quoted 1 line
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH] staging: nvec: Replace udelay byusleep_range
Quoted 95 lines · Sreya Mittal
On Wednesday, March 8, 2017 at 2:17:36 AM UTC+5:30, Marc Dietrich wrote:
Am Dienstag, 7. März 2017, 20:14:06 CET schrieb Sreya Mittal: > On Tuesday, March 7, 2017 at 9:22:16 PM UTC+5:30, Julia Lawall wrote: > > On Tue, 7 Mar 2017, Sreya Mittal wrote: > > > Replace udelay by usleep_range. > > > Fixes the checkpatch issue: > > > usleep_range is preferred over udelay > > > > > > In Documentation/timers/timers-howto.txt, > > > it is mentioned that udelay should be used > > > for a few microseconds(less than 10), and > > > usleep_range should be preferred for 10 > > > microseconds to 20 milliseconds. > > > > > > Signed-off-by: Sreya Mittal <[email protected] <javascript:>> > > > --- > > > > > > drivers/staging/nvec/nvec.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c > > > index c1feccf..5fab241 100644 > > > --- a/drivers/staging/nvec/nvec.c > > > +++ b/drivers/staging/nvec/nvec.c > > > @@ -631,7 +631,7 @@ static irqreturn_t nvec_interrupt(int irq, void > > > > *dev) > > > > > break; > > > > > > case 2: /* first byte after command */ > > > > > > if (status == (I2C_SL_IRQ | RNW | RCVD)) { > > > > > > - udelay(33); > > > + usleep_range(33, 43); > > > > The key point is how do you choose the upper bound. If you don't have a > > good rationale for your choice, it would be better not to make the change. > > Could you please give some hint(s) regarding the choice of upper bound and > what possibly can be a good rationale for it?
Quoted 7 lines
I n'acked a similar patch a few days ago. See
https://lkml.org/lkml/2017/3/2/293.
Maybe it would be good to add a hint to the relevant tutorials
to first check if a similar patch has been submitted before.I have added some text to this effect. Thank you for the suggestion.
julia
Quoted 130 lines
Marc
Hi,
Thank you for the link. My bad that I didn't check whether a similar patch has been submitted before.
Sreya
Sreya > > > julia > > > > > if (nvec->rx->data[0] != 0x01) { > > > > > > dev_err(nvec->dev, > > > > > > "Read without prior read > > > > command\n"); > > > > > @@ -718,7 +718,7 @@ static irqreturn_t nvec_interrupt(int irq, void > > > > *dev) > > > > > * We experience less incomplete messages with this delay than > > > > without > > > > > * it, but we don't know why. Help is appreciated. > > > */ > > > > > > - udelay(100); > > > + usleep_range(100,200); > > > > > > return IRQ_HANDLED; > > > > > > } > > > > Groups "outreachy-kernel" group. > > > > > To unsubscribe from this group and stop receiving emails from it, send > > > > an email to [email protected] <javascript:>. > > > > > To post to this group, send email to [email protected] > > > > <javascript:>. > > > > > To view this discussion on the web visit > > > > https://groups.google.com/d/msgid/outreachy-kernel/20170307125256.3998-1-s > > reyamittal5%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 visithttps://groups.google.com/d/msgid/outreachy-kernel/9c43c46e-93b5-46fd-ba6f- ccdf5929d380%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.