All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] staging: dgnc: replace udelay with usleep_range
@ 2017-02-27 16:34 Aishwarya Pant
  2017-02-28  6:18 ` Aishwarya Pant
  0 siblings, 1 reply; 3+ messages in thread
From: Aishwarya Pant @ 2017-02-27 16:34 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 is one ocurrence of udelay in
function cls_uart_init with non-atomic context that can be safely
replaced by usleep_range(t, t + delta) where delta is t (as t is
between 10 and 20 microseconds). Also replace usleep_range by udelay in
function cls_flush_uart_write as it is called under a channel lock.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
---
Changes in v4:
	- Fix commit message formatting

Changes in v3:
	- Replace usleep_range by udelay in cls_flush_uart_write
	- Fix diff in commit message

Changes in v2:
	- Revert usage of usleep_range in atomic context
	- Cleanup the commit message

 drivers/staging/dgnc/dgnc_cls.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index c20ffdd..7068c3b 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -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);
 }
@@ -1096,7 +1096,7 @@ static void cls_uart_init(struct channel_t *ch)
 
 	writeb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
 	       &ch->ch_cls_uart->isr_fcr);
-	udelay(10);
+	usleep_range(10, 20);
 
 	ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
 
-- 
2.7.4



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

* Re: [PATCH v4] staging: dgnc: replace udelay with usleep_range
  2017-02-27 16:34 [PATCH v4] staging: dgnc: replace udelay with usleep_range Aishwarya Pant
@ 2017-02-28  6:18 ` Aishwarya Pant
  2017-03-01  8:02   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Aishwarya Pant @ 2017-02-28  6:18 UTC (permalink / raw)
  To: Lidza Louina, Mark Hounschell, Greg Kroah-Hartman; +Cc: outreachy-kernel

On Mon, Feb 27, 2017 at 10:04:45PM +0530, Aishwarya Pant wrote:
> Fix checkpatch warning on dgnc_cls.c : CHECK usleep_range
> is preferred over udelay. There is one ocurrence of udelay in
> function cls_uart_init with non-atomic context that can be safely
> replaced by usleep_range(t, t + delta) where delta is t (as t is
> between 10 and 20 microseconds). Also replace usleep_range by udelay in
> function cls_flush_uart_write as it is called under a channel lock.
> 
> Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
> ---
> Changes in v4:
> 	- Fix commit message formatting
> 
> Changes in v3:
> 	- Replace usleep_range by udelay in cls_flush_uart_write
> 	- Fix diff in commit message
> 
> Changes in v2:
> 	- Revert usage of usleep_range in atomic context
> 	- Cleanup the commit message
> 
>  drivers/staging/dgnc/dgnc_cls.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
> index c20ffdd..7068c3b 100644
> --- a/drivers/staging/dgnc/dgnc_cls.c
> +++ b/drivers/staging/dgnc/dgnc_cls.c
> @@ -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);
>  }
> @@ -1096,7 +1096,7 @@ static void cls_uart_init(struct channel_t *ch)
>  
>  	writeb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
>  	       &ch->ch_cls_uart->isr_fcr);
> -	udelay(10);
> +	usleep_range(10, 20);
>  
>  	ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
>  
> -- 
> 2.7.4
>


Since delays are something I cannot test if it works well on all
hardware, should I move on to some other cleanup and not tamper with
delays?






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

* Re: [PATCH v4] staging: dgnc: replace udelay with usleep_range
  2017-02-28  6:18 ` Aishwarya Pant
@ 2017-03-01  8:02   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2017-03-01  8:02 UTC (permalink / raw)
  To: Aishwarya Pant; +Cc: Lidza Louina, Mark Hounschell, outreachy-kernel

On Tue, Feb 28, 2017 at 11:48:38AM +0530, Aishwarya Pant wrote:
> On Mon, Feb 27, 2017 at 10:04:45PM +0530, Aishwarya Pant wrote:
> > Fix checkpatch warning on dgnc_cls.c : CHECK usleep_range
> > is preferred over udelay. There is one ocurrence of udelay in
> > function cls_uart_init with non-atomic context that can be safely
> > replaced by usleep_range(t, t + delta) where delta is t (as t is
> > between 10 and 20 microseconds). Also replace usleep_range by udelay in
> > function cls_flush_uart_write as it is called under a channel lock.
> > 
> > Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
> > ---
> > Changes in v4:
> > 	- Fix commit message formatting
> > 
> > Changes in v3:
> > 	- Replace usleep_range by udelay in cls_flush_uart_write
> > 	- Fix diff in commit message
> > 
> > Changes in v2:
> > 	- Revert usage of usleep_range in atomic context
> > 	- Cleanup the commit message
> > 
> >  drivers/staging/dgnc/dgnc_cls.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
> > index c20ffdd..7068c3b 100644
> > --- a/drivers/staging/dgnc/dgnc_cls.c
> > +++ b/drivers/staging/dgnc/dgnc_cls.c
> > @@ -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);
> >  }
> > @@ -1096,7 +1096,7 @@ static void cls_uart_init(struct channel_t *ch)
> >  
> >  	writeb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
> >  	       &ch->ch_cls_uart->isr_fcr);
> > -	udelay(10);
> > +	usleep_range(10, 20);
> >  
> >  	ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
> >  
> > -- 
> > 2.7.4
> >
> 
> 
> Since delays are something I cannot test if it works well on all
> hardware, should I move on to some other cleanup and not tamper with
> delays?

Yes please.


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

end of thread, other threads:[~2017-03-01  8:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-27 16:34 [PATCH v4] staging: dgnc: replace udelay with usleep_range Aishwarya Pant
2017-02-28  6:18 ` Aishwarya Pant
2017-03-01  8:02   ` Greg Kroah-Hartman

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.