Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753596AbbFXO0f (ORCPT ); Wed, 24 Jun 2015 10:26:35 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:36546 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752196AbbFXO0Z (ORCPT ); Wed, 24 Jun 2015 10:26:25 -0400 Date: Wed, 24 Jun 2015 19:58:48 +0530 From: Sunny Kumar To: mdharm-usb@one-eyed-alien.net, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] usb: usleep_range is preferred over udelay where wakeup is flexible Message-ID: <20150624142848.GA6226@debianBox.chennai.cdac.in> References: <1435128869-20263-1-git-send-email-sunny.kumar.roy@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="SUOF0GtieIMvvwua" Content-Disposition: inline In-Reply-To: <1435128869-20263-1-git-send-email-sunny.kumar.roy@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2884 Lines: 81 --SUOF0GtieIMvvwua Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Ok so what about putting lower limit to 125 and increase upper limit 200 Sunny On Wed, Jun 24, 2015 at 12:24:29PM +0530, Sunny Kumar wrote: > 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. > > Signed-off-by: Sunny Kumar > --- > drivers/usb/storage/transport.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c > index 540add2..7cd45ac 100644 > --- a/drivers/usb/storage/transport.c > +++ b/drivers/usb/storage/transport.c > @@ -1111,7 +1111,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) > * command phase and the data phase. Some devices need a little > * more than that, probably because of clock rate inaccuracies. */ > if (unlikely(us->fflags & US_FL_GO_SLOW)) > - udelay(125); > + usleep_range(100, 125); > > if (transfer_length) { > unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ? > -- > 2.1.4 > --SUOF0GtieIMvvwua Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-usb-usleep_range-is-preferred-over-udelay-where-wake.patch" >From 89648c1532e860b986fc5286245c404ddbe45b35 Mon Sep 17 00:00:00 2001 From: Sunny Kumar Date: Wed, 24 Jun 2015 19:50:30 +0530 Subject: [PATCH 1/1] usb: usleep_range is preferred over udelay where wakeup is flexible 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. Signed-off-by: Sunny Kumar --- drivers/usb/storage/transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 540add2..7e397f8 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -1111,7 +1111,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) * command phase and the data phase. Some devices need a little * more than that, probably because of clock rate inaccuracies. */ if (unlikely(us->fflags & US_FL_GO_SLOW)) - udelay(125); + usleep_range(125, 200); if (transfer_length) { unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ? -- 2.1.4 --SUOF0GtieIMvvwua-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/