Skip to contentSkip to conversation

staging: dgnc: replace udelay with usleep_range

PATCH Superseded Aishwarya Pant 2 participants 3 messages Feb 27, 2017 Staging

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: dgnc: replace udelay with usleep_range

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).

---
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(-)
drivers/staging/dgnc/dgnc_cls.c +3 -3
index 2cf146e..368c6ba 100644
@@ -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);
 }
 
 /*
Signature · 1 line
2.7.4
#1 lore raw
Quoted 38 lines · Aishwarya Pant

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).

---
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(-)
drivers/staging/dgnc/dgnc_cls.c +2 -2
index 2cf146e..368c6ba 100644
@@ -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);
 }

drivers/staging/dgnc/dgnc_cls.c static void cls_flush_uart_read(struct channel_t *ch) · line 637

Quoted 8 lines
drivers/staging/dgnc/dgnc_cls.c +1 -1
@@ -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 :(

#2 lore raw
Quoted 42 lines · Greg Kroah-Hartman
Quoted 41 lines · Aishwarya Pant

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).

---
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(-)
drivers/staging/dgnc/dgnc_cls.c +2 -2
index 2cf146e..368c6ba 100644
@@ -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.
 	 */
 
Quoted 7 lines

drivers/staging/dgnc/dgnc_cls.c static void cls_flush_uart_read(struct channel_t *ch) · line 637

Quoted 5 lines
drivers/staging/dgnc/dgnc_cls.c +1 -1
-	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.