Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys usb: Factor usb_transfer_complete out of ubm_abortx method.
details: https://anonhg.NetBSD.org/src/rev/c502e6b0f57d
branches: trunk
changeset: 362563:c502e6b0f57d
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Mar 03 06:08:50 2022 +0000
description:
usb: Factor usb_transfer_complete out of ubm_abortx method.
diffstat:
sys/dev/usb/ehci.c | 8 ++------
sys/dev/usb/motg.c | 5 ++---
sys/dev/usb/ohci.c | 9 ++-------
sys/dev/usb/uhci.c | 9 ++-------
sys/dev/usb/usbdi.c | 16 ++++++++++------
sys/dev/usb/xhci.c | 6 ++----
sys/external/bsd/dwc2/dwc2.c | 11 +++--------
7 files changed, 23 insertions(+), 41 deletions(-)
diffs (239 lines):
diff -r 146349b378bb -r c502e6b0f57d sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Thu Mar 03 06:07:11 2022 +0000
+++ b/sys/dev/usb/ehci.c Thu Mar 03 06:08:50 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.303 2022/03/03 06:04:31 riastradh Exp $ */
+/* $NetBSD: ehci.c,v 1.304 2022/03/03 06:08:50 riastradh Exp $ */
/*
* Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.303 2022/03/03 06:04:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.304 2022/03/03 06:08:50 riastradh Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -3388,14 +3388,10 @@
BUS_DMASYNC_PREREAD);
}
- /*
- * Final step: Notify completion to waiting xfers.
- */
dying:
#ifdef DIAGNOSTIC
exfer->ex_isdone = true;
#endif
- usb_transfer_complete(xfer);
DPRINTFN(14, "end", 0, 0, 0, 0);
KASSERT(mutex_owned(&sc->sc_lock));
diff -r 146349b378bb -r c502e6b0f57d sys/dev/usb/motg.c
--- a/sys/dev/usb/motg.c Thu Mar 03 06:07:11 2022 +0000
+++ b/sys/dev/usb/motg.c Thu Mar 03 06:08:50 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: motg.c,v 1.38 2022/03/03 06:04:31 riastradh Exp $ */
+/* $NetBSD: motg.c,v 1.39 2022/03/03 06:08:50 riastradh Exp $ */
/*
* Copyright (c) 1998, 2004, 2011, 2012, 2014 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.38 2022/03/03 06:04:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.39 2022/03/03 06:08:50 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2222,6 +2222,5 @@
}
}
dying:
- usb_transfer_complete(xfer);
KASSERT(mutex_owned(&sc->sc_lock));
}
diff -r 146349b378bb -r c502e6b0f57d sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Thu Mar 03 06:07:11 2022 +0000
+++ b/sys/dev/usb/ohci.c Thu Mar 03 06:08:50 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.319 2022/03/03 06:04:31 riastradh Exp $ */
+/* $NetBSD: ohci.c,v 1.320 2022/03/03 06:08:50 riastradh Exp $ */
/*
* Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.319 2022/03/03 06:04:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.320 2022/03/03 06:08:50 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2409,12 +2409,7 @@
usb_syncmem(&sed->dma, sed->offs + offsetof(ohci_ed_t, ed_flags),
sizeof(sed->ed.ed_flags),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
-
- /*
- * Final step: Notify completion to waiting xfers.
- */
dying:
- usb_transfer_complete(xfer);
DPRINTFN(14, "end", 0, 0, 0, 0);
KASSERT(mutex_owned(&sc->sc_lock));
diff -r 146349b378bb -r c502e6b0f57d sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c Thu Mar 03 06:07:11 2022 +0000
+++ b/sys/dev/usb/uhci.c Thu Mar 03 06:08:50 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.309 2022/03/03 06:04:31 riastradh Exp $ */
+/* $NetBSD: uhci.c,v 1.310 2022/03/03 06:08:50 riastradh Exp $ */
/*
* Copyright (c) 1998, 2004, 2011, 2012, 2016, 2020 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.309 2022/03/03 06:04:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.310 2022/03/03 06:08:50 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2402,15 +2402,10 @@
*/
/* Hardware finishes in 1ms */
usb_delay_ms_locked(upipe->pipe.up_dev->ud_bus, 2, &sc->sc_lock);
-
- /*
- * HC Step 3: Notify completion to waiting xfers.
- */
dying:
#ifdef DIAGNOSTIC
ux->ux_isdone = true;
#endif
- usb_transfer_complete(xfer);
DPRINTFN(14, "end", 0, 0, 0, 0);
KASSERT(mutex_owned(&sc->sc_lock));
diff -r 146349b378bb -r c502e6b0f57d sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c Thu Mar 03 06:07:11 2022 +0000
+++ b/sys/dev/usb/usbdi.c Thu Mar 03 06:08:50 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.226 2022/03/03 06:07:11 riastradh Exp $ */
+/* $NetBSD: usbdi.c,v 1.227 2022/03/03 06:08:50 riastradh Exp $ */
/*
* Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.226 2022/03/03 06:07:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.227 2022/03/03 06:08:50 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1533,11 +1533,13 @@
usbd_xfer_cancel_timeout_async(xfer);
/*
- * We beat everyone else. Claim the status as cancelled and do
- * the bus-specific dance to abort the hardware.
+ * We beat everyone else. Claim the status as cancelled, do
+ * the bus-specific dance to abort the hardware, and complete
+ * the xfer.
*/
xfer->ux_status = USBD_CANCELLED;
bus->ub_methods->ubm_abortx(xfer);
+ usb_transfer_complete(xfer);
}
/*
@@ -1617,11 +1619,13 @@
goto out;
/*
- * We beat everyone else. Claim the status as timed out and do
- * the bus-specific dance to abort the hardware.
+ * We beat everyone else. Claim the status as timed out, do
+ * the bus-specific dance to abort the hardware, and complete
+ * the xfer.
*/
xfer->ux_status = USBD_TIMEOUT;
bus->ub_methods->ubm_abortx(xfer);
+ usb_transfer_complete(xfer);
out: /* All done -- release the lock. */
mutex_exit(bus->ub_lock);
diff -r 146349b378bb -r c502e6b0f57d sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c Thu Mar 03 06:07:11 2022 +0000
+++ b/sys/dev/usb/xhci.c Thu Mar 03 06:08:50 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.156 2022/03/03 06:04:31 riastradh Exp $ */
+/* $NetBSD: xhci.c,v 1.157 2022/03/03 06:08:50 riastradh Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.156 2022/03/03 06:04:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.157 2022/03/03 06:08:50 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2154,8 +2154,6 @@
xhci_pipe_restart(xfer->ux_pipe);
- usb_transfer_complete(xfer);
-
DPRINTFN(14, "end", 0, 0, 0, 0);
}
diff -r 146349b378bb -r c502e6b0f57d sys/external/bsd/dwc2/dwc2.c
--- a/sys/external/bsd/dwc2/dwc2.c Thu Mar 03 06:07:11 2022 +0000
+++ b/sys/external/bsd/dwc2/dwc2.c Thu Mar 03 06:08:50 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc2.c,v 1.78 2022/03/03 06:04:31 riastradh Exp $ */
+/* $NetBSD: dwc2.c,v 1.79 2022/03/03 06:08:50 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.78 2022/03/03 06:04:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.79 2022/03/03 06:08:50 riastradh Exp $");
#include "opt_usb.h"
@@ -515,7 +515,7 @@
}
/*
- * HC Step 1: Handle the hardware.
+ * Handle the hardware.
*/
err = dwc2_hcd_urb_dequeue(hsotg, dxfer->urb);
if (err) {
@@ -524,11 +524,6 @@
dying:
mutex_spin_exit(&hsotg->lock);
-
- /*
- * Final Step: Notify completion to waiting xfers.
- */
- usb_transfer_complete(xfer);
KASSERT(mutex_owned(&sc->sc_lock));
}
Home |
Main Index |
Thread Index |
Old Index