diff mbox

[U-Boot,v2] MUSB timeout broken

Message ID 1309795932-17154-1-git-send-email-of@flatfrog.com
State Accepted
Commit 8c8650181904cee37721fa303622cd37255d51d6
Delegated to: Marek Vasut
Headers show

Commit Message

Orjan Friberg July 4, 2011, 4:12 p.m. UTC
Use pre-decrement to leave timeout at 0 when the timeout happens (which is what
the timeout detecting code expects).

Signed-off-by: Orjan Friberg <of@flatfrog.com>
---
 drivers/usb/musb/musb_hcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Remy Bohmer Aug. 8, 2011, 7:26 p.m. UTC | #1
Hi,

2011/7/4 Orjan Friberg <of@flatfrog.com>:
> Use pre-decrement to leave timeout at 0 when the timeout happens (which is what
> the timeout detecting code expects).
>
> Signed-off-by: Orjan Friberg <of@flatfrog.com>
> ---
>  drivers/usb/musb/musb_hcd.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
> index 974bb31..adcf7f7 100644
> --- a/drivers/usb/musb/musb_hcd.c
> +++ b/drivers/usb/musb/musb_hcd.c
> @@ -1114,7 +1114,7 @@ int usb_lowlevel_init(void)
>         * should be a usb device connected.
>         */
>        timeout = musb_cfg.timeout;
> -       while (timeout--)
> +       while (--timeout)
>                if (readb(&musbr->devctl) & MUSB_DEVCTL_HM)
>                        break;
>

Applied to u-boot-usb

Thanks.

Remy
Remy Bohmer Aug. 8, 2011, 7:37 p.m. UTC | #2
Hi,

> 2011/7/4 Orjan Friberg <of@flatfrog.com>:
>> Use pre-decrement to leave timeout at 0 when the timeout happens (which is what
>> the timeout detecting code expects).
>>
>> Signed-off-by: Orjan Friberg <of@flatfrog.com>
>> ---
>>  drivers/usb/musb/musb_hcd.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
>> index 974bb31..adcf7f7 100644
>> --- a/drivers/usb/musb/musb_hcd.c
>> +++ b/drivers/usb/musb/musb_hcd.c
>> @@ -1114,7 +1114,7 @@ int usb_lowlevel_init(void)
>>         * should be a usb device connected.
>>         */
>>        timeout = musb_cfg.timeout;
>> -       while (timeout--)
>> +       while (--timeout)
>>                if (readb(&musbr->devctl) & MUSB_DEVCTL_HM)
>>                        break;
>>
>
> Applied to u-boot-usb

Whoops... Not applied to u-boot-usb, since the timeout code is broken.
It should wait for a certain time, not a certain count.

Kind regards,

Remy
Orjan Friberg Aug. 9, 2011, 8:52 a.m. UTC | #3
On 2011-08-08 21:37, Remy Bohmer wrote:
> Whoops... Not applied to u-boot-usb, since the timeout code is broken.
> It should wait for a certain time, not a certain count.

Agreed, patch withdrawn.
diff mbox

Patch

diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
index 974bb31..adcf7f7 100644
--- a/drivers/usb/musb/musb_hcd.c
+++ b/drivers/usb/musb/musb_hcd.c
@@ -1114,7 +1114,7 @@  int usb_lowlevel_init(void)
 	 * should be a usb device connected.
 	 */
 	timeout = musb_cfg.timeout;
-	while (timeout--)
+	while (--timeout)
 		if (readb(&musbr->devctl) & MUSB_DEVCTL_HM)
 			break;