summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authoraugustss <augustss@NetBSD.org>2003-02-16 23:15:27 +0000
committeraugustss <augustss@NetBSD.org>2003-02-16 23:15:27 +0000
commit47f7f552a24ae28d3f59fbc5428fc86bd0bccfec (patch)
tree1fbbec15a9658b694c9810c0aec2e0d5511973f9 /sys/dev/usb
parent50e312d584660a49a7815033eb0871f00c5ce7a8 (diff)
Don't take xfers off the interrupt list if they are not on it yet.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/ehci.c16
-rw-r--r--sys/dev/usb/uhci.c28
2 files changed, 31 insertions, 13 deletions
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index a0888273c45..ee8b731a6e2 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.43 2003/02/08 03:32:50 ichiro Exp $ */
+/* $NetBSD: ehci.c,v 1.44 2003/02/16 23:15:27 augustss Exp $ */
/*
* TODO
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.43 2003/02/08 03:32:50 ichiro Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.44 2003/02/16 23:15:27 augustss Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -221,7 +221,11 @@ Static void ehci_dump_exfer(struct ehci_xfer *);
#define ehci_add_intr_list(sc, ex) \
LIST_INSERT_HEAD(&(sc)->sc_intrhead, (ex), inext);
#define ehci_del_intr_list(ex) \
- LIST_REMOVE((ex), inext)
+ do { \
+ LIST_REMOVE((ex), inext); \
+ (ex)->inext.le_prev = NULL; \
+ } while (0)
+#define ehci_active_intr_list(ex) ((ex)->inext.le_prev != NULL)
Static struct usbd_bus_methods ehci_bus_methods = {
ehci_open,
@@ -2414,7 +2418,7 @@ ehci_device_ctrl_done(usbd_xfer_handle xfer)
}
#endif
- if (xfer->status != USBD_NOMEM) {
+ if (xfer->status != USBD_NOMEM && ehci_active_intr_list(ex)) {
ehci_del_intr_list(ex); /* remove from active list */
ehci_free_sqtd_chain(sc, ex->sqtdstart, NULL);
}
@@ -2734,9 +2738,9 @@ ehci_device_bulk_done(usbd_xfer_handle xfer)
DPRINTFN(10,("ehci_bulk_done: xfer=%p, actlen=%d\n",
xfer, xfer->actlen));
- if (xfer->status != USBD_NOMEM) {
+ if (xfer->status != USBD_NOMEM && ehci_active_intr_list(ex)) {
ehci_del_intr_list(ex); /* remove from active list */
- ehci_free_sqtd_chain(sc, ex->sqtdstart, 0);
+ ehci_free_sqtd_chain(sc, ex->sqtdstart, NULL);
}
DPRINTFN(5, ("ehci_bulk_done: length=%d\n", xfer->actlen));
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index c3578b57039..98108775514 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.168 2003/02/08 03:32:51 ichiro Exp $ */
+/* $NetBSD: uhci.c,v 1.169 2003/02/16 23:15:28 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
/*
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.168 2003/02/08 03:32:51 ichiro Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.169 2003/02/16 23:15:28 augustss Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -363,9 +363,13 @@ struct usbd_pipe_methods uhci_device_isoc_methods = {
};
#define uhci_add_intr_info(sc, ii) \
- LIST_INSERT_HEAD(&(sc)->sc_intrhead, (ii), list);
+ LIST_INSERT_HEAD(&(sc)->sc_intrhead, (ii), list)
#define uhci_del_intr_info(ii) \
- LIST_REMOVE((ii), list)
+ do { \
+ LIST_REMOVE((ii), list); \
+ (ii)->list.le_prev = NULL; \
+ } while (0)
+#define uhci_active_intr_info(ii) ((ii)->list.le_prev != NULL)
Static __inline__ uhci_soft_qh_t *
uhci_find_prev_qh(uhci_soft_qh_t *pqh, uhci_soft_qh_t *sqh)
@@ -1809,8 +1813,8 @@ uhci_device_bulk_start(usbd_xfer_handle xfer)
int len, isread, endpt;
int s;
- DPRINTFN(3, ("uhci_device_bulk_transfer: xfer=%p len=%d flags=%d\n",
- xfer, xfer->length, xfer->flags));
+ DPRINTFN(3, ("uhci_device_bulk_start: xfer=%p len=%d flags=%d ii=%p\n",
+ xfer, xfer->length, xfer->flags, ii));
if (sc->sc_dying)
return (USBD_IOERROR);
@@ -2664,7 +2668,8 @@ uhci_device_intr_done(usbd_xfer_handle xfer)
/* The ii is already on the examined list, just leave it. */
} else {
DPRINTFN(5,("uhci_device_intr_done: removing\n"));
- uhci_del_intr_info(ii);
+ if (uhci_active_intr_info(ii))
+ uhci_del_intr_info(ii);
}
}
@@ -2681,6 +2686,9 @@ uhci_device_ctrl_done(usbd_xfer_handle xfer)
panic("uhci_ctrl_done: not a request");
#endif
+ if (!uhci_active_intr_info(ii))
+ return;
+
uhci_del_intr_info(ii); /* remove from active list */
if (upipe->pipe.device->speed == USB_SPEED_LOW)
@@ -2702,6 +2710,12 @@ uhci_device_bulk_done(usbd_xfer_handle xfer)
uhci_softc_t *sc = ii->sc;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
+ DPRINTFN(5,("uhci_device_ctrl_done: xfer=%p ii=%p sc=%p upipe=%p\n",
+ xfer, ii, sc, upipe));
+
+ if (!uhci_active_intr_info(ii))
+ return;
+
uhci_del_intr_info(ii); /* remove from active list */
uhci_remove_bulk(sc, upipe->u.bulk.sqh);