* [PATCH v3] staging: dgnc: replace usleep_range with udelay
@ 2017-03-01 10:33 Aishwarya Pant
2017-03-01 10:56 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Aishwarya Pant @ 2017-03-01 10:33 UTC (permalink / raw)
To: Lidza Louina, Mark Hounschell, Greg Kroah-Hartman; +Cc: outreachy-kernel
udelay is impelmented using a busy-wait loop and consumes CPU cycles
while usleep_range is implemented using interrupts.cls_flush_uart_write()
is called after a channel lock is acquired i.e. an atomic context.
Hence delay in this method should use udelay instead of usleep_range.
Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
---
Changes in v3:
- Add a comment in code udelay to ignore checkpatch warning
Changes in v2:
- Edit commit message to explain why udelay should be used
drivers/staging/dgnc/dgnc_cls.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 28a3e16..ec190e5 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -609,7 +609,11 @@ 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);
+
+ /* Ignore checkpatch warning to replace udelay by usleep_range
+ * as this function is called under an atomic context
+ */
+ udelay(10);
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH v3] staging: dgnc: replace usleep_range with udelay
2017-03-01 10:33 [PATCH v3] staging: dgnc: replace usleep_range with udelay Aishwarya Pant
@ 2017-03-01 10:56 ` Julia Lawall
2017-03-01 11:12 ` Aishwarya Pant
0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2017-03-01 10:56 UTC (permalink / raw)
To: Aishwarya Pant
Cc: Lidza Louina, Mark Hounschell, Greg Kroah-Hartman, outreachy-kernel
On Wed, 1 Mar 2017, Aishwarya Pant wrote:
> udelay is impelmented using a busy-wait loop and consumes CPU cycles
> while usleep_range is implemented using interrupts.cls_flush_uart_write()
> is called after a channel lock is acquired i.e. an atomic context.
> Hence delay in this method should use udelay instead of usleep_range.
>
> Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
>
> ---
> Changes in v3:
> - Add a comment in code udelay to ignore checkpatch warning
> Changes in v2:
> - Edit commit message to explain why udelay should be used
>
> drivers/staging/dgnc/dgnc_cls.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
> index 28a3e16..ec190e5 100644
> --- a/drivers/staging/dgnc/dgnc_cls.c
> +++ b/drivers/staging/dgnc/dgnc_cls.c
> @@ -609,7 +609,11 @@ 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);
> +
> + /* Ignore checkpatch warning to replace udelay by usleep_range
> + * as this function is called under an atomic context
> + */
> + udelay(10);
I think this doesn't follow the proper block comment format?
Anyway, perhaps something like "called in atomic context so usleep_range
not used" would be sufficient.
julia
>
> ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
> }
> --
> 2.7.4
>
> --
> 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/20170301103315.GA4448%40aishwarya.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH v3] staging: dgnc: replace usleep_range with udelay
2017-03-01 10:56 ` [Outreachy kernel] " Julia Lawall
@ 2017-03-01 11:12 ` Aishwarya Pant
2017-03-01 13:07 ` Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Aishwarya Pant @ 2017-03-01 11:12 UTC (permalink / raw)
To: Julia Lawall
Cc: Lidza Louina, Mark Hounschell, Greg Kroah-Hartman, outreachy-kernel
On Wed, Mar 01, 2017 at 11:56:18AM +0100, Julia Lawall wrote:
>
>
> On Wed, 1 Mar 2017, Aishwarya Pant wrote:
>
> > udelay is impelmented using a busy-wait loop and consumes CPU cycles
> > while usleep_range is implemented using interrupts.cls_flush_uart_write()
> > is called after a channel lock is acquired i.e. an atomic context.
> > Hence delay in this method should use udelay instead of usleep_range.
> >
> > Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
> >
> > ---
> > Changes in v3:
> > - Add a comment in code udelay to ignore checkpatch warning
> > Changes in v2:
> > - Edit commit message to explain why udelay should be used
> >
> > drivers/staging/dgnc/dgnc_cls.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
> > index 28a3e16..ec190e5 100644
> > --- a/drivers/staging/dgnc/dgnc_cls.c
> > +++ b/drivers/staging/dgnc/dgnc_cls.c
> > @@ -609,7 +609,11 @@ 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);
> > +
> > + /* Ignore checkpatch warning to replace udelay by usleep_range
> > + * as this function is called under an atomic context
> > + */
> > + udelay(10);
>
> I think this doesn't follow the proper block comment format?
>
I looked through the coding style docs and found the correct format
for multi-line comments-
/*
* Some comments spanning over
* multiple lines
*/
What is convention for single line comments?
> Anyway, perhaps something like "called in atomic context so usleep_range
> not used" would be sufficient.
>
> julia
>
> >
> > ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
> > }
> > --
> > 2.7.4
> >
> > --
> > 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/20170301103315.GA4448%40aishwarya.
> > For more options, visit https://groups.google.com/d/optout.
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH v3] staging: dgnc: replace usleep_range with udelay
2017-03-01 11:12 ` Aishwarya Pant
@ 2017-03-01 13:07 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2017-03-01 13:07 UTC (permalink / raw)
To: Aishwarya Pant
Cc: Julia Lawall, Lidza Louina, Mark Hounschell, Greg Kroah-Hartman,
outreachy-kernel
On Wed, 1 Mar 2017, Aishwarya Pant wrote:
> On Wed, Mar 01, 2017 at 11:56:18AM +0100, Julia Lawall wrote:
> >
> >
> > On Wed, 1 Mar 2017, Aishwarya Pant wrote:
> >
> > > udelay is impelmented using a busy-wait loop and consumes CPU cycles
> > > while usleep_range is implemented using interrupts.cls_flush_uart_write()
> > > is called after a channel lock is acquired i.e. an atomic context.
> > > Hence delay in this method should use udelay instead of usleep_range.
> > >
> > > Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
> > >
> > > ---
> > > Changes in v3:
> > > - Add a comment in code udelay to ignore checkpatch warning
> > > Changes in v2:
> > > - Edit commit message to explain why udelay should be used
> > >
> > > drivers/staging/dgnc/dgnc_cls.c | 6 +++++-
> > > 1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
> > > index 28a3e16..ec190e5 100644
> > > --- a/drivers/staging/dgnc/dgnc_cls.c
> > > +++ b/drivers/staging/dgnc/dgnc_cls.c
> > > @@ -609,7 +609,11 @@ 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);
> > > +
> > > + /* Ignore checkpatch warning to replace udelay by usleep_range
> > > + * as this function is called under an atomic context
> > > + */
> > > + udelay(10);
> >
> > I think this doesn't follow the proper block comment format?
> >
>
> I looked through the coding style docs and found the correct format
> for multi-line comments-
> /*
> * Some comments spanning over
> * multiple lines
> */
>
> What is convention for single line comments?
/* text */
julia
>
> > Anyway, perhaps something like "called in atomic context so usleep_range
> > not used" would be sufficient.
> >
> > julia
> >
> > >
> > > ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
> > > }
> > > --
> > > 2.7.4
> > >
> > > --
> > > 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/20170301103315.GA4448%40aishwarya.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-01 13:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01 10:33 [PATCH v3] staging: dgnc: replace usleep_range with udelay Aishwarya Pant
2017-03-01 10:56 ` [Outreachy kernel] " Julia Lawall
2017-03-01 11:12 ` Aishwarya Pant
2017-03-01 13:07 ` Julia Lawall
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.