All of lore.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
Subject: Re: [PATCH 1/1] usb: usleep_range is preferred over udelay where wakeup is flexible
Date: Wed, 24 Jun 2015 21:15:03 +0530	[thread overview]
Message-ID: <20150624154503.GA2557@sunny-DevBox> (raw)
In-Reply-To: <1435128869-20263-1-git-send-email-sunny.kumar.roy@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

Ok then,
This might be the final lower and upper limit value.

Sunny Kumar

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 <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..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
> 

[-- Attachment #2: 0001-usb-usleep_range-is-preferred-over-udelay-where-wake.patch --]
[-- Type: text/x-diff, Size: 1202 bytes --]

>From 62bc3514ec4da51e7e766199d00de0594b17d23b Mon Sep 17 00:00:00 2001
From: Sunny Kumar <sunny.kumar.roy@gmail.com>
Date: Wed, 24 Jun 2015 21:07:18 +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 <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-24 15:45 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 [this message]
2015-06-25 15:30 ` Sunny Kumar

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=20150624154503.GA2557@sunny-DevBox \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.