All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: nvec: Fix usleep_range is preferred over udelay
@ 2017-11-29 16:00 Joshua Abraham
  2017-11-29 16:07   ` Mikko Perttunen
  0 siblings, 1 reply; 5+ messages in thread
From: Joshua Abraham @ 2017-11-29 16:00 UTC (permalink / raw)
  To: marvin24; +Cc: gregkh, ac100, linux-tegra, devel, linux-kernel

Signed-off-by: Joshua Abraham <j.abraham1776@gmail.com>

This patch fixes the issue:

CHECK: usleep_range is preferred over udelay; see
Documentation/timers/timers-howto.txt

---
 drivers/staging/nvec/nvec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 4ff8f47385da..2a01ef4b54ff 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(30, 35);
 			if (nvec->rx->data[0] != 0x01) {
 				dev_err(nvec->dev,
 					"Read without prior read command\n");
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: nvec: Fix usleep_range is preferred over udelay
  2017-11-29 16:00 [PATCH] staging: nvec: Fix usleep_range is preferred over udelay Joshua Abraham
@ 2017-11-29 16:07   ` Mikko Perttunen
  0 siblings, 0 replies; 5+ messages in thread
From: Mikko Perttunen @ 2017-11-29 16:07 UTC (permalink / raw)
  To: Joshua Abraham, marvin24-Mmb7MZpHnFY
  Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	ac100-oU9gvf+ajcQ97yFScArB1dHuzzzSOjJt,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 11/29/2017 06:00 PM, Joshua Abraham wrote:
> Signed-off-by: Joshua Abraham <j.abraham1776-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> This patch fixes the issue:
> 
> CHECK: usleep_range is preferred over udelay; see
> Documentation/timers/timers-howto.txt
> 
> ---
>   drivers/staging/nvec/nvec.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 4ff8f47385da..2a01ef4b54ff 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(30, 35);
>   			if (nvec->rx->data[0] != 0x01) {
>   				dev_err(nvec->dev,
>   					"Read without prior read command\n");
> 

This is incorrect, as this function is an interrupt handler and we 
cannot sleep in interrupt context.

Cheers,
Mikko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: nvec: Fix usleep_range is preferred over udelay
@ 2017-11-29 16:07   ` Mikko Perttunen
  0 siblings, 0 replies; 5+ messages in thread
From: Mikko Perttunen @ 2017-11-29 16:07 UTC (permalink / raw)
  To: Joshua Abraham, marvin24; +Cc: gregkh, ac100, linux-tegra, devel, linux-kernel

On 11/29/2017 06:00 PM, Joshua Abraham wrote:
> Signed-off-by: Joshua Abraham <j.abraham1776@gmail.com>
> 
> This patch fixes the issue:
> 
> CHECK: usleep_range is preferred over udelay; see
> Documentation/timers/timers-howto.txt
> 
> ---
>   drivers/staging/nvec/nvec.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 4ff8f47385da..2a01ef4b54ff 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(30, 35);
>   			if (nvec->rx->data[0] != 0x01) {
>   				dev_err(nvec->dev,
>   					"Read without prior read command\n");
> 

This is incorrect, as this function is an interrupt handler and we 
cannot sleep in interrupt context.

Cheers,
Mikko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: nvec: Fix usleep_range is preferred over udelay
  2017-11-29 16:07   ` Mikko Perttunen
@ 2017-11-29 16:17     ` Josh Abraham
  -1 siblings, 0 replies; 5+ messages in thread
From: Josh Abraham @ 2017-11-29 16:17 UTC (permalink / raw)
  To: Mikko Perttunen; +Cc: devel, gregkh, linux-kernel, linux-tegra, ac100

On Wed, Nov 29, 2017 at 06:07:53PM +0200, Mikko Perttunen wrote:
> On 11/29/2017 06:00 PM, Joshua Abraham wrote:
> > Signed-off-by: Joshua Abraham <j.abraham1776@gmail.com>
> > 
> > This patch fixes the issue:
> > 
> > CHECK: usleep_range is preferred over udelay; see
> > Documentation/timers/timers-howto.txt
> > 
> > ---
> >   drivers/staging/nvec/nvec.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> > index 4ff8f47385da..2a01ef4b54ff 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(30, 35);
> >   			if (nvec->rx->data[0] != 0x01) {
> >   				dev_err(nvec->dev,
> >   					"Read without prior read command\n");
> > 
> 
> This is incorrect, as this function is an interrupt handler and we cannot
> sleep in interrupt context.
> 
> Cheers,
> Mikko

My mistake.  Thank you for the feedback!
-Josh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: nvec: Fix usleep_range is preferred over udelay
@ 2017-11-29 16:17     ` Josh Abraham
  0 siblings, 0 replies; 5+ messages in thread
From: Josh Abraham @ 2017-11-29 16:17 UTC (permalink / raw)
  To: Mikko Perttunen; +Cc: marvin24, gregkh, ac100, linux-tegra, devel, linux-kernel

On Wed, Nov 29, 2017 at 06:07:53PM +0200, Mikko Perttunen wrote:
> On 11/29/2017 06:00 PM, Joshua Abraham wrote:
> > Signed-off-by: Joshua Abraham <j.abraham1776@gmail.com>
> > 
> > This patch fixes the issue:
> > 
> > CHECK: usleep_range is preferred over udelay; see
> > Documentation/timers/timers-howto.txt
> > 
> > ---
> >   drivers/staging/nvec/nvec.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> > index 4ff8f47385da..2a01ef4b54ff 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(30, 35);
> >   			if (nvec->rx->data[0] != 0x01) {
> >   				dev_err(nvec->dev,
> >   					"Read without prior read command\n");
> > 
> 
> This is incorrect, as this function is an interrupt handler and we cannot
> sleep in interrupt context.
> 
> Cheers,
> Mikko

My mistake.  Thank you for the feedback!
-Josh

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-29 16:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29 16:00 [PATCH] staging: nvec: Fix usleep_range is preferred over udelay Joshua Abraham
2017-11-29 16:07 ` Mikko Perttunen
2017-11-29 16:07   ` Mikko Perttunen
2017-11-29 16:17   ` Josh Abraham
2017-11-29 16:17     ` Josh Abraham

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.