Diff below unify the various *hci_timeout() functions, there should be
no functional change.

Since this code is identical in all our drivers, the next step will be
to provide a new hook to not reroll it in the two upcoming HC drivers.

ok?

Index: ehci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ehci.c,v
retrieving revision 1.141
diff -u -p -r1.141 ehci.c
--- ehci.c      24 Feb 2014 18:21:20 -0000      1.141
+++ ehci.c      7 Mar 2014 14:15:02 -0000
@@ -2933,21 +2933,17 @@ ehci_abort_isoc_xfer(struct usbd_xfer *x
 void
 ehci_timeout(void *addr)
 {
-       struct ehci_xfer *exfer = addr;
-       struct ehci_pipe *epipe = (struct ehci_pipe *)exfer->xfer.pipe;
-       struct ehci_softc *sc = (struct ehci_softc *)epipe->pipe.device->bus;
-
-       DPRINTF(("ehci_timeout: exfer=%p\n", exfer));
+       struct usbd_xfer *xfer = addr;
+       struct ehci_softc *sc = (struct ehci_softc *)xfer->device->bus;
 
        if (sc->sc_bus.dying) {
-               ehci_abort_xfer(&exfer->xfer, USBD_TIMEOUT);
+               ehci_timeout_task(addr);
                return;
        }
 
-       /* Execute the abort in a process context. */
-       usb_init_task(&exfer->xfer.abort_task, ehci_timeout_task, addr,
+       usb_init_task(&xfer->abort_task, ehci_timeout_task, addr,
            USB_TASK_TYPE_ABORT);
-       usb_add_task(exfer->xfer.pipe->device, &exfer->xfer.abort_task);
+       usb_add_task(xfer->device, &xfer->abort_task);
 }
 
 void
@@ -2956,7 +2952,7 @@ ehci_timeout_task(void *addr)
        struct usbd_xfer *xfer = addr;
        int s;
 
-       DPRINTF(("ehci_timeout_task: xfer=%p\n", xfer));
+       DPRINTF(("%s: xfer=%p\n", __func__, xfer));
 
        s = splusb();
        ehci_abort_xfer(xfer, USBD_TIMEOUT);
Index: ohci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ohci.c,v
retrieving revision 1.119
diff -u -p -r1.119 ohci.c
--- ohci.c      15 Jan 2014 11:10:40 -0000      1.119
+++ ohci.c      7 Mar 2014 14:15:02 -0000
@@ -1836,21 +1836,17 @@ ohci_hash_find_itd(struct ohci_softc *sc
 void
 ohci_timeout(void *addr)
 {
-       struct ohci_xfer *oxfer = addr;
-       struct ohci_pipe *opipe = (struct ohci_pipe *)oxfer->xfer.pipe;
-       struct ohci_softc *sc = (struct ohci_softc *)opipe->pipe.device->bus;
-
-       DPRINTF(("ohci_timeout: oxfer=%p\n", oxfer));
+       struct usbd_xfer *xfer = addr;
+       struct ohci_softc *sc = (struct ohci_softc *)xfer->device->bus;
 
        if (sc->sc_bus.dying) {
-               ohci_abort_xfer(&oxfer->xfer, USBD_TIMEOUT);
+               ohci_timeout_task(addr);
                return;
        }
 
-       /* Execute the abort in a process context. */
-       usb_init_task(&oxfer->xfer.abort_task, ohci_timeout_task, addr,
+       usb_init_task(&xfer->abort_task, ohci_timeout_task, addr,
            USB_TASK_TYPE_ABORT);
-       usb_add_task(oxfer->xfer.pipe->device, &oxfer->xfer.abort_task);
+       usb_add_task(xfer->device, &xfer->abort_task);
 }
 
 void
@@ -1859,7 +1855,7 @@ ohci_timeout_task(void *addr)
        struct usbd_xfer *xfer = addr;
        int s;
 
-       DPRINTF(("ohci_timeout_task: xfer=%p\n", xfer));
+       DPRINTF(("%s: xfer=%p\n", __func__, xfer));
 
        s = splusb();
        ohci_abort_xfer(xfer, USBD_TIMEOUT);
Index: uhci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uhci.c,v
retrieving revision 1.105
diff -u -p -r1.105 uhci.c
--- uhci.c      9 Dec 2013 01:02:06 -0000       1.105
+++ uhci.c      7 Mar 2014 14:15:02 -0000
@@ -1371,27 +1371,20 @@ uhci_idone(struct uhci_xfer *ex)
        DPRINTFN(12, ("uhci_idone: ex=%p done\n", ex));
 }
 
-/*
- * Called when a request does not complete.
- */
 void
 uhci_timeout(void *addr)
 {
-       struct uhci_xfer *uxfer = addr;
-       struct uhci_pipe *upipe = (struct uhci_pipe *)uxfer->xfer.pipe;
-       struct uhci_softc *sc = (struct uhci_softc *)upipe->pipe.device->bus;
-
-       DPRINTF(("uhci_timeout: uxfer=%p\n", uxfer));
+       struct usbd_xfer *xfer = addr;
+       struct uhci_softc *sc = (struct uhci_softc *)xfer->device->bus;
 
        if (sc->sc_bus.dying) {
-               uhci_abort_xfer(&uxfer->xfer, USBD_TIMEOUT);
+               uhci_timeout_task(addr);
                return;
        }
 
-       /* Execute the abort in a process context. */
-       usb_init_task(&uxfer->xfer.abort_task, uhci_timeout_task, &uxfer->xfer,
+       usb_init_task(&xfer->abort_task, uhci_timeout_task, addr,
            USB_TASK_TYPE_ABORT);
-       usb_add_task(uxfer->xfer.pipe->device, &uxfer->xfer.abort_task);
+       usb_add_task(xfer->device, &xfer->abort_task);
 }
 
 void
@@ -1400,7 +1393,7 @@ uhci_timeout_task(void *addr)
        struct usbd_xfer *xfer = addr;
        int s;
 
-       DPRINTF(("uhci_timeout_task: xfer=%p\n", xfer));
+       DPRINTF(("%s: xfer=%p\n", __func__, xfer));
 
        s = splusb();
        uhci_abort_xfer(xfer, USBD_TIMEOUT);

Reply via email to