Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Use a task to perform the timeout abort so we ha...



details:   https://anonhg.NetBSD.org/src/rev/4b73daa68a93
branches:  trunk
changeset: 517892:4b73daa68a93
user:      augustss <augustss%NetBSD.org@localhost>
date:      Wed Nov 21 02:41:18 2001 +0000

description:
Use a task to perform the timeout abort so we have a process context when
sleeping.

diffstat:

 sys/dev/usb/ohci.c    |  25 ++++++++++++++++++-------
 sys/dev/usb/ohcivar.h |   9 ++++++++-
 2 files changed, 26 insertions(+), 8 deletions(-)

diffs (90 lines):

diff -r 52f966e1e059 -r 4b73daa68a93 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Wed Nov 21 02:39:31 2001 +0000
+++ b/sys/dev/usb/ohci.c        Wed Nov 21 02:41:18 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.113 2001/11/21 02:39:31 augustss Exp $      */
+/*     $NetBSD: ohci.c,v 1.114 2001/11/21 02:41:18 augustss Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $       */
 
 /*
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.113 2001/11/21 02:39:31 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.114 2001/11/21 02:41:18 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -206,6 +206,7 @@
 Static int             ohci_str(usb_string_descriptor_t *, int, char *);
 
 Static void            ohci_timeout(void *);
+Static void            ohci_timeout_task(void *);
 Static void            ohci_rhsc_able(ohci_softc_t *, int);
 Static void            ohci_rhsc_enable(void *);
 
@@ -914,9 +915,9 @@
        if (xfer != NULL)
                SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, xfer, next);
        else
-               xfer = malloc(sizeof(*xfer), M_USB, M_NOWAIT);
+               xfer = malloc(sizeof(struct ohci_xfer), M_USB, M_NOWAIT);
        if (xfer != NULL)
-               memset(xfer, 0, sizeof *xfer);
+               memset(xfer, 0, sizeof (struct ohci_xfer));
        return (xfer);
 }
 
@@ -1806,15 +1807,25 @@
 void
 ohci_timeout(void *addr)
 {
+       struct ohci_xfer *oxfer = addr;
+
+       DPRINTF(("ohci_timeout: oxfer=%p\n", oxfer));
+
+       /* Execute the abort in a process context. */
+       usb_init_task(&oxfer->abort_task, ohci_timeout_task, addr);
+       usb_add_task(oxfer->xfer.pipe->device, &oxfer->abort_task);
+}
+
+void
+ohci_timeout_task(void *addr)
+{
        usbd_xfer_handle xfer = addr;
        int s;
 
-       DPRINTF(("ohci_timeout: xfer=%p\n", xfer));
+       DPRINTF(("ohci_timeout_task: xfer=%p\n", xfer));
 
        s = splusb();
-       xfer->device->bus->intr_context++;
        ohci_abort_xfer(xfer, USBD_TIMEOUT);
-       xfer->device->bus->intr_context--;
        splx(s);
 }
 
diff -r 52f966e1e059 -r 4b73daa68a93 sys/dev/usb/ohcivar.h
--- a/sys/dev/usb/ohcivar.h     Wed Nov 21 02:39:31 2001 +0000
+++ b/sys/dev/usb/ohcivar.h     Wed Nov 21 02:41:18 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohcivar.h,v 1.28 2001/09/28 23:57:21 augustss Exp $    */
+/*     $NetBSD: ohcivar.h,v 1.29 2001/11/21 02:41:18 augustss Exp $    */
 /*     $FreeBSD: src/sys/dev/usb/ohcivar.h,v 1.13 1999/11/17 22:33:41 n_hibma Exp $    */
 
 /*
@@ -137,6 +137,13 @@
        char sc_dying;
 } ohci_softc_t;
 
+struct ohci_xfer {
+       struct usbd_xfer xfer;
+       struct usb_task abort_task;
+};
+
+#define OXFER(xfer) ((struct ehci_xfer *)(xfer))
+
 usbd_status    ohci_init(ohci_softc_t *);
 int            ohci_intr(void *);
 #if defined(__NetBSD__) || defined(__OpenBSD__)



Home | Main Index | Thread Index | Old Index