staging: dgnc: use usleep_range instead of udelay
PATCH 1/1 staging: dgnc: use usleep_range instead of udelay
This patch fixes the checkpatch.pl check
CHECK: usleep_range is preferred over udelay
--- drivers/staging/dgnc/dgnc_cls.c | 6 +++--- drivers/staging/dgnc/dgnc_neo.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/staging/dgnc/dgnc_cls.c +3 -3
@@ -397,7 +397,7 @@ static void cls_assert_modem_signals(struct channel_t *ch)writeb (out, &ch->ch_cls_uart->mcr);/* Give time for the UART to actually drop the signals */ -udelay (10 ); +usleep_range (10 ); }static void cls_copy_data_from_queue_to_uart (struct channel_t *ch)
@@ -587,7 +587,7 @@ static void cls_flush_uart_write(struct channel_t *ch) &ch->ch_cls_uart->isr_fcr);/* Must use *delay family functions in atomic context */ -udelay (10 ); +usleep_range (10 ); ch->ch_flags |= (CH_TX_FIFO_EMPTY |CH_TX_FIFO_LWM ); }
@@ -609,7 +609,7 @@ static void cls_flush_uart_read(struct channel_t *ch)* Presumably, this is a bug in this UART. */ -udelay (10 ); +usleep_range (10 ); }/* Send any/all changes to the line to the UART. */
drivers/staging/dgnc/dgnc_neo.c +5 -5
@@ -1230,7 +1230,7 @@ static void neo_flush_uart_write(struct channel_t *ch)*/ tmp =readb (&ch->ch_neo_uart->isr_fcr);if (tmp &4 ) -udelay (10 ); +usleep_range (10 );else break ; }
@@ -1261,7 +1261,7 @@ static void neo_flush_uart_read(struct channel_t *ch)*/ tmp =readb (&ch->ch_neo_uart->isr_fcr);if (tmp &2 ) -udelay (10 ); +usleep_range (10 );else break ; }
@@ -1483,7 +1483,7 @@ static void neo_assert_modem_signals(struct channel_t *ch)neo_pci_posting_flush (ch->ch_bd);/* Give time for the UART to actually raise/drop the signals */ -udelay (10 ); +usleep_range (10 ); }static void neo_send_start_character (struct channel_t *ch)
@@ -1495,7 +1495,7 @@ static void neo_send_start_character(struct channel_t *ch) ch->ch_xon_sends++;writeb (ch->ch_startc, &ch->ch_neo_uart->txrx);neo_pci_posting_flush (ch->ch_bd); -udelay (10 ); +usleep_range (10 ); } }
@@ -1508,7 +1508,7 @@ static void neo_send_stop_character(struct channel_t *ch) ch->ch_xoff_sends++;writeb (ch->ch_stopc, &ch->ch_neo_uart->txrx);neo_pci_posting_flush (ch->ch_bd); -udelay (10 ); +usleep_range (10 ); } }
Signature · 1 line
2.7.4
I just checked. With the below changes, code compiles. :)
Quoted 103 lines · Keerthi Reddy
This patch fixes the checkpatch.pl check
CHECK:
usleep_rangeis preferred over udelaySigned-off-by Keerthi Reddy <[email protected]>---
drivers/staging/dgnc/dgnc_cls.c | 6 +++--- drivers/staging/dgnc/dgnc_neo.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-)drivers/staging/dgnc/dgnc_cls.c +1
-1@@ -397,7 +397,7 @@ static void cls_assert_modem_signals(struct channel_t *ch)writeb (out, &ch->ch_cls_uart->mcr);/* Give time for the UART to actually drop the signals */ -udelay (10 ); +usleep_range (10 ); }static void
cls_copy_data_from_queue_to_uart(struct channel_t *ch)drivers/staging/dgnc/dgnc_cls.c +2
-2@@ -587,7 +587,7 @@ static void cls_flush_uart_write(struct channel_t *ch) &ch->ch_cls_uart->isr_fcr);/* Must use *delay family functions in atomic context */ -udelay (10 ); +usleep_range (10 ); ch->ch_flags |= (CH_TX_FIFO_EMPTY |CH_TX_FIFO_LWM ); }@@ -609,7 +609,7 @@ static void cls_flush_uart_read(struct channel_t *ch)* Presumably, this is a bug in this UART. */ -udelay (10 ); +usleep_range (10 ); }/* Send any/all changes to the line to the UART. */ drivers/staging/dgnc/dgnc_neo.c +1
-1@@ -1230,7 +1230,7 @@ static void neo_flush_uart_write(struct channel_t*ch) */ tmp =readb (&ch->ch_neo_uart->isr_fcr);if (tmp &4 ) -udelay (10 ); +usleep_range (10 );else break ;}drivers/staging/dgnc/dgnc_neo.c +1
-1@@ -1261,7 +1261,7 @@ static void neo_flush_uart_read(struct channel_t*ch) */ tmp =readb (&ch->ch_neo_uart->isr_fcr);if (tmp &2 ) -udelay (10 ); +usleep_range (10 );else break ;}drivers/staging/dgnc/dgnc_neo.c +1
-1@@ -1483,7 +1483,7 @@ static void neo_assert_modem_signals(struct channel_t *ch) neo_pci_posting_flush(ch->ch_bd);/* Give time for the UART to actually raise/drop the signals */ -udelay (10 ); +usleep_range (10 ); }static void
neo_send_start_character(struct channel_t *ch)drivers/staging/dgnc/dgnc_neo.c +2
-2@@ -1495,7 +1495,7 @@ static void neo_send_start_character(struct channel_t *ch) ch->ch_xon_sends++;writeb (ch->ch_startc, &ch->ch_neo_uart->txrx);neo_pci_posting_flush (ch->ch_bd); -udelay (10 ); +usleep_range (10 ); } }@@ -1508,7 +1508,7 @@ static void neo_send_stop_character(struct channel_t *ch) ch->ch_xoff_sends++;writeb (ch->ch_stopc, &ch->ch_neo_uart->txrx);neo_pci_posting_flush (ch->ch_bd); -udelay (10 ); +usleep_range (10 ); } }Signature · 2 lines
-- 2.7.4
Quoted 1 line · Keerthi Reddy
I just checked. With the below changes, code compiles. :)
This does not seem possible. Probably the files you changes were not selected in the configuration and so they were skipped by the compiler.
julia
Quoted 120 lines · Keerthi Reddy
This patch fixes the checkpatch.pl check CHECK: usleep_range is preferred over udelay Signed-off-by: Keerthi Reddy <[email protected]> --- drivers/staging/dgnc/dgnc_cls.c | 6 +++--- drivers/staging/dgnc/dgnc_neo.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 870ae3d..fb1df19 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -397,7 +397,7 @@ static void cls_assert_modem_signals(struct channel_t *ch) writeb(out, &ch->ch_cls_uart->mcr); /* Give time for the UART to actually drop the signals */ - udelay(10); + usleep_range(10); } static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) @@ -587,7 +587,7 @@ static void cls_flush_uart_write(struct channel_t *ch) &ch->ch_cls_uart->isr_fcr); /* Must use *delay family functions in atomic context */ - udelay(10); + usleep_range(10); ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); } @@ -609,7 +609,7 @@ static void cls_flush_uart_read(struct channel_t *ch) * Presumably, this is a bug in this UART. */ - udelay(10); + usleep_range(10); } /* Send any/all changes to the line to the UART. */ diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index c7cc490..5ec1026 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -1230,7 +1230,7 @@ static void neo_flush_uart_write(struct channel_t *ch) */ tmp = readb(&ch->ch_neo_uart->isr_fcr); if (tmp & 4) - udelay(10); + usleep_range(10); else break; } @@ -1261,7 +1261,7 @@ static void neo_flush_uart_read(struct channel_t *ch) */ tmp = readb(&ch->ch_neo_uart->isr_fcr); if (tmp & 2) - udelay(10); + usleep_range(10); else break; } @@ -1483,7 +1483,7 @@ static void neo_assert_modem_signals(struct channel_t *ch) neo_pci_posting_flush(ch->ch_bd); /* Give time for the UART to actually raise/drop the signals */ - udelay(10); + usleep_range(10); } static void neo_send_start_character(struct channel_t *ch) @@ -1495,7 +1495,7 @@ static void neo_send_start_character(struct channel_t *ch) ch->ch_xon_sends++; writeb(ch->ch_startc, &ch->ch_neo_uart->txrx); neo_pci_posting_flush(ch->ch_bd); - udelay(10); + usleep_range(10); } } @@ -1508,7 +1508,7 @@ static void neo_send_stop_character(struct channel_t *ch) ch->ch_xoff_sends++; writeb(ch->ch_stopc, &ch->ch_neo_uart->txrx); neo_pci_posting_flush(ch->ch_bd); - udelay(10); + usleep_range(10); } } -- 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 [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/33fe8323-6697-4c37-beb1- 5a38c076d8a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 3 lines
Be sure that you have actually produced a .o file for all of the files you have changed before sending a patch
after setting up configuration,
I did *make -j4 * in the root directory and the .o files are created.
The files that were added are driver/staging/dgnc/ are
*built-in.o dgnc_cls.o dgnc_driver.o dgnc_mgmt.o dgnc_neo.o*
Since these .o files are created, I assumed that the code compiles. But still, where the problem could be?
Quoted 2 lines
but to change one function to another you have to know what the old one does and how the new one can preserve the required behavior.
Your suggestion is correct. From now on wards I will learn about the functions
that I will modify. Really thanks on the suggestion.
Thanks,
Keerthi.
Quoted 134 lines · Julia Lawall
Quoted 1 line · Keerthi Reddy
I just checked. With the below changes, code compiles. :)
This does not seem possible. Probably the files you changes were not selected in the configuration and so they were skipped by the compiler.
julia
Quoted 2 lines
On Friday, September 15, 2017 at 11:46:48 PM UTC+5:30, Keerthi Reddy
Quoted 107 lines · wrote:
This patch fixes the checkpatch.pl check CHECK: usleep_range is preferred over udelay Signed-off-by: Keerthi Reddy <[email protected]> --- drivers/staging/dgnc/dgnc_cls.c | 6 +++--- drivers/staging/dgnc/dgnc_neo.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 870ae3d..fb1df19 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -397,7 +397,7 @@ static void cls_assert_modem_signals(struct channel_t *ch) writeb(out, &ch->ch_cls_uart->mcr); /* Give time for the UART to actually drop the signals */ - udelay(10); + usleep_range(10); } static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) @@ -587,7 +587,7 @@ static void cls_flush_uart_write(struct channel_t *ch) &ch->ch_cls_uart->isr_fcr); /* Must use *delay family functions in atomic context */ - udelay(10); + usleep_range(10); ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); } @@ -609,7 +609,7 @@ static void cls_flush_uart_read(struct channel_t *ch) * Presumably, this is a bug in this UART. */ - udelay(10); + usleep_range(10); } /* Send any/all changes to the line to the UART. */ diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index c7cc490..5ec1026 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -1230,7 +1230,7 @@ static void neo_flush_uart_write(struct channel_t *ch) */ tmp = readb(&ch->ch_neo_uart->isr_fcr); if (tmp & 4) - udelay(10); + usleep_range(10); else break; } @@ -1261,7 +1261,7 @@ static void neo_flush_uart_read(struct channel_t *ch) */ tmp = readb(&ch->ch_neo_uart->isr_fcr); if (tmp & 2) - udelay(10); + usleep_range(10); else break; } @@ -1483,7 +1483,7 @@ static void neo_assert_modem_signals(struct channel_t *ch) neo_pci_posting_flush(ch->ch_bd); /* Give time for the UART to actually raise/drop the signals */ - udelay(10); + usleep_range(10); } static void neo_send_start_character(struct channel_t *ch) @@ -1495,7 +1495,7 @@ static void neo_send_start_character(struct channel_t *ch) ch->ch_xon_sends++; writeb(ch->ch_startc, &ch->ch_neo_uart->txrx); neo_pci_posting_flush(ch->ch_bd); - udelay(10); + usleep_range(10); } } @@ -1508,7 +1508,7 @@ static void neo_send_stop_character(struct channel_t *ch) ch->ch_xoff_sends++; writeb(ch->ch_stopc, &ch->ch_neo_uart->txrx); neo_pci_posting_flush(ch->ch_bd); - udelay(10); + usleep_range(10); } } -- 2.7.4Quoted 7 lines
--
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/33fe8323-6697-4c37-beb1-
Quoted 4 lines
5a38c076d8a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 6 lines · Keerthi Reddy
Quoted 1 line
Be sure that you have actually produced a .o file >for all of the files
you have changed before sending a
Quoted 1 line
patch
after setting up configuration,
Quoted 8 lines
I did make -j4 in the root directory and the .o files are created.
The files that were added are driver/staging/dgnc/ are built-in.o dgnc_cls.o dgnc_driver.o dgnc_mgmt.o dgnc_neo.o
Since these .o files are created, I assumed that the code compiles. But still, where the problem could be?
Very strange. I just made your first change, im dgnc_cls, and I get:
CC drivers/staging/dgnc/dgnc_cls.odrivers/staging/dgnc/dgnc_cls.c: In function ‘cls_assert_modem_signals’:drivers/staging/dgnc/dgnc_cls.c:400:2: error: too few arguments to function ‘usleep_range’
usleep_range(10);
^
In file included from drivers/staging/dgnc/dgnc_cls.c:19:0:./include/linux/delay.h:59:6: note: declared here
void usleep_range(unsigned long min, unsigned long max);
^
make[1]: *** [drivers/staging/dgnc/dgnc_cls.o] Error 1
make: *** [drivers/staging/dgnc/dgnc_cls.o] Error 2
This was after make allyesconfig/ So the file is getting compiled, but the compilation should not succeed.
julia
Quoted 177 lines
Quoted 3 lines
but to change one function to another you have to know what the old one does and how the new one can preserve the required behavior.
Your suggestion is correct. From now on wards I will learn about the functions
that I will modify. Really thanks on the suggestion.Thanks,
Keerthi.On Sat, Sep 16, 2017 at 12:36 AM, Julia Lawall <[email protected]> wrote:
On Fri, 15 Sep 2017, Keerthi Reddy wrote: > I just checked. With the below changes, code compiles. :) This does not seem possible. Probably the files you changes were not selected in the configuration and so they were skipped by the compiler. julia > > On Friday, September 15, 2017 at 11:46:48 PM UTC+5:30, Keerthi Reddy wrote: > This patch fixes the checkpatch.pl check > > CHECK: usleep_range is preferred over udelay > > Signed-off-by: Keerthi Reddy <[email protected]> > --- > drivers/staging/dgnc/dgnc_cls.c | 6 +++--- > drivers/staging/dgnc/dgnc_neo.c | 10 +++++----- > 2 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/dgnc/dgnc_cls.c > b/drivers/staging/dgnc/dgnc_cls.c > index 870ae3d..fb1df19 100644 > --- a/drivers/staging/dgnc/dgnc_cls.c > +++ b/drivers/staging/dgnc/dgnc_cls.c > @@ -397,7 +397,7 @@ static void cls_assert_modem_signals(struct > channel_t *ch) > writeb(out, &ch->ch_cls_uart->mcr); > > /* Give time for the UART to actually drop the signals > */ > - udelay(10); > + usleep_range(10); > } > > static void cls_copy_data_from_queue_to_uart(struct channel_t > *ch) > @@ -587,7 +587,7 @@ static void cls_flush_uart_write(struct > channel_t *ch) > &ch->ch_cls_uart->isr_fcr); > > /* Must use *delay family functions in atomic context > */ > - udelay(10); > + usleep_range(10); > > ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); > } > @@ -609,7 +609,7 @@ static void cls_flush_uart_read(struct > channel_t *ch) > * Presumably, this is a bug in this UART. > */ > > - udelay(10); > + usleep_range(10); > } > > /* Send any/all changes to the line to the UART. */ > diff --git a/drivers/staging/dgnc/dgnc_neo.c > b/drivers/staging/dgnc/dgnc_neo.c > index c7cc490..5ec1026 100644 > --- a/drivers/staging/dgnc/dgnc_neo.c > +++ b/drivers/staging/dgnc/dgnc_neo.c > @@ -1230,7 +1230,7 @@ static void neo_flush_uart_write(struct > channel_t *ch) > */ > tmp = readb(&ch->ch_neo_uart->isr_fcr); > if (tmp & 4) > - udelay(10); > + usleep_range(10); > else > break; > } > @@ -1261,7 +1261,7 @@ static void neo_flush_uart_read(struct > channel_t *ch) > */ > tmp = readb(&ch->ch_neo_uart->isr_fcr); > if (tmp & 2) > - udelay(10); > + usleep_range(10); > else > break; > } > @@ -1483,7 +1483,7 @@ static void > neo_assert_modem_signals(struct channel_t *ch) > neo_pci_posting_flush(ch->ch_bd); > > /* Give time for the UART to actually raise/drop the > signals */ > - udelay(10); > + usleep_range(10); > } > > static void neo_send_start_character(struct channel_t *ch) > @@ -1495,7 +1495,7 @@ static void > neo_send_start_character(struct channel_t *ch) > ch->ch_xon_sends++; > writeb(ch->ch_startc, &ch->ch_neo_uart->txrx); > neo_pci_posting_flush(ch->ch_bd); > - udelay(10); > + usleep_range(10); > } > } > > @@ -1508,7 +1508,7 @@ static void neo_send_stop_character(struct > channel_t *ch) > ch->ch_xoff_sends++; > writeb(ch->ch_stopc, &ch->ch_neo_uart->txrx); > neo_pci_posting_flush(ch->ch_bd); > - udelay(10); > + usleep_range(10); > } > } > > -- > 2.7.4 >Quoted 2 lines
--
You received this message because you are subscribed to the GoogleGroups
Quoted 2 lines
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it,send an
Quoted 2 lines
email to [email protected]. To post to this group, send email to
Quoted 1 line
To view this discussion on the webvisithttps://groups.google.com/d/msgid/outreachy-kernel/33fe8323-6697-4c37-
beb1-
Quoted 4 lines
5a38c076d8a2%40googlegroups.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/CABfTi08XDoMB9BsCqO3A%3D Jr6u0RjO49i4z01HHH08hRp6MO28g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 3 lines · Keerthi Reddy
This patch fixes the checkpatch.pl check
CHECK:
usleep_rangeis preferred over udelay
Have you compiled any of this code? Because usleep_range takes two arguments, and you have given it only one. Be sure that you have actually produced a .o file for all of the files you have changed before sending a patch. And don't just blindly follow checkpatch. It says that usleep_range is preferred over udelay, but to change one function to another you have to know what the old one does and how the new one can preserve the required behavior.
julia
Quoted 97 lines
Signed-off-by Keerthi Reddy <[email protected]>--- drivers/staging/dgnc/dgnc_cls.c | 6 +++--- drivers/staging/dgnc/dgnc_neo.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-)drivers/staging/dgnc/dgnc_cls.c +3
-3@@ -397,7 +397,7 @@ static void cls_assert_modem_signals(struct channel_t *ch)writeb (out, &ch->ch_cls_uart->mcr);/* Give time for the UART to actually drop the signals */ -udelay (10 ); +usleep_range (10 ); }static void cls_copy_data_from_queue_to_uart (struct channel_t *ch)@@ -587,7 +587,7 @@ static void cls_flush_uart_write(struct channel_t *ch) &ch->ch_cls_uart->isr_fcr);/* Must use *delay family functions in atomic context */ -udelay (10 ); +usleep_range (10 ); ch->ch_flags |= (CH_TX_FIFO_EMPTY |CH_TX_FIFO_LWM ); }@@ -609,7 +609,7 @@ static void cls_flush_uart_read(struct channel_t *ch)* Presumably, this is a bug in this UART. */ -udelay (10 ); +usleep_range (10 ); }/* Send any/all changes to the line to the UART. */ drivers/staging/dgnc/dgnc_neo.c +5
-6@@ -1230,7 +1230,7 @@ static void neo_flush_uart_write(struct channel_t *ch)*/ tmp =readb (&ch->ch_neo_uart->isr_fcr);if (tmp &4 ) -udelay (10 ); +usleep_range (10 );else break ; }@@ -1261,7 +1261,7 @@ static void neo_flush_uart_read(struct channel_t *ch)*/ tmp =readb (&ch->ch_neo_uart->isr_fcr);if (tmp &2 ) -udelay (10 ); +usleep_range (10 );else break ; }@@ -1483,7 +1483,7 @@ static void neo_assert_modem_signals(struct channel_t *ch)neo_pci_posting_flush (ch->ch_bd);/* Give time for the UART to actually raise/drop the signals */ -udelay (10 ); +usleep_range (10 ); }static void neo_send_start_character (struct channel_t *ch)@@ -1495,7 +1495,7 @@ static void neo_send_start_character(struct channel_t *ch) ch->ch_xon_sends++;writeb (ch->ch_startc, &ch->ch_neo_uart->txrx);neo_pci_posting_flush (ch->ch_bd); -udelay (10 ); +usleep_range (10 ); } }@@ -1508,7 +1508,7 @@ static void neo_send_stop_character(struct channel_t *ch) ch->ch_xoff_sends++;writeb (ch->ch_stopc, &ch->ch_neo_uart->txrx);neo_pci_posting_flush (ch->ch_bd); -udelay (10 ); +usleep_range (10 ); } } --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 [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/20170915181639.GA19334%40manoharreddy.
For more options, visit https://groups.google.com/d/optout.