All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: dgnc: replace udelay with usleep_range
@ 2017-02-27 12:46 Aishwarya Pant
  2017-02-27 14:38 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Aishwarya Pant @ 2017-02-27 12:46 UTC (permalink / raw)
  To: Lidza Louina, Mark Hounschell, Greg Kroah-Hartman; +Cc: outreachy-kernel

Fix checkpatch warning on dgnc_cls.c : CHECK usleep_range
is preferred over udelay. There are two ocurrences of udelay
in non-atomic context that can be safely replaced by
usleep_range(t, t + delta). Pick delta as t (as t is between
10 and 20 microseconds).

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
---
Changes in v2:
	- Revert usage of usleep_range in atomic context
	- Clean-up the commit message
---
 drivers/staging/dgnc/dgnc_cls.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 2cf146e..368c6ba 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -16,7 +16,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>	/* For jiffies, task states */
 #include <linux/interrupt.h>	/* For tasklet and interrupt structs/defines */
-#include <linux/delay.h>	/* For usleep_range */
+#include <linux/delay.h>	/* For udelay and usleep_range */
 #include <linux/io.h>		/* For read[bwl]/write[bwl] */
 #include <linux/serial.h>	/* For struct async_serial */
 #include <linux/serial_reg.h>	/* For the various UART offsets */
@@ -609,7 +609,7 @@ static void cls_flush_uart_write(struct channel_t *ch)
 
 	writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT),
 	       &ch->ch_cls_uart->isr_fcr);
-	usleep_range(10, 20);
+	udelay(10);
 
 	ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
 }
@@ -631,7 +631,7 @@ static void cls_flush_uart_read(struct channel_t *ch)
 	 * Presumably, this is a bug in this UART.
 	 */
 
-	usleep_range(10, 20);
+	udelay(10);
 }
 
 /*
-- 
2.7.4



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

* Re: [PATCH v2] staging: dgnc: replace udelay with usleep_range
  2017-02-27 12:46 [PATCH v2] staging: dgnc: replace udelay with usleep_range Aishwarya Pant
@ 2017-02-27 14:38 ` Greg Kroah-Hartman
  2017-02-27 14:54   ` Aishwarya Pant
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2017-02-27 14:38 UTC (permalink / raw)
  To: Aishwarya Pant; +Cc: Lidza Louina, Mark Hounschell, outreachy-kernel

On Mon, Feb 27, 2017 at 06:16:33PM +0530, Aishwarya Pant wrote:
> Fix checkpatch warning on dgnc_cls.c : CHECK usleep_range
> is preferred over udelay. There are two ocurrences of udelay
> in non-atomic context that can be safely replaced by
> usleep_range(t, t + delta). Pick delta as t (as t is between
> 10 and 20 microseconds).
> 
> Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
> ---
> Changes in v2:
> 	- Revert usage of usleep_range in atomic context
> 	- Clean-up the commit message
> ---
>  drivers/staging/dgnc/dgnc_cls.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
> index 2cf146e..368c6ba 100644
> --- a/drivers/staging/dgnc/dgnc_cls.c
> +++ b/drivers/staging/dgnc/dgnc_cls.c
> @@ -16,7 +16,7 @@
>  #include <linux/kernel.h>
>  #include <linux/sched.h>	/* For jiffies, task states */
>  #include <linux/interrupt.h>	/* For tasklet and interrupt structs/defines */
> -#include <linux/delay.h>	/* For usleep_range */
> +#include <linux/delay.h>	/* For udelay and usleep_range */
>  #include <linux/io.h>		/* For read[bwl]/write[bwl] */
>  #include <linux/serial.h>	/* For struct async_serial */
>  #include <linux/serial_reg.h>	/* For the various UART offsets */
> @@ -609,7 +609,7 @@ static void cls_flush_uart_write(struct channel_t *ch)
>  
>  	writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT),
>  	       &ch->ch_cls_uart->isr_fcr);
> -	usleep_range(10, 20);
> +	udelay(10);
>  
>  	ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
>  }
> @@ -631,7 +631,7 @@ static void cls_flush_uart_read(struct channel_t *ch)
>  	 * Presumably, this is a bug in this UART.
>  	 */
>  
> -	usleep_range(10, 20);
> +	udelay(10);
>  }
>  
>  /*

Your patch seems to be backwards :(


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

* Re: [PATCH v2] staging: dgnc: replace udelay with usleep_range
  2017-02-27 14:38 ` Greg Kroah-Hartman
@ 2017-02-27 14:54   ` Aishwarya Pant
  0 siblings, 0 replies; 3+ messages in thread
From: Aishwarya Pant @ 2017-02-27 14:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Lidza Louina, Mark Hounschell, outreachy-kernel

On Mon, Feb 27, 2017 at 03:38:32PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Feb 27, 2017 at 06:16:33PM +0530, Aishwarya Pant wrote:
> > Fix checkpatch warning on dgnc_cls.c : CHECK usleep_range
> > is preferred over udelay. There are two ocurrences of udelay
> > in non-atomic context that can be safely replaced by
> > usleep_range(t, t + delta). Pick delta as t (as t is between
> > 10 and 20 microseconds).
> > 
> > Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
> > ---
> > Changes in v2:
> > 	- Revert usage of usleep_range in atomic context
> > 	- Clean-up the commit message
> > ---
> >  drivers/staging/dgnc/dgnc_cls.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
> > index 2cf146e..368c6ba 100644
> > --- a/drivers/staging/dgnc/dgnc_cls.c
> > +++ b/drivers/staging/dgnc/dgnc_cls.c
> > @@ -16,7 +16,7 @@
> >  #include <linux/kernel.h>
> >  #include <linux/sched.h>	/* For jiffies, task states */
> >  #include <linux/interrupt.h>	/* For tasklet and interrupt structs/defines */
> > -#include <linux/delay.h>	/* For usleep_range */
> > +#include <linux/delay.h>	/* For udelay and usleep_range */
> >  #include <linux/io.h>		/* For read[bwl]/write[bwl] */
> >  #include <linux/serial.h>	/* For struct async_serial */
> >  #include <linux/serial_reg.h>	/* For the various UART offsets */
> > @@ -609,7 +609,7 @@ static void cls_flush_uart_write(struct channel_t *ch)
> >  
> >  	writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT),
> >  	       &ch->ch_cls_uart->isr_fcr);
> > -	usleep_range(10, 20);
> > +	udelay(10);
> >  
> >  	ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
> >  }
> > @@ -631,7 +631,7 @@ static void cls_flush_uart_read(struct channel_t *ch)
> >  	 * Presumably, this is a bug in this UART.
> >  	 */
> >  
> > -	usleep_range(10, 20);
> > +	udelay(10);
> >  }
> >  
> >  /*
> 
> Your patch seems to be backwards :(

Ah this is the diff between patch v1 and patch v2. I'll send in the
correct one shortly.



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

end of thread, other threads:[~2017-02-27 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-27 12:46 [PATCH v2] staging: dgnc: replace udelay with usleep_range Aishwarya Pant
2017-02-27 14:38 ` Greg Kroah-Hartman
2017-02-27 14:54   ` Aishwarya Pant

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.