Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb xhci(4): Fix error branch for failed suspend.



details:   https://anonhg.NetBSD.org/src/rev/68aabd6418ef
branches:  trunk
changeset: 369611:68aabd6418ef
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Aug 23 15:16:44 2022 +0000

description:
xhci(4): Fix error branch for failed suspend.

If suspend failed, at least we can stop it from blocking all
subsequent xhci commands or making a second suspend crash.

diffstat:

 sys/dev/usb/xhci.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 2f7a754b5fc0 -r 68aabd6418ef sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Tue Aug 23 14:54:50 2022 +0000
+++ b/sys/dev/usb/xhci.c        Tue Aug 23 15:16:44 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.167 2022/05/24 20:50:19 andvar Exp $        */
+/*     $NetBSD: xhci.c,v 1.168 2022/08/23 15:16:44 riastradh Exp $     */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.167 2022/05/24 20:50:19 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.168 2022/08/23 15:16:44 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -896,6 +896,16 @@
        ok = true;
 
 out:   mutex_exit(&sc->sc_rhlock);
+       if (!ok) {
+               /*
+                * If suspend failed, resume command issuance.
+                */
+               mutex_enter(&sc->sc_lock);
+               KASSERT(sc->sc_suspender == curlwp);
+               sc->sc_suspender = NULL;
+               cv_broadcast(&sc->sc_cmdbusy_cv);
+               mutex_exit(&sc->sc_lock);
+       }
        return ok;
 }
 



Home | Main Index | Thread Index | Old Index