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 <[email protected]>
---
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
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 <[email protected]>
> ---
> 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
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 <[email protected]>
> ---
> 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
>
Please don't top-post.
On Wed, 24 Jun 2015, Sunny Kumar wrote:
> Ok so what about putting lower limit to 125 and increase upper limit 200
Or even just 150. That would be fine.
Alan Stern
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 <[email protected]>
> ---
> 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
>
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 <[email protected]>
---
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