Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/nick-nhusb]: src/sys/dev/usb ex_isdone / ux_state tidyup
details: https://anonhg.NetBSD.org/src/rev/ba2b7a3af5d1
branches: nick-nhusb
changeset: 334124:ba2b7a3af5d1
user: skrll <skrll%NetBSD.org@localhost>
date: Mon Mar 02 21:52:02 2015 +0000
description:
ex_isdone / ux_state tidyup
diffstat:
sys/dev/usb/ehci.c | 69 +++++++++++++++++----------------------------------
sys/dev/usb/ehcivar.h | 4 +-
2 files changed, 25 insertions(+), 48 deletions(-)
diffs (192 lines):
diff -r 9d3e622b9760 -r ba2b7a3af5d1 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Sun Mar 01 08:33:15 2015 +0000
+++ b/sys/dev/usb/ehci.c Mon Mar 02 21:52:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.234.2.34 2015/03/01 08:26:55 skrll Exp $ */
+/* $NetBSD: ehci.c,v 1.234.2.35 2015/03/02 21:52:02 skrll Exp $ */
/*
* Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.34 2015/03/01 08:26:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.35 2015/03/02 21:52:02 skrll Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -1018,16 +1018,15 @@
USBHIST_LOG(ehcidebug, "ex=%p", ex, 0, 0, 0);
#ifdef DIAGNOSTIC
+#ifdef EHCI_DEBUG
if (ex->ex_isdone) {
- printf("ehci_idone: ex=%p is done!\n", ex);
-#ifdef EHCI_DEBUG
USBHIST_LOGN(ehcidebug, 5, "--- dump start ---", 0, 0, 0, 0);
ehci_dump_exfer(ex);
USBHIST_LOGN(ehcidebug, 5, "--- dump end ---", 0, 0, 0, 0);
+ }
#endif
- return;
- }
- ex->ex_isdone = 1;
+ KASSERT(!ex->ex_isdone);
+ ex->ex_isdone = true;
#endif
if (xfer->ux_status == USBD_CANCELLED ||
@@ -1519,7 +1518,7 @@
if (xfer != NULL) {
memset(xfer, 0, sizeof(struct ehci_xfer));
#ifdef DIAGNOSTIC
- EXFER(xfer)->ex_isdone = 1;
+ EXFER(xfer)->ex_isdone = true;
xfer->ux_state = XFER_BUSY;
#endif
}
@@ -1531,15 +1530,10 @@
{
struct ehci_softc *sc = bus->ub_hcpriv;
+ KASSERT(xfer->ux_state == XFER_BUSY);
+ KASSERT(EXFER(xfer)->ex_isdone);
#ifdef DIAGNOSTIC
- if (xfer->ux_state != XFER_BUSY) {
- printf("ehci_freex: xfer=%p not busy, 0x%08x\n", xfer,
- xfer->ux_state);
- }
xfer->ux_state = XFER_FREE;
- if (!EXFER(xfer)->ex_isdone) {
- printf("ehci_freex: !isdone\n");
- }
#endif
pool_cache_put(sc->sc_xferpool, xfer);
}
@@ -3238,7 +3232,7 @@
* Step 4: Execute callback.
*/
#ifdef DIAGNOSTIC
- exfer->ex_isdone = 1;
+ exfer->ex_isdone = true;
#endif
wake = xfer->ux_hcflags & UXFER_ABORTWAIT;
xfer->ux_hcflags &= ~(UXFER_ABORTING | UXFER_ABORTWAIT);
@@ -3343,7 +3337,7 @@
cv_wait(&sc->sc_softwake_cv, &sc->sc_lock);
#ifdef DIAGNOSTIC
- exfer->ex_isdone = 1;
+ exfer->ex_isdone = true;
#endif
wake = xfer->ux_hcflags & UXFER_ABORTWAIT;
xfer->ux_hcflags &= ~(UXFER_ABORTING | UXFER_ABORTWAIT);
@@ -3613,11 +3607,9 @@
exfer->ex_sqtdstart = setup;
exfer->ex_sqtdend = stat;
+ KASSERT(exfer->ex_isdone);
#ifdef DIAGNOSTIC
- if (!exfer->ex_isdone) {
- printf("ehci_device_request: not done, exfer=%p\n", exfer);
- }
- exfer->ex_isdone = 0;
+ exfer->ex_isdone = false;
#endif
/* Insert qTD in QH list. */
@@ -3748,11 +3740,9 @@
/* Set up interrupt info. */
exfer->ex_sqtdstart = data;
exfer->ex_sqtdend = dataend;
+ KASSERT(exfer->ex_isdone);
#ifdef DIAGNOSTIC
- if (!exfer->ex_isdone) {
- printf("ehci_device_bulk_start: not done, ex=%p\n", exfer);
- }
- exfer->ex_isdone = 0;
+ exfer->ex_isdone = false;
#endif
ehci_set_qh_qtd(sqh, data); /* also does usb_syncmem(sqh) */
@@ -3936,11 +3926,9 @@
/* Set up interrupt info. */
exfer->ex_sqtdstart = data;
exfer->ex_sqtdend = dataend;
+ KASSERT(exfer->ex_isdone);
#ifdef DIAGNOSTIC
- if (!exfer->ex_isdone) {
- printf("ehci_device_intr_start: not done, ex=%p\n", exfer);
- }
- exfer->ex_isdone = 0;
+ exfer->ex_isdone = false;
#endif
ehci_set_qh_qtd(sqh, data); /* also does usb_syncmem(sqh) */
@@ -4039,14 +4027,9 @@
/* Set up interrupt info. */
exfer->ex_sqtdstart = data;
exfer->ex_sqtdend = dataend;
+ KASSERT(exfer->ex_isdone);
#ifdef DIAGNOSTIC
- if (!exfer->ex_isdone) {
- USBHIST_LOG(ehcidebug, "marked not done, ex = %p",
- exfer, 0, 0, 0);
- printf("ehci_device_intr_done: not done, ex=%p\n",
- exfer);
- }
- exfer->ex_isdone = 0;
+ exfer->ex_isdone = false;
#endif
ehci_set_qh_qtd(sqh, data); /* also does usb_syncmem(sqh) */
@@ -4135,11 +4118,10 @@
}
KASSERT(!(xfer->ux_rqflags & URQ_REQUEST));
+ KASSERT(exfer->ex_isdone);
#ifdef DIAGNOSTIC
- if (!exfer->ex_isdone)
- printf("ehci_device_fs_isoc_start: not done, ex = %p\n", exfer);
- exfer->ex_isdone = 0;
+ exfer->ex_isdone = false;
#endif
/*
@@ -4452,14 +4434,9 @@
}
KASSERT(!(xfer->ux_rqflags & URQ_REQUEST));
-
+ KASSERT(exfer->ex_isdone);
#ifdef DIAGNOSTIC
- if (!exfer->ex_isdone) {
- USBHIST_LOG(ehcidebug, "marked not done, ex = %p", exfer,
- 0, 0, 0);
- printf("ehci_device_isoc_start: not done, ex = %p\n", exfer);
- }
- exfer->ex_isdone = 0;
+ exfer->ex_isdone = false;
#endif
/*
diff -r 9d3e622b9760 -r ba2b7a3af5d1 sys/dev/usb/ehcivar.h
--- a/sys/dev/usb/ehcivar.h Sun Mar 01 08:33:15 2015 +0000
+++ b/sys/dev/usb/ehcivar.h Mon Mar 02 21:52:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehcivar.h,v 1.42.14.9 2015/02/01 08:29:46 skrll Exp $ */
+/* $NetBSD: ehcivar.h,v 1.42.14.10 2015/03/02 21:52:02 skrll Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
ehci_soft_sitd_t *ex_sitdend;
};
};
- int ex_isdone; /* used only when DIAGNOSTIC is defined */
+ bool ex_isdone; /* used only when DIAGNOSTIC is defined */
};
#define EXFER(xfer) ((struct ehci_xfer *)(xfer))
Home |
Main Index |
Thread Index |
Old Index