Module Name: src
Committed By: riastradh
Date: Wed May 26 22:37:21 UTC 2021
Modified Files:
src/sys/dev/usb: xhci.c
Log Message:
xhci: Fix logic in waiting for command queue access.
_Either_ an existing command in progress, _or_ an existing suspend in
progress that is not done by us, should block us; the logic I wrote
previously erroneously blocked only if both conditions happened at
the same time.
Should fix issue reported by Andrius V in the PR kern/56050 followup
discussion.
To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/dev/usb/xhci.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.140 src/sys/dev/usb/xhci.c:1.141
--- src/sys/dev/usb/xhci.c:1.140 Sun May 23 21:12:28 2021
+++ src/sys/dev/usb/xhci.c Wed May 26 22:37:21 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.140 2021/05/23 21:12:28 riastradh Exp $ */
+/* $NetBSD: xhci.c,v 1.141 2021/05/26 22:37:21 riastradh Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.140 2021/05/23 21:12:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.141 2021/05/26 22:37:21 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -3194,9 +3194,8 @@ xhci_do_command_locked(struct xhci_softc
KASSERTMSG(!cpu_intr_p() && !cpu_softintr_p(), "called from intr ctx");
KASSERT(mutex_owned(&sc->sc_lock));
- while (sc->sc_command_addr != 0 &&
- sc->sc_suspender != NULL &&
- sc->sc_suspender != curlwp)
+ while (sc->sc_command_addr != 0 ||
+ (sc->sc_suspender != NULL && sc->sc_suspender != curlwp))
cv_wait(&sc->sc_cmdbusy_cv, &sc->sc_lock);
/*