From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933439AbcESSQU (ORCPT ); Thu, 19 May 2016 14:16:20 -0400 Received: from smtp129.dfw.emailsrvr.com ([67.192.241.129]:39968 "EHLO smtp129.dfw.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932872AbcESSQA (ORCPT ); Thu, 19 May 2016 14:16:00 -0400 X-Auth-ID: abbotti@mev.co.uk X-Sender-Id: abbotti@mev.co.uk From: Ian Abbott To: devel@driverdev.osuosl.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten , linux-kernel@vger.kernel.org Subject: [PATCH v4 14/14] staging: comedi: daqboard2000: prefer usleep_range() Date: Thu, 19 May 2016 19:15:27 +0100 Message-Id: <1463681727-9407-15-git-send-email-abbotti@mev.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1463681727-9407-1-git-send-email-abbotti@mev.co.uk> References: <1463478773-5916-1-git-send-email-abbotti@mev.co.uk> <1463681727-9407-1-git-send-email-abbotti@mev.co.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The checkpatch.pl warns about two `udelay(x)` calls, one of 100 microseconds, and one of 10 microseconds. The 100 microseconds one is used when waiting for FPGA to become ready to accept firmware, and is not that critical, so replace it with a call to `usleep_range(100, 1000)`. The 10 microseconds one is called as each 16-bit word of firmware data is written. Replace it with a fairly tight `usleep_range(10, 20)` to avoid slowing down firmware loading too much. The firmware is fairly short, so this would only slow it down firmware loading by about 20 milliseconds or so. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten --- v2: Replaced the 10 microsecond udelay with a fairly tight usleep_range, as suggested by Hartley. v3, v4: No change. --- drivers/staging/comedi/drivers/daqboard2000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index fd9fb21..b259d41 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -476,7 +476,7 @@ static int daqboard2000_poll_cpld(struct comedi_device *dev, int mask) result = 1; break; } - udelay(100); + usleep_range(100, 1000); } udelay(5); return result; @@ -486,7 +486,7 @@ static int daqboard2000_write_cpld(struct comedi_device *dev, int data) { int result = 0; - udelay(10); + usleep_range(10, 20); writew(data, dev->mmio + 0x1000); if ((readw(dev->mmio + 0x1000) & DAQBOARD2000_CPLD_INIT) == DAQBOARD2000_CPLD_INIT) { -- 2.8.1