Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752737AbcLFJ1T (ORCPT ); Tue, 6 Dec 2016 04:27:19 -0500 Received: from web01.01d.eu ([5.200.27.195]:44324 "EHLO web01.01d.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752591AbcLFJ1N (ORCPT ); Tue, 6 Dec 2016 04:27:13 -0500 From: Shiva Kerdel To: lidza.louina@gmail.com Cc: markh@compro.net, gregkh@linuxfoundation.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Shiva Kerdel Subject: [PATCH v2] Staging: dgnc: dgnc_*.c: Use usleep_range over udelay to improve coalescing processor wakeups Date: Tue, 6 Dec 2016 09:59:58 +0100 Message-Id: <20161206085958.5286-1-shiva@exdev.nl> X-Mailer: git-send-email 2.10.2 X-Authenticated-Id: shiva@exdev.nl Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2759 Lines: 96 In most cases, usleep_range is better than udelay, as the precise wakeup from udelay is unnecessary. usleep_range gives a much better chance of coalescing processor wakeups. Signed-off-by: Shiva Kerdel --- Changes for v2: - Squashed the two commits to one patch. 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 c20ffdd..6607243a 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -409,7 +409,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) @@ -631,7 +631,7 @@ static void cls_flush_uart_read(struct channel_t *ch) * Presumably, this is a bug in this UART. */ - udelay(10); + usleep_range(10, 20); } /* @@ -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); diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 3eefefe..20bc271 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -1352,7 +1352,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, 20); else break; } @@ -1384,7 +1384,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, 20); else break; } @@ -1616,7 +1616,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, 20); } static void neo_send_start_character(struct channel_t *ch) @@ -1628,7 +1628,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, 20); } } @@ -1641,7 +1641,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, 20); } } -- 2.10.2