Skip to contentSkip to conversation

staging: dgnc: dgnc_cls.c: usleep_range is preferred over udelay

PATCH In review Anchal Jain 2 participants 2 messages Sep 13, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: dgnc: dgnc_cls.c: usleep_range is preferred over udelay

According to Documentation/timers/timers-howto.txt" udelay() is only called once from a place where sleeping is allowed. We can replace it with a call to usleep_range()
with a reasonable upper limit

---

Change in v2:
-By mistake another patch was mixed so, Remove that patch file

 drivers/staging/dgnc/dgnc_cls.c      |  6 +++---
 drivers/staging/wilc1000/linux_mon.c | 11 +++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/staging/dgnc/dgnc_cls.c +3 -3
index 4e1e0dc6..1b07255 100644
@@ -410,7 +410,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, 20);
 }
 
 static void cls_copy_data_from_queue_to_uart(struct channel_t *ch)
@@ -632,7 +632,7 @@ static void cls_flush_uart_read(struct channel_t *ch)
 	 * Presumably, this is a bug in this UART.
 	 */
 
-	udelay(10);
+	usleep_delay(10, 20);
 }
 
 /*
@@ -1104,7 +1104,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_delay(10, 20);
 
 	ch->ch_flags |= (CH_FIFO_ENABLED | CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
 
maintainer
#1 lore raw
Quoted 20 lines · Anchal Jain

According to Documentation/timers/timers-howto.txt" udelay() is only called once from a place where sleeping is allowed. We can replace it with a call to usleep_range()
with a reasonable upper limit

---

Change in v2:
-By mistake another patch was mixed so, Remove that patch file

 drivers/staging/dgnc/dgnc_cls.c      |  6 +++---
 drivers/staging/wilc1000/linux_mon.c | 11 +++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/staging/dgnc/dgnc_cls.c +0 -0
index 4e1e0dc6..1b07255 100644

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

Quoted 8 lines
drivers/staging/dgnc/dgnc_cls.c +1 -1
@@ -410,7 +410,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, 20);
 }
 
 static void cls_copy_data_from_queue_to_uart(struct channel_t *ch)

As others pointed out, this isn't ok to change, sorry.

greg k-h