Remove CALLOUT_RETURNUNLOCKED from the callouts, there is no reason for them to

drop the lock for us.
This commit is contained in:
Andrew Thompson 2008-12-23 19:59:21 +00:00
parent b638482b2c
commit ac4b4c24ac
19 changed files with 36 additions and 126 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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 =

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}
/*

View File

@ -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);
}
/*

View File

@ -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);
}
/*

View File

@ -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

View File

@ -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);
}
/*

View File

@ -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);
}
/*

View File

@ -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:

View File

@ -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.

View File

@ -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 @@ ulpt_attach(device_t dev)
/* 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;

View File

@ -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

View File

@ -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);
}
/*========================================================================*

View File

@ -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