Nuke usb_ callout macros.
authorHasso Tepper <hasso@dragonflybsd.org>
Fri, 29 Jun 2007 22:56:31 +0000 (22:56 +0000)
committerHasso Tepper <hasso@dragonflybsd.org>
Fri, 29 Jun 2007 22:56:31 +0000 (22:56 +0000)
sys/bus/usb/ehci.c
sys/bus/usb/ohci.c
sys/bus/usb/uhci.c
sys/bus/usb/usb.c
sys/bus/usb/usbdi.c

index f028e9a..b390d78 100644 (file)
@@ -1,6 +1,6 @@
 /*     $NetBSD: ehci.c,v 1.91 2005/02/27 00:27:51 perry Exp $ */
 /*     $FreeBSD: src/sys/dev/usb/ehci.c,v 1.36.2.3 2006/09/24 13:39:04 iedowse Exp $   */
-/*     $DragonFly: src/sys/bus/usb/ehci.c,v 1.31 2007/06/28 13:55:12 hasso Exp $       */
+/*     $DragonFly: src/sys/bus/usb/ehci.c,v 1.32 2007/06/29 22:56:31 hasso Exp $       */
 
 /*
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -469,8 +469,8 @@ ehci_init(ehci_softc_t *sc)
        sc->sc_async_head = sqh;
        EOWRITE4(sc, EHCI_ASYNCLISTADDR, sqh->physaddr | EHCI_LINK_QH);
 
-       usb_callout_init(sc->sc_tmo_pcd);
-       usb_callout_init(sc->sc_tmo_intrlist);
+       callout_init(&sc->sc_tmo_pcd);
+       callout_init(&sc->sc_tmo_intrlist);
 
        lockinit(&sc->sc_doorbell_lock, "ehcidb", 0, 0);
 
@@ -579,7 +579,7 @@ ehci_intr1(ehci_softc_t *sc)
                 */
                ehci_pcd_able(sc, 0);
                /* Do not allow RHSC interrupts > 1 per second */
-                usb_callout(sc->sc_tmo_pcd, hz, ehci_pcd_enable, sc);
+                callout_reset(&sc->sc_tmo_pcd, hz, ehci_pcd_enable, sc);
                eintrs &= ~EHCI_STS_PCD;
        }
 
@@ -669,7 +669,7 @@ ehci_softintr(void *v)
        /* Schedule a callout to catch any dropped transactions. */
        if ((sc->sc_flags & EHCI_SCFLG_LOSTINTRBUG) &&
            !LIST_EMPTY(&sc->sc_intrhead))
-               usb_callout(sc->sc_tmo_intrlist, hz / 5, ehci_intrlist_timeout,
+               callout_reset(&sc->sc_tmo_intrlist, hz / 5, ehci_intrlist_timeout,
                   sc);
 
 #ifdef USB_USE_SOFTINTR
@@ -727,7 +727,7 @@ ehci_check_intr(ehci_softc_t *sc, struct ehci_xfer *ex)
        }
  done:
        DPRINTFN(12, ("ehci_check_intr: ex=%p done\n", ex));
-       usb_uncallout(ex->xfer.timeout_handle, ehci_timeout, ex);
+       callout_stop(&ex->xfer.timeout_handle);
        usb_rem_task(ex->xfer.pipe->device, &ex->abort_task);
        ehci_idone(ex);
 }
@@ -892,8 +892,8 @@ ehci_detach(struct ehci_softc *sc, int flags)
        EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
        EOWRITE4(sc, EHCI_USBCMD, 0);
        EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
-       usb_uncallout(sc->sc_tmo_intrlist, ehci_intrlist_timeout, sc);
-       usb_uncallout(sc->sc_tmo_pcd, ehci_pcd_enable, sc);
+       callout_stop(&sc->sc_tmo_intrlist);
+       callout_stop(&sc->sc_tmo_pcd);
 
        usb_delay_ms(&sc->sc_bus, 300); /* XXX let stray task complete */
 
@@ -2384,7 +2384,7 @@ ehci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
                /* If we're dying, just do the software part. */
                crit_enter();
                xfer->status = status;  /* make software ignore it */
-               usb_uncallout(xfer->timeout_handle, ehci_timeout, xfer);
+               callout_stop(&xfer->timeout_handle);
                usb_rem_task(epipe->pipe.device, &exfer->abort_task);
                usb_transfer_complete(xfer);
                crit_exit();
@@ -2418,7 +2418,7 @@ ehci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
        crit_enter();
        exfer->ehci_xfer_flags |= EHCI_XFER_ABORTING;
        xfer->status = status;  /* make software ignore it */
-       usb_uncallout(xfer->timeout_handle, ehci_timeout, xfer);
+       callout_stop(&xfer->timeout_handle);
        usb_rem_task(epipe->pipe.device, &exfer->abort_task);
        crit_exit();
 
@@ -2801,7 +2801,7 @@ ehci_device_request(usbd_xfer_handle xfer)
        crit_enter();
        ehci_set_qh_qtd(sqh, setup);
        if (xfer->timeout && !sc->sc_bus.use_polling) {
-                usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+                callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
                            ehci_timeout, xfer);
        }
        ehci_add_intr_list(sc, exfer);
@@ -2910,7 +2910,7 @@ ehci_device_bulk_start(usbd_xfer_handle xfer)
        crit_enter();
        ehci_set_qh_qtd(sqh, data);
        if (xfer->timeout && !sc->sc_bus.use_polling) {
-               usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+               callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
                            ehci_timeout, xfer);
        }
        ehci_add_intr_list(sc, exfer);
@@ -3078,7 +3078,7 @@ ehci_device_intr_start(usbd_xfer_handle xfer)
        crit_enter();
        ehci_set_qh_qtd(sqh, data);
        if (xfer->timeout && !sc->sc_bus.use_polling) {
-               usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+               callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
                    ehci_timeout, xfer);
        }
        ehci_add_intr_list(sc, exfer);
@@ -3172,7 +3172,7 @@ ehci_device_intr_done(usbd_xfer_handle xfer)
                crit_enter();
                ehci_set_qh_qtd(sqh, data);
                if (xfer->timeout && !sc->sc_bus.use_polling) {
-                       usb_callout(xfer->timeout_handle,
+                       callout_reset(&xfer->timeout_handle,
                            MS_TO_TICKS(xfer->timeout), ehci_timeout, xfer);
                }
                crit_exit();
index d9e8fc0..a75b624 100644 (file)
@@ -1,6 +1,6 @@
 /*     $NetBSD: ohci.c,v 1.138 2003/02/08 03:32:50 ichiro Exp $        */
 /*     $FreeBSD: src/sys/dev/usb/ohci.c,v 1.154.2.4 2006/06/26 00:31:25 iedowse Exp $  */
-/*     $DragonFly: src/sys/bus/usb/ohci.c,v 1.22 2007/06/28 13:55:12 hasso Exp $       */
+/*     $DragonFly: src/sys/bus/usb/ohci.c,v 1.23 2007/06/29 22:56:31 hasso Exp $       */
 
 /* Also, already ported:
  *     $NetBSD: ohci.c,v 1.140 2003/05/13 04:42:00 gson Exp $
@@ -332,7 +332,7 @@ ohci_detach(struct ohci_softc *sc, int flags)
 
        sc->sc_dying = 1;
 
-       usb_uncallout(sc->sc_tmo_rhsc, ohci_rhsc_enable, sc);
+       callout_stop(&sc->sc_tmo_rhsc);
 
        OWRITE4(sc, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS);
        OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
@@ -741,7 +741,7 @@ ohci_init(ohci_softc_t *sc)
        sc->sc_bus.methods = &ohci_bus_methods;
        sc->sc_bus.pipe_size = sizeof(struct ohci_pipe);
 
-       usb_callout_init(sc->sc_tmo_rhsc);
+       callout_init(&sc->sc_tmo_rhsc);
 
        return (USBD_NORMAL_COMPLETION);
 
@@ -1169,7 +1169,7 @@ ohci_intr1(ohci_softc_t *sc)
                 */
                ohci_rhsc_able(sc, 0);
                /* Do not allow RHSC interrupts > 1 per second */
-               usb_callout(sc->sc_tmo_rhsc, hz, ohci_rhsc_enable, sc);
+               callout_reset(&sc->sc_tmo_rhsc, hz, ohci_rhsc_enable, sc);
                eintrs &= ~OHCI_RHSC;
        }
 
@@ -1340,7 +1340,7 @@ ohci_softintr(void *v)
                        DPRINTFN(15,("ohci_process_done: error cc=%d (%s)\n",
                          OHCI_TD_GET_CC(le32toh(std->td.td_flags)),
                          ohci_cc_strs[OHCI_TD_GET_CC(le32toh(std->td.td_flags))]));
-                       usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
+                       callout_stop(&xfer->timeout_handle);
                        usb_rem_task(OXFER(xfer)->xfer.pipe->device,
                            &OXFER(xfer)->abort_task);
 
@@ -1380,7 +1380,7 @@ ohci_softintr(void *v)
                        continue;
 
                /* Normal transfer completion */
-               usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
+               callout_stop(&xfer->timeout_handle);
                usb_rem_task(OXFER(xfer)->xfer.pipe->device,
                    &OXFER(xfer)->abort_task);
                for (p = xfer->hcpriv; p->xfer == xfer; p = n) {
@@ -1738,7 +1738,7 @@ ohci_device_request(usbd_xfer_handle xfer)
        opipe->tail.td = tail;
        OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF);
        if (xfer->timeout && !sc->sc_bus.use_polling) {
-               usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+               callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
                            ohci_timeout, xfer);
        }
        crit_exit();
@@ -2203,7 +2203,7 @@ ohci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
                /* If we're dying, just do the software part. */
                crit_enter();
                xfer->status = status;  /* make software ignore it */
-               usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
+               callout_stop(&xfer->timeout_handle);
                usb_rem_task(xfer->pipe->device, &OXFER(xfer)->abort_task);
                usb_transfer_complete(xfer);
                crit_exit();
@@ -2236,7 +2236,7 @@ ohci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
        crit_enter();
        oxfer->ohci_xfer_flags |= OHCI_XFER_ABORTING;
        xfer->status = status;  /* make software ignore it */
-       usb_uncallout(xfer->timeout_handle, ohci_timeout, xfer);
+       callout_stop(&xfer->timeout_handle);
        usb_rem_task(xfer->pipe->device, &OXFER(xfer)->abort_task);
        crit_exit();
        DPRINTFN(1,("ohci_abort_xfer: stop ed=%p\n", sed));
@@ -2954,7 +2954,7 @@ ohci_device_bulk_start(usbd_xfer_handle xfer)
        sed->ed.ed_flags &= htole32(~OHCI_ED_SKIP);
        OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_BLF);
        if (xfer->timeout && !sc->sc_bus.use_polling) {
-                usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+                callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
                            ohci_timeout, xfer);
        }
 
index 4696179..f272870 100644 (file)
@@ -1,6 +1,6 @@
 /*     $NetBSD: uhci.c,v 1.170 2003/02/19 01:35:04 augustss Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/uhci.c,v 1.162.2.1 2006/03/01 01:59:04 iedowse Exp $  */
-/*     $DragonFly: src/sys/bus/usb/uhci.c,v 1.24 2007/06/28 13:55:12 hasso Exp $       */
+/*     $DragonFly: src/sys/bus/usb/uhci.c,v 1.25 2007/06/29 22:56:31 hasso Exp $       */
 
 /*     Also already incorporated from NetBSD:
  *     $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $
@@ -497,7 +497,7 @@ uhci_init(uhci_softc_t *sc)
 
        STAILQ_INIT(&sc->sc_free_xfers);
 
-       usb_callout_init(sc->sc_poll_handle);
+       callout_init(&sc->sc_poll_handle);
 
        /* Set up the bus struct. */
        sc->sc_bus.methods = &uhci_bus_methods;
@@ -637,8 +637,7 @@ uhci_power(int why, void *v)
                        uhci_dumpregs(sc);
 #endif
                if (sc->sc_intr_xfer != NULL)
-                       usb_uncallout(sc->sc_poll_handle, uhci_poll_hub,
-                           sc->sc_intr_xfer);
+                       callout_stop(&sc->sc_poll_handle);
                sc->sc_bus.use_polling++;
                uhci_run(sc, 0); /* stop the controller */
 
@@ -684,7 +683,7 @@ uhci_power(int why, void *v)
                usb_delay_ms(&sc->sc_bus, USB_RESUME_RECOVERY);
                sc->sc_bus.use_polling--;
                if (sc->sc_intr_xfer != NULL)
-                       usb_callout(sc->sc_poll_handle, sc->sc_ival,
+                       callout_reset(&sc->sc_poll_handle, sc->sc_ival,
                                    uhci_poll_hub, sc->sc_intr_xfer);
 #ifdef USB_DEBUG
                if (uhcidebug > 2)
@@ -895,7 +894,7 @@ uhci_poll_hub(void *addr)
 
        DPRINTFN(20, ("uhci_poll_hub\n"));
 
-       usb_callout(sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
+       callout_reset(&sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
 
        p = KERNADDR(&xfer->dmabuf, 0);
        p[0] = 0;
@@ -1276,7 +1275,7 @@ uhci_check_intr(uhci_softc_t *sc, uhci_intr_info_t *ii)
        }
 done:
        DPRINTFN(12, ("uhci_check_intr: ii=%p done\n", ii));
-       usb_uncallout(ii->xfer->timeout_handle, uhci_timeout, ii);
+       callout_stop(&ii->xfer->timeout_handle);
        usb_rem_task(ii->xfer->pipe->device, &UXFER(ii->xfer)->abort_task);
        uhci_idone(ii);
 }
@@ -1799,7 +1798,7 @@ uhci_device_bulk_start(usbd_xfer_handle xfer)
        uhci_add_intr_info(sc, ii);
 
        if (xfer->timeout && !sc->sc_bus.use_polling) {
-               usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+               callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
                            uhci_timeout, ii);
        }
        xfer->status = USBD_IN_PROGRESS;
@@ -1851,7 +1850,7 @@ uhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
                /* If we're dying, just do the software part. */
                crit_enter();
                xfer->status = status;  /* make software ignore it */
-               usb_uncallout(xfer->timeout_handle, uhci_timeout, xfer);
+               callout_stop(&xfer->timeout_handle);
                usb_rem_task(xfer->pipe->device, &UXFER(xfer)->abort_task);
                usb_transfer_complete(xfer);
                crit_exit();
@@ -1885,7 +1884,7 @@ uhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
        crit_enter();
        uxfer->uhci_xfer_flags |= UHCI_XFER_ABORTING;
        xfer->status = status;  /* make software ignore it */
-       usb_uncallout(xfer->timeout_handle, uhci_timeout, ii);
+       callout_stop(&xfer->timeout_handle);
        usb_rem_task(xfer->pipe->device, &UXFER(xfer)->abort_task);
        DPRINTFN(1,("uhci_abort_xfer: stop ii=%p\n", ii));
        for (std = ii->stdstart; std != NULL; std = std->link.std)
@@ -2246,7 +2245,7 @@ uhci_device_request(usbd_xfer_handle xfer)
        }
 #endif
        if (xfer->timeout && !sc->sc_bus.use_polling) {
-               usb_callout(xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
+               callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
                            uhci_timeout, ii);
        }
        xfer->status = USBD_IN_PROGRESS;
@@ -3416,7 +3415,7 @@ uhci_root_intr_abort(usbd_xfer_handle xfer)
 {
        uhci_softc_t *sc = (uhci_softc_t *)xfer->pipe->device->bus;
 
-       usb_uncallout(sc->sc_poll_handle, uhci_poll_hub, xfer);
+       callout_stop(&sc->sc_poll_handle);
        sc->sc_intr_xfer = NULL;
 
        if (xfer->pipe->intrxfer == xfer) {
@@ -3461,7 +3460,7 @@ uhci_root_intr_start(usbd_xfer_handle xfer)
                return (USBD_IOERROR);
 
        sc->sc_ival = MS_TO_TICKS(xfer->pipe->endpoint->edesc->bInterval);
-       usb_callout(sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
+       callout_reset(&sc->sc_poll_handle, sc->sc_ival, uhci_poll_hub, xfer);
        sc->sc_intr_xfer = xfer;
        return (USBD_IN_PROGRESS);
 }
@@ -3472,7 +3471,7 @@ uhci_root_intr_close(usbd_pipe_handle pipe)
 {
        uhci_softc_t *sc = (uhci_softc_t *)pipe->device->bus;
 
-       usb_uncallout(sc->sc_poll_handle, uhci_poll_hub, sc->sc_intr_xfer);
+       callout_stop(&sc->sc_poll_handle);
        sc->sc_intr_xfer = NULL;
        DPRINTF(("uhci_root_intr_close\n"));
 }
index e65d058..eed60cc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * $NetBSD: usb.c,v 1.68 2002/02/20 20:30:12 christos Exp $
  * $FreeBSD: src/sys/dev/usb/usb.c,v 1.106 2005/03/27 15:31:23 iedowse Exp $
- * $DragonFly: src/sys/bus/usb/usb.c,v 1.33 2007/06/28 13:55:12 hasso Exp $
+ * $DragonFly: src/sys/bus/usb/usb.c,v 1.34 2007/06/29 22:56:31 hasso Exp $
  */
 
 /* Also already merged from NetBSD:
@@ -247,7 +247,7 @@ USB_ATTACH(usb)
                USB_ATTACH_ERROR_RETURN;
        }
 #else
-       usb_callout_init(sc->sc_bus->softi);
+       callout_init(&sc->sc_bus->softi);
 #endif
 #endif
 
index 008984b..0dfb020 100644 (file)
@@ -1,6 +1,6 @@
 /*     $NetBSD: usbdi.c,v 1.106 2004/10/24 12:52:40 augustss Exp $     */
 /*     $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.91.2.1 2005/12/15 00:36:00 iedowse Exp $  */
-/*     $DragonFly: src/sys/bus/usb/usbdi.c,v 1.17 2007/06/28 13:55:12 hasso Exp $      */
+/*     $DragonFly: src/sys/bus/usb/usbdi.c,v 1.18 2007/06/29 22:56:31 hasso Exp $      */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -390,7 +390,7 @@ usbd_alloc_xfer(usbd_device_handle dev)
        if (xfer == NULL)
                return (NULL);
        xfer->device = dev;
-       usb_callout_init(xfer->timeout_handle);
+       callout_init(&xfer->timeout_handle);
        DPRINTFN(5,("usbd_alloc_xfer() = %p\n", xfer));
        return (xfer);
 }