diff mbox series

usb: host: ehci-sched: try to turn on io watchdog as long as periodic_count > 0

Message ID 20230809065327.952368-1-xu.yang_2@nxp.com (mailing list archive)
State Accepted
Commit c272dabf2d43c3523af1a40be3127e7a1f84540a
Headers show
Series usb: host: ehci-sched: try to turn on io watchdog as long as periodic_count > 0 | expand

Commit Message

Xu Yang Aug. 9, 2023, 6:53 a.m. UTC
If initially isoc_count = 0, periodic_count > 0 and the io watchdog is
not started (e.g. just timed out), then the io watchdog may not run after
submitting isoc urbs and enable_periodic(). The isoc urbs may not complete
forever if the controller had already stopped periodic schedule.

This will try to call turn_on_io_watchdog() for each enable_periodic() to
ensure the io watchdog functions properly.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 drivers/usb/host/ehci-sched.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Alan Stern Aug. 9, 2023, 2:12 p.m. UTC | #1
On Wed, Aug 09, 2023 at 02:53:27PM +0800, Xu Yang wrote:
> If initially isoc_count = 0, periodic_count > 0 and the io watchdog is
> not started (e.g. just timed out), then the io watchdog may not run after
> submitting isoc urbs and enable_periodic(). The isoc urbs may not complete
> forever if the controller had already stopped periodic schedule.
> 
> This will try to call turn_on_io_watchdog() for each enable_periodic() to
> ensure the io watchdog functions properly.
> 
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
>  drivers/usb/host/ehci-sched.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
> index bd542b6fc46b..7e834587e7de 100644
> --- a/drivers/usb/host/ehci-sched.c
> +++ b/drivers/usb/host/ehci-sched.c
> @@ -490,13 +490,14 @@ static int tt_no_collision(
>  static void enable_periodic(struct ehci_hcd *ehci)
>  {
>  	if (ehci->periodic_count++)
> -		return;
> +		goto out;
>  
>  	/* Stop waiting to turn off the periodic schedule */
>  	ehci->enabled_hrtimer_events &= ~BIT(EHCI_HRTIMER_DISABLE_PERIODIC);
>  
>  	/* Don't start the schedule until PSS is 0 */
>  	ehci_poll_PSS(ehci);
> +out:
>  	turn_on_io_watchdog(ehci);
>  }

Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
diff mbox series

Patch

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index bd542b6fc46b..7e834587e7de 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -490,13 +490,14 @@  static int tt_no_collision(
 static void enable_periodic(struct ehci_hcd *ehci)
 {
 	if (ehci->periodic_count++)
-		return;
+		goto out;
 
 	/* Stop waiting to turn off the periodic schedule */
 	ehci->enabled_hrtimer_events &= ~BIT(EHCI_HRTIMER_DISABLE_PERIODIC);
 
 	/* Don't start the schedule until PSS is 0 */
 	ehci_poll_PSS(ehci);
+out:
 	turn_on_io_watchdog(ehci);
 }