Skip to contentSkip to conversation

staging: dgnc: replace udelay with usleep_range

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

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

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

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.

---
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(-)
drivers/staging/dgnc/dgnc_cls.c +2 -2
index c20ffdd..7068c3b 100644
@@ -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);
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 48 lines · Aishwarya Pant

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.

---
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(-)
drivers/staging/dgnc/dgnc_cls.c +2 -2
index c20ffdd..7068c3b 100644
@@ -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);
 
Signature · 1 line
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?

#2 lore raw
Quoted 46 lines · Aishwarya Pant
Quoted 45 lines · Aishwarya Pant

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.

---
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(-)
drivers/staging/dgnc/dgnc_cls.c +2 -2
index c20ffdd..7068c3b 100644
@@ -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);
 
Quoted 8 lines
Quoted 3 lines
Signature · 1 line
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.