Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753277AbbFXNol (ORCPT ); Wed, 24 Jun 2015 09:44:41 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:46075 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753127AbbFXNod (ORCPT ); Wed, 24 Jun 2015 09:44:33 -0400 Date: Wed, 24 Jun 2015 09:44:31 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Sunny Kumar cc: mdharm-usb@one-eyed-alien.net, , , , , Subject: Re: [PATCH 1/1] usb: usleep_range is preferred over udelay where wakeup is flexible In-Reply-To: <1435128869-20263-1-git-send-email-sunny.kumar.roy@gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1349 Lines: 34 On Wed, 24 Jun 2015, 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); You said you were going to use a reasonable upper limit. Instead, you left the upper limit the same and decreased the lower limit, which could cause errors. Alan Stern -- 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/