Skip to contentSkip to conversation

staging: dgnc: replace usleep_range with udelay

PATCH Superseded Aishwarya Pant 2 participants 2 messages Mar 1, 2017 Staging

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

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

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.

---
Change in v2:
- Edit commit message to explain why udelay should be used

 drivers/staging/dgnc/dgnc_cls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/dgnc/dgnc_cls.c +1 -1
index 28a3e16..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);
 }
Signature · 1 line
2.7.4
#1 lore raw
Quoted 10 lines · Aishwarya Pant

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.

---
Change in v2:
- Edit commit message to explain why udelay should be used

No, put a comment in the code above the line itself about this.

thanks,

greg k-h