public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sunny Kumar <sunny.kumar.roy@gmail.com>
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
Cc: Sunny Kumar <sunny.kumar.roy@gmail.com>
Subject: [PATCH 1/1] usb: usleep_range is preferred over udelay where wakeup is flexible
Date: Thu, 25 Jun 2015 21:00:48 +0530	[thread overview]
Message-ID: <1435246248-3838-1-git-send-email-sunny.kumar.roy@gmail.com> (raw)
In-Reply-To: <1435128869-20263-1-git-send-email-sunny.kumar.roy@gmail.com>

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 <sunny.kumar.roy@gmail.com>
---
 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..5e67f63 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, 150);
 
 	if (transfer_length) {
 		unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ? 
-- 
1.9.1


      parent reply	other threads:[~2015-06-25 15:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24  6:54 [PATCH 1/1] usb: usleep_range is preferred over udelay where wakeup is flexible Sunny Kumar
2015-06-24 13:44 ` Alan Stern
2015-06-24 14:28 ` Sunny Kumar
2015-06-24 14:35   ` Alan Stern
2015-06-24 15:45 ` Sunny Kumar
2015-06-25 15:30 ` Sunny Kumar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435246248-3838-1-git-send-email-sunny.kumar.roy@gmail.com \
    --to=sunny.kumar.roy@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mdharm-usb@one-eyed-alien.net \
    --cc=usb-storage@lists.one-eyed-alien.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox