From ac4b4c24acf900fb3d37369f2b0bcd32ab73b455 Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Tue, 23 Dec 2008 19:59:21 +0000 Subject: [PATCH] Remove CALLOUT_RETURNUNLOCKED from the callouts, there is no reason for them to drop the lock for us. --- sys/dev/usb2/controller/at91dci.c | 5 +---- sys/dev/usb2/controller/ehci2.c | 10 ++-------- sys/dev/usb2/controller/musb2_otg.c | 5 +---- sys/dev/usb2/controller/ohci2.c | 14 +++----------- sys/dev/usb2/controller/uhci2.c | 6 +----- sys/dev/usb2/controller/uss820dci.c | 5 +---- sys/dev/usb2/core/usb2_transfer.c | 12 ++---------- sys/dev/usb2/ethernet/if_aue2.c | 9 ++------- sys/dev/usb2/ethernet/if_axe2.c | 9 ++------- sys/dev/usb2/ethernet/if_cue2.c | 9 ++------- sys/dev/usb2/ethernet/if_kue2.c | 9 ++------- sys/dev/usb2/ethernet/if_rue2.c | 9 ++------- sys/dev/usb2/ethernet/if_udav2.c | 9 ++------- sys/dev/usb2/input/ukbd2.c | 9 +++------ sys/dev/usb2/input/ums2.c | 5 +---- sys/dev/usb2/serial/ulpt2.c | 10 +++------- sys/dev/usb2/wlan/if_rum2.c | 9 ++------- sys/dev/usb2/wlan/if_ural2.c | 9 ++------- sys/dev/usb2/wlan/if_zyd2.c | 9 ++------- 19 files changed, 36 insertions(+), 126 deletions(-) diff --git a/sys/dev/usb2/controller/at91dci.c b/sys/dev/usb2/controller/at91dci.c index 2827fe62467..a4e43dff698 100644 --- a/sys/dev/usb2/controller/at91dci.c +++ b/sys/dev/usb2/controller/at91dci.c @@ -1043,16 +1043,13 @@ static void at91dci_timeout(void *arg) { struct usb2_xfer *xfer = arg; - struct at91dci_softc *sc = xfer->usb2_sc; DPRINTF("xfer=%p\n", xfer); - USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); + USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED); /* transfer is transferred */ at91dci_device_done(xfer, USB_ERR_TIMEOUT); - - USB_BUS_UNLOCK(&sc->sc_bus); } static void diff --git a/sys/dev/usb2/controller/ehci2.c b/sys/dev/usb2/controller/ehci2.c index c514200a0d5..fdecd7c1b23 100644 --- a/sys/dev/usb2/controller/ehci2.c +++ b/sys/dev/usb2/controller/ehci2.c @@ -213,8 +213,7 @@ ehci_init(ehci_softc_t *sc) DPRINTF("start\n"); - usb2_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, - CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, 0); #if USB_DEBUG if (ehcidebug > 2) { @@ -1411,8 +1410,6 @@ ehci_pcd_enable(ehci_softc_t *sc) usb2_sw_transfer(&sc->sc_root_intr, &ehci_root_intr_done); - - USB_BUS_UNLOCK(&sc->sc_bus); } static void @@ -1511,16 +1508,13 @@ static void ehci_timeout(void *arg) { struct usb2_xfer *xfer = arg; - ehci_softc_t *sc = xfer->usb2_sc; DPRINTF("xfer=%p\n", xfer); - USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); + USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED); /* transfer is transferred */ ehci_device_done(xfer, USB_ERR_TIMEOUT); - - USB_BUS_UNLOCK(&sc->sc_bus); } static void diff --git a/sys/dev/usb2/controller/musb2_otg.c b/sys/dev/usb2/controller/musb2_otg.c index fc839bb60e6..e7119bf30d4 100644 --- a/sys/dev/usb2/controller/musb2_otg.c +++ b/sys/dev/usb2/controller/musb2_otg.c @@ -1252,16 +1252,13 @@ static void musbotg_timeout(void *arg) { struct usb2_xfer *xfer = arg; - struct musbotg_softc *sc = xfer->usb2_sc; DPRINTFN(1, "xfer=%p\n", xfer); - USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); + USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED); /* transfer is transferred */ musbotg_device_done(xfer, USB_ERR_TIMEOUT); - - USB_BUS_UNLOCK(&sc->sc_bus); } static void diff --git a/sys/dev/usb2/controller/ohci2.c b/sys/dev/usb2/controller/ohci2.c index 5ea465c8be9..b3f2f0e86e8 100644 --- a/sys/dev/usb2/controller/ohci2.c +++ b/sys/dev/usb2/controller/ohci2.c @@ -390,8 +390,7 @@ ohci_init(ohci_softc_t *sc) /* set up the bus struct */ sc->sc_bus.methods = &ohci_bus_methods; - usb2_callout_init_mtx(&sc->sc_tmo_rhsc, &sc->sc_bus.bus_mtx, - CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_tmo_rhsc, &sc->sc_bus.bus_mtx, 0); #if USB_DEBUG if (ohcidebug > 15) { @@ -1095,8 +1094,6 @@ ohci_rhsc_enable(ohci_softc_t *sc) usb2_sw_transfer(&sc->sc_root_intr, &ohci_root_intr_done); - - USB_BUS_UNLOCK(&sc->sc_bus); } static void @@ -1240,16 +1237,13 @@ static void ohci_timeout(void *arg) { struct usb2_xfer *xfer = arg; - ohci_softc_t *sc = xfer->usb2_sc; DPRINTF("xfer=%p\n", xfer); - USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); + USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED); /* transfer is transferred */ ohci_device_done(xfer, USB_ERR_TIMEOUT); - - USB_BUS_UNLOCK(&sc->sc_bus); } static void @@ -2335,10 +2329,8 @@ ohci_root_ctrl_done(struct usb2_xfer *xfer, case UHF_C_PORT_OVER_CURRENT: case UHF_C_PORT_RESET: /* enable RHSC interrupt if condition is cleared. */ - if ((OREAD4(sc, port) >> 16) == 0) { + if ((OREAD4(sc, port) >> 16) == 0) ohci_rhsc_enable(sc); - USB_BUS_LOCK(&sc->sc_bus); - } break; default: break; diff --git a/sys/dev/usb2/controller/uhci2.c b/sys/dev/usb2/controller/uhci2.c index ceb87e67470..478e54f11b9 100644 --- a/sys/dev/usb2/controller/uhci2.c +++ b/sys/dev/usb2/controller/uhci2.c @@ -1494,16 +1494,13 @@ static void uhci_timeout(void *arg) { struct usb2_xfer *xfer = arg; - uhci_softc_t *sc = xfer->usb2_sc; DPRINTF("xfer=%p\n", xfer); - USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); + USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED); /* transfer is transferred */ uhci_device_done(xfer, USB_ERR_TIMEOUT); - - USB_BUS_UNLOCK(&sc->sc_bus); } static void @@ -2912,7 +2909,6 @@ uhci_root_intr_check(void *arg) usb2_sw_transfer(&sc->sc_root_intr, &uhci_root_intr_done); } - USB_BUS_UNLOCK(&sc->sc_bus); } struct usb2_pipe_methods uhci_root_intr_methods = diff --git a/sys/dev/usb2/controller/uss820dci.c b/sys/dev/usb2/controller/uss820dci.c index 7148acc1506..d010a538510 100644 --- a/sys/dev/usb2/controller/uss820dci.c +++ b/sys/dev/usb2/controller/uss820dci.c @@ -973,16 +973,13 @@ static void uss820dci_timeout(void *arg) { struct usb2_xfer *xfer = arg; - struct uss820dci_softc *sc = xfer->usb2_sc; DPRINTF("xfer=%p\n", xfer); - USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); + USB_BUS_LOCK_ASSERT(xfer->udev->bus, MA_OWNED); /* transfer is transferred */ uss820dci_device_done(xfer, USB_ERR_TIMEOUT); - - USB_BUS_UNLOCK(&sc->sc_bus); } static void diff --git a/sys/dev/usb2/core/usb2_transfer.c b/sys/dev/usb2/core/usb2_transfer.c index ede15299a66..1cf6956d962 100644 --- a/sys/dev/usb2/core/usb2_transfer.c +++ b/sys/dev/usb2/core/usb2_transfer.c @@ -880,7 +880,7 @@ usb2_transfer_setup(struct usb2_device *udev, info->setup_refcount++; usb2_callout_init_mtx(&xfer->timeout_handle, - &udev->bus->bus_mtx, CALLOUT_RETURNUNLOCKED); + &udev->bus->bus_mtx, 0); } else { /* * Setup a dummy xfer, hence we are @@ -1950,8 +1950,6 @@ usb2_dma_delay_done_cb(void *arg) /* queue callback for execution, again */ usb2_transfer_done(xfer, 0); - - USB_BUS_UNLOCK(xfer->udev->bus); } /*------------------------------------------------------------------------* @@ -2092,7 +2090,6 @@ usb2_transfer_start_cb(void *arg) } else { xfer->flags_int.can_cancel_immed = 0; } - USB_BUS_UNLOCK(xfer->udev->bus); } /*------------------------------------------------------------------------* @@ -2707,14 +2704,9 @@ usb2_callout_poll(struct usb2_xfer *xfer) usb2_callout_stop(co); (cb) (arg); - - /* the callback should drop the mutex */ - } else { - mtx_unlock(mtx); } - } else { - mtx_unlock(mtx); } + mtx_unlock(mtx); } diff --git a/sys/dev/usb2/ethernet/if_aue2.c b/sys/dev/usb2/ethernet/if_aue2.c index 90fb84968f4..f0bcc04094e 100644 --- a/sys/dev/usb2/ethernet/if_aue2.c +++ b/sys/dev/usb2/ethernet/if_aue2.c @@ -770,8 +770,7 @@ aue_attach(device_t dev) mtx_init(&sc->sc_mtx, "aue lock", NULL, MTX_DEF | MTX_RECURSE); - usb2_callout_init_mtx(&sc->sc_watchdog, - &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); iface_index = AUE_IFACE_IDX; error = usb2_transfer_setup(uaa->device, &iface_index, @@ -798,10 +797,8 @@ aue_attach(device_t dev) usb2_config_td_queue_command (&sc->sc_config_td, NULL, &aue_cfg_first_time_setup, 0, 0); - /* start watchdog (will exit mutex) */ - aue_watchdog(sc); - + mtx_unlock(&sc->sc_mtx); return (0); /* success */ detach: @@ -1475,8 +1472,6 @@ aue_watchdog(void *arg) usb2_callout_reset(&sc->sc_watchdog, hz, &aue_watchdog, sc); - - mtx_unlock(&sc->sc_mtx); } /* diff --git a/sys/dev/usb2/ethernet/if_axe2.c b/sys/dev/usb2/ethernet/if_axe2.c index 408546add89..023123599aa 100644 --- a/sys/dev/usb2/ethernet/if_axe2.c +++ b/sys/dev/usb2/ethernet/if_axe2.c @@ -597,8 +597,7 @@ axe_attach(device_t dev) mtx_init(&sc->sc_mtx, "axe lock", NULL, MTX_DEF | MTX_RECURSE); - usb2_callout_init_mtx(&sc->sc_watchdog, - &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); iface_index = AXE_IFACE_IDX; error = usb2_transfer_setup(uaa->device, &iface_index, @@ -625,10 +624,8 @@ axe_attach(device_t dev) usb2_config_td_queue_command (&sc->sc_config_td, NULL, &axe_cfg_first_time_setup, 0, 0); - /* start watchdog (will exit mutex) */ - axe_watchdog(sc); - + mtx_unlock(&sc->sc_mtx); return (0); /* success */ detach: @@ -1423,8 +1420,6 @@ axe_watchdog(void *arg) usb2_callout_reset(&sc->sc_watchdog, hz, &axe_watchdog, sc); - - mtx_unlock(&sc->sc_mtx); } /* diff --git a/sys/dev/usb2/ethernet/if_cue2.c b/sys/dev/usb2/ethernet/if_cue2.c index e3ff6875cc1..872af0390fe 100644 --- a/sys/dev/usb2/ethernet/if_cue2.c +++ b/sys/dev/usb2/ethernet/if_cue2.c @@ -408,8 +408,7 @@ cue_attach(device_t dev) mtx_init(&sc->sc_mtx, "cue lock", NULL, MTX_DEF | MTX_RECURSE); - usb2_callout_init_mtx(&sc->sc_watchdog, - &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); iface_index = CUE_IFACE_IDX; error = usb2_transfer_setup(uaa->device, &iface_index, @@ -433,10 +432,8 @@ cue_attach(device_t dev) usb2_config_td_queue_command (&sc->sc_config_td, NULL, &cue_cfg_first_time_setup, 0, 0); - /* start watchdog (will exit mutex) */ - cue_watchdog(sc); - + mtx_unlock(&sc->sc_mtx); return (0); /* success */ detach: @@ -879,8 +876,6 @@ cue_watchdog(void *arg) usb2_callout_reset(&sc->sc_watchdog, hz, &cue_watchdog, sc); - - mtx_unlock(&sc->sc_mtx); } /* diff --git a/sys/dev/usb2/ethernet/if_kue2.c b/sys/dev/usb2/ethernet/if_kue2.c index 16232f73aca..060ee1e354e 100644 --- a/sys/dev/usb2/ethernet/if_kue2.c +++ b/sys/dev/usb2/ethernet/if_kue2.c @@ -470,8 +470,7 @@ kue_attach(device_t dev) mtx_init(&sc->sc_mtx, "kue lock", NULL, MTX_DEF | MTX_RECURSE); - usb2_callout_init_mtx(&sc->sc_watchdog, - &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); iface_index = KUE_IFACE_IDX; error = usb2_transfer_setup(uaa->device, &iface_index, @@ -495,10 +494,8 @@ kue_attach(device_t dev) usb2_config_td_queue_command (&sc->sc_config_td, NULL, &kue_cfg_first_time_setup, 0, 0); - /* start watchdog (will exit mutex) */ - kue_watchdog(sc); - + mtx_unlock(&sc->sc_mtx); return (0); /* success */ detach: @@ -935,8 +932,6 @@ kue_watchdog(void *arg) usb2_callout_reset(&sc->sc_watchdog, hz, &kue_watchdog, sc); - - mtx_unlock(&sc->sc_mtx); } static void diff --git a/sys/dev/usb2/ethernet/if_rue2.c b/sys/dev/usb2/ethernet/if_rue2.c index 49031b48111..5c788cb70c4 100644 --- a/sys/dev/usb2/ethernet/if_rue2.c +++ b/sys/dev/usb2/ethernet/if_rue2.c @@ -651,8 +651,7 @@ rue_attach(device_t dev) mtx_init(&sc->sc_mtx, "rue lock", NULL, MTX_DEF | MTX_RECURSE); - usb2_callout_init_mtx(&sc->sc_watchdog, - &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); iface_index = RUE_IFACE_IDX; error = usb2_transfer_setup(uaa->device, &iface_index, @@ -679,10 +678,8 @@ rue_attach(device_t dev) usb2_config_td_queue_command (&sc->sc_config_td, NULL, &rue_cfg_first_time_setup, 0, 0); - /* start watchdog (will exit mutex) */ - rue_watchdog(sc); - + mtx_unlock(&sc->sc_mtx); return (0); /* success */ detach: @@ -1299,8 +1296,6 @@ rue_watchdog(void *arg) usb2_callout_reset(&sc->sc_watchdog, hz, &rue_watchdog, sc); - - mtx_unlock(&sc->sc_mtx); } /* diff --git a/sys/dev/usb2/ethernet/if_udav2.c b/sys/dev/usb2/ethernet/if_udav2.c index 9514840f91f..2cc3596cd09 100644 --- a/sys/dev/usb2/ethernet/if_udav2.c +++ b/sys/dev/usb2/ethernet/if_udav2.c @@ -282,8 +282,7 @@ udav_attach(device_t dev) mtx_init(&sc->sc_mtx, "udav lock", NULL, MTX_DEF | MTX_RECURSE); - usb2_callout_init_mtx(&sc->sc_watchdog, - &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); iface_index = UDAV_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, @@ -309,10 +308,8 @@ udav_attach(device_t dev) usb2_config_td_queue_command (&sc->sc_config_td, NULL, &udav_cfg_first_time_setup, 0, 0); - /* start watchdog (will exit mutex) */ - udav_watchdog(sc); - + mtx_unlock(&sc->sc_mtx); return (0); /* success */ detach: @@ -1080,8 +1077,6 @@ udav_watchdog(void *arg) usb2_callout_reset(&sc->sc_watchdog, hz, &udav_watchdog, sc); - - mtx_unlock(&sc->sc_mtx); } /* diff --git a/sys/dev/usb2/input/ukbd2.c b/sys/dev/usb2/input/ukbd2.c index 52d9dbe097a..8cff11fb8a5 100644 --- a/sys/dev/usb2/input/ukbd2.c +++ b/sys/dev/usb2/input/ukbd2.c @@ -445,8 +445,6 @@ ukbd_timeout(void *arg) ukbd_interrupt(sc); usb2_callout_reset(&sc->sc_callout, hz / 40, &ukbd_timeout, sc); - - mtx_unlock(&Giant); } static void @@ -639,8 +637,7 @@ ukbd_attach(device_t dev) sc->sc_mode = K_XLATE; sc->sc_iface = uaa->iface; - usb2_callout_init_mtx(&sc->sc_callout, &Giant, - CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_callout, &Giant, 0); err = usb2_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, sc->sc_xfer, ukbd_config, @@ -705,8 +702,8 @@ ukbd_attach(device_t dev) /* start the timer */ - ukbd_timeout(sc); /* will unlock mutex */ - + ukbd_timeout(sc); + mtx_unlock(&Giant); return (0); /* success */ detach: diff --git a/sys/dev/usb2/input/ums2.c b/sys/dev/usb2/input/ums2.c index 7dbcd1c242b..0c3fa061c13 100644 --- a/sys/dev/usb2/input/ums2.c +++ b/sys/dev/usb2/input/ums2.c @@ -153,8 +153,6 @@ ums_put_queue_timeout(void *__sc) mtx_assert(&sc->sc_mtx, MA_OWNED); ums_put_queue(sc, 0, 0, 0, 0, 0); - - mtx_unlock(&sc->sc_mtx); } static void @@ -415,8 +413,7 @@ ums_attach(device_t dev) mtx_init(&sc->sc_mtx, "ums lock", NULL, MTX_DEF | MTX_RECURSE); - usb2_callout_init_mtx(&sc->sc_callout, - &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_callout, &sc->sc_mtx, 0); /* * Force the report (non-boot) protocol. diff --git a/sys/dev/usb2/serial/ulpt2.c b/sys/dev/usb2/serial/ulpt2.c index d95b0fc1407..4b9f44b7d3e 100644 --- a/sys/dev/usb2/serial/ulpt2.c +++ b/sys/dev/usb2/serial/ulpt2.c @@ -560,8 +560,7 @@ ulpt_attach(device_t dev) mtx_init(&sc->sc_mtx, "ulpt lock", NULL, MTX_DEF | MTX_RECURSE); - usb2_callout_init_mtx(&sc->sc_watchdog, - &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); /* search through all the descriptors looking for bidir mode */ @@ -671,9 +670,8 @@ found: /* start reading of status */ mtx_lock(&sc->sc_mtx); - - ulpt_watchdog(sc); /* will unlock mutex */ - + ulpt_watchdog(sc); + mtx_unlock(&sc->sc_mtx); return (0); detach: @@ -762,8 +760,6 @@ ulpt_watchdog(void *arg) usb2_callout_reset(&sc->sc_watchdog, hz, &ulpt_watchdog, sc); - - mtx_unlock(&sc->sc_mtx); } static devclass_t ulpt_devclass; diff --git a/sys/dev/usb2/wlan/if_rum2.c b/sys/dev/usb2/wlan/if_rum2.c index a001d8d82de..e99881ba736 100644 --- a/sys/dev/usb2/wlan/if_rum2.c +++ b/sys/dev/usb2/wlan/if_rum2.c @@ -475,8 +475,7 @@ rum_attach(device_t dev) sc->sc_udev = uaa->device; sc->sc_unit = device_get_unit(dev); - usb2_callout_init_mtx(&sc->sc_watchdog, - &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); iface_index = RT2573_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, @@ -501,10 +500,8 @@ rum_attach(device_t dev) usb2_config_td_queue_command (&sc->sc_config_td, NULL, &rum_cfg_first_time_setup, 0, 0); - /* start watchdog (will exit mutex) */ - rum_watchdog(sc); - + mtx_unlock(&sc->sc_mtx); return (0); /* success */ detach: @@ -1417,8 +1414,6 @@ rum_watchdog(void *arg) } usb2_callout_reset(&sc->sc_watchdog, hz, &rum_watchdog, sc); - - mtx_unlock(&sc->sc_mtx); } static void diff --git a/sys/dev/usb2/wlan/if_ural2.c b/sys/dev/usb2/wlan/if_ural2.c index 0af78c7e356..22134392cdd 100644 --- a/sys/dev/usb2/wlan/if_ural2.c +++ b/sys/dev/usb2/wlan/if_ural2.c @@ -468,8 +468,7 @@ ural_attach(device_t dev) sc->sc_udev = uaa->device; sc->sc_unit = device_get_unit(dev); - usb2_callout_init_mtx(&sc->sc_watchdog, - &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); iface_index = RAL_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, @@ -496,10 +495,8 @@ ural_attach(device_t dev) usb2_config_td_queue_command (&sc->sc_config_td, NULL, &ural_cfg_first_time_setup, 0, 0); - /* start watchdog (will exit mutex) */ - ural_watchdog(sc); - + mtx_unlock(&sc->sc_mtx); return (0); /* success */ detach: @@ -1405,8 +1402,6 @@ ural_watchdog(void *arg) } usb2_callout_reset(&sc->sc_watchdog, hz, &ural_watchdog, sc); - - mtx_unlock(&sc->sc_mtx); } /*========================================================================* diff --git a/sys/dev/usb2/wlan/if_zyd2.c b/sys/dev/usb2/wlan/if_zyd2.c index d71516012a0..2e29d3769f5 100644 --- a/sys/dev/usb2/wlan/if_zyd2.c +++ b/sys/dev/usb2/wlan/if_zyd2.c @@ -1080,8 +1080,7 @@ zyd_attach(device_t dev) usb2_cv_init(&sc->sc_intr_cv, "IWAIT"); - usb2_callout_init_mtx(&sc->sc_watchdog, - &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); + usb2_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); /* * Endpoint 1 = Bulk out (512b @ high speed / 64b @ full speed) @@ -1111,10 +1110,8 @@ zyd_attach(device_t dev) usb2_config_td_queue_command (&sc->sc_config_td, NULL, &zyd_cfg_first_time_setup, 0, 0); - /* start watchdog (will exit mutex) */ - zyd_watchdog(sc); - + mtx_unlock(&sc->sc_mtx); return (0); detach: @@ -2761,8 +2758,6 @@ zyd_watchdog(void *arg) } usb2_callout_reset(&sc->sc_watchdog, hz, &zyd_watchdog, sc); - - mtx_unlock(&sc->sc_mtx); } static void