summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-06-15 00:33:18 +0000
committerthompsa <thompsa@FreeBSD.org>2009-06-15 00:33:18 +0000
commit59f1f60cfaca26c7758f2642afca8d6500b9a06a (patch)
tree4b81b631b249a903756a500ebc8bef07b76398ef /sys/dev
parent2eb7fca9b24623d41ab43a71dd08544ad8a48c50 (diff)
downloadFreeBSD-src-59f1f60cfaca26c7758f2642afca8d6500b9a06a.zip
FreeBSD-src-59f1f60cfaca26c7758f2642afca8d6500b9a06a.tar.gz
Remove usb2_cv_* and just use the kernel condvar implementation, it was needed
earlier since condition variables didnt work with Giant but this was fixed 10 months ago.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/serial/ufoma.c10
-rw-r--r--sys/dev/usb/serial/usb_serial.c8
-rw-r--r--sys/dev/usb/usb_busdma.c10
-rw-r--r--sys/dev/usb/usb_compat_linux.c8
-rw-r--r--sys/dev/usb/usb_core.h8
-rw-r--r--sys/dev/usb/usb_dev.c26
-rw-r--r--sys/dev/usb/usb_device.c10
-rw-r--r--sys/dev/usb/usb_msctest.c8
-rw-r--r--sys/dev/usb/usb_process.c24
-rw-r--r--sys/dev/usb/usb_request.c4
-rw-r--r--sys/dev/usb/usb_transfer.c8
-rw-r--r--sys/dev/usb/usb_util.c103
-rw-r--r--sys/dev/usb/usb_util.h19
13 files changed, 58 insertions, 188 deletions
diff --git a/sys/dev/usb/serial/ufoma.c b/sys/dev/usb/serial/ufoma.c
index 9b47f3d..3e1f134 100644
--- a/sys/dev/usb/serial/ufoma.c
+++ b/sys/dev/usb/serial/ufoma.c
@@ -366,7 +366,7 @@ ufoma_attach(device_t dev)
sc->sc_unit = device_get_unit(dev);
mtx_init(&sc->sc_mtx, "ufoma", NULL, MTX_DEF);
- usb2_cv_init(&sc->sc_cv, "CWAIT");
+ cv_init(&sc->sc_cv, "CWAIT");
device_set_usb2_desc(dev);
@@ -475,7 +475,7 @@ ufoma_detach(device_t dev)
free(sc->sc_modetable, M_USBDEV);
}
mtx_destroy(&sc->sc_mtx);
- usb2_cv_destroy(&sc->sc_cv);
+ cv_destroy(&sc->sc_cv);
return (0);
}
@@ -514,7 +514,7 @@ ufoma_cfg_link_state(struct ufoma_softc *sc)
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
&req, sc->sc_modetable, 0, 1000);
- error = usb2_cv_timedwait(&sc->sc_cv, &sc->sc_mtx, hz);
+ error = cv_timedwait(&sc->sc_cv, &sc->sc_mtx, hz);
if (error) {
DPRINTF("NO response\n");
@@ -536,7 +536,7 @@ ufoma_cfg_activate_state(struct ufoma_softc *sc, uint16_t state)
usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
&req, NULL, 0, 1000);
- error = usb2_cv_timedwait(&sc->sc_cv, &sc->sc_mtx,
+ error = cv_timedwait(&sc->sc_cv, &sc->sc_mtx,
(UFOMA_MAX_TIMEOUT * hz));
if (error) {
DPRINTF("No response\n");
@@ -672,7 +672,7 @@ ufoma_intr_callback(struct usb_xfer *xfer)
if (!(temp & 0xff)) {
DPRINTF("Mode change failed!\n");
}
- usb2_cv_signal(&sc->sc_cv);
+ cv_signal(&sc->sc_cv);
}
if (pkt.bmRequestType != UCDC_NOTIFICATION) {
goto tr_setup;
diff --git a/sys/dev/usb/serial/usb_serial.c b/sys/dev/usb/serial/usb_serial.c
index b965fd1..6bb0f6d 100644
--- a/sys/dev/usb/serial/usb_serial.c
+++ b/sys/dev/usb/serial/usb_serial.c
@@ -328,7 +328,7 @@ usb2_com_attach_tty(struct ucom_softc *sc, uint32_t sub_units)
sc->sc_tty = tp;
DPRINTF("ttycreate: %s\n", buf);
- usb2_cv_init(&sc->sc_cv, "usb2_com");
+ cv_init(&sc->sc_cv, "usb2_com");
done:
return (error);
@@ -358,7 +358,7 @@ usb2_com_detach_tty(struct ucom_softc *sc)
mtx_lock(sc->sc_mtx);
/* Wait for the callback after the TTY is torn down */
while (sc->sc_ttyfreed == 0)
- usb2_cv_wait(&sc->sc_cv, sc->sc_mtx);
+ cv_wait(&sc->sc_cv, sc->sc_mtx);
/*
* make sure that read and write transfers are stopped
*/
@@ -370,7 +370,7 @@ usb2_com_detach_tty(struct ucom_softc *sc)
}
mtx_unlock(sc->sc_mtx);
}
- usb2_cv_destroy(&sc->sc_cv);
+ cv_destroy(&sc->sc_cv);
}
static void
@@ -1117,6 +1117,6 @@ usb2_com_free(void *xsc)
mtx_lock(sc->sc_mtx);
sc->sc_ttyfreed = 1;
- usb2_cv_signal(&sc->sc_cv);
+ cv_signal(&sc->sc_cv);
mtx_unlock(sc->sc_mtx);
}
diff --git a/sys/dev/usb/usb_busdma.c b/sys/dev/usb/usb_busdma.c
index eb6c536..0059303 100644
--- a/sys/dev/usb/usb_busdma.c
+++ b/sys/dev/usb/usb_busdma.c
@@ -445,7 +445,7 @@ done:
if (isload) {
(uptag->func) (uptag);
} else {
- usb2_cv_broadcast(uptag->cv);
+ cv_broadcast(uptag->cv);
}
if (!owned)
mtx_unlock(uptag->mtx);
@@ -531,7 +531,7 @@ usb2_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
pc, (BUS_DMA_WAITOK | BUS_DMA_COHERENT));
if (err == EINPROGRESS) {
- usb2_cv_wait(uptag->cv, uptag->mtx);
+ cv_wait(uptag->cv, uptag->mtx);
err = 0;
}
mtx_unlock(uptag->mtx);
@@ -612,7 +612,7 @@ usb2_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync)
pc->tag, pc->map, pc->buffer, size,
&usb2_pc_alloc_mem_cb, pc, BUS_DMA_WAITOK);
if (err == EINPROGRESS) {
- usb2_cv_wait(uptag->cv, uptag->mtx);
+ cv_wait(uptag->cv, uptag->mtx);
err = 0;
}
if (err || uptag->dma_error) {
@@ -782,7 +782,7 @@ usb2_dma_tag_setup(struct usb_dma_parent_tag *udpt,
return;
}
/* initialise condition variable */
- usb2_cv_init(udpt->cv, "USB DMA CV");
+ cv_init(udpt->cv, "USB DMA CV");
/* store some information */
udpt->mtx = mtx;
@@ -823,7 +823,7 @@ usb2_dma_tag_unsetup(struct usb_dma_parent_tag *udpt)
if (udpt->utag_max) {
/* destroy the condition variable */
- usb2_cv_destroy(udpt->cv);
+ cv_destroy(udpt->cv);
}
}
diff --git a/sys/dev/usb/usb_compat_linux.c b/sys/dev/usb/usb_compat_linux.c
index 95f708f..dc3829d 100644
--- a/sys/dev/usb/usb_compat_linux.c
+++ b/sys/dev/usb/usb_compat_linux.c
@@ -556,7 +556,7 @@ usb_start_wait_urb(struct urb *urb, usb_timeout_t timeout, uint16_t *p_actlen)
*/
while (urb->transfer_flags & URB_WAIT_WAKEUP) {
urb->transfer_flags |= URB_IS_SLEEPING;
- usb2_cv_wait(&urb->cv_wait, &Giant);
+ cv_wait(&urb->cv_wait, &Giant);
urb->transfer_flags &= ~URB_IS_SLEEPING;
}
@@ -943,7 +943,7 @@ usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags)
urb = malloc(size, M_USBDEV, M_WAITOK | M_ZERO);
if (urb) {
- usb2_cv_init(&urb->cv_wait, "URBWAIT");
+ cv_init(&urb->cv_wait, "URBWAIT");
if (iso_packets == 0xFFFF) {
urb->setup_packet = (void *)(urb + 1);
urb->transfer_buffer = (void *)(urb->setup_packet +
@@ -1169,7 +1169,7 @@ usb_free_urb(struct urb *urb)
usb_kill_urb(urb);
/* destroy condition variable */
- usb2_cv_destroy(&urb->cv_wait);
+ cv_destroy(&urb->cv_wait);
/* just free it */
free(urb, M_USBDEV);
@@ -1252,7 +1252,7 @@ static void
usb_linux_wait_complete(struct urb *urb)
{
if (urb->transfer_flags & URB_IS_SLEEPING) {
- usb2_cv_signal(&urb->cv_wait);
+ cv_signal(&urb->cv_wait);
}
urb->transfer_flags &= ~URB_WAIT_WAKEUP;
}
diff --git a/sys/dev/usb/usb_core.h b/sys/dev/usb/usb_core.h
index 12e1368..dd6990f 100644
--- a/sys/dev/usb/usb_core.h
+++ b/sys/dev/usb/usb_core.h
@@ -41,14 +41,6 @@
/* Default USB configuration */
/*
- * The following macro defines if the code shall use cv_xxx() instead
- * of msleep() and wakeup().
- */
-#ifndef USB_HAVE_CONDVAR
-#define USB_HAVE_CONDVAR 0
-#endif
-
-/*
* The following macro defines if the code shall support
* /dev/usb/x.y.z.
*/
diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c
index 8db0c1e..80b7f46 100644
--- a/sys/dev/usb/usb_dev.c
+++ b/sys/dev/usb/usb_dev.c
@@ -261,7 +261,7 @@ error:
if (crd->is_uref) {
sx_unlock(cpd->udev->default_sx + 1);
if (--(cpd->udev->refcount) == 0) {
- usb2_cv_signal(cpd->udev->default_cv + 1);
+ cv_signal(cpd->udev->default_cv + 1);
}
}
mtx_unlock(&usb2_ref_lock);
@@ -318,19 +318,19 @@ usb2_unref_device(struct usb_cdev_privdata *cpd,
mtx_lock(&usb2_ref_lock);
if (crd->is_read) {
if (--(crd->rxfifo->refcount) == 0) {
- usb2_cv_signal(&crd->rxfifo->cv_drain);
+ cv_signal(&crd->rxfifo->cv_drain);
}
crd->is_read = 0;
}
if (crd->is_write) {
if (--(crd->txfifo->refcount) == 0) {
- usb2_cv_signal(&crd->txfifo->cv_drain);
+ cv_signal(&crd->txfifo->cv_drain);
}
crd->is_write = 0;
}
if (crd->is_uref) {
if (--(cpd->udev->refcount) == 0) {
- usb2_cv_signal(cpd->udev->default_cv + 1);
+ cv_signal(cpd->udev->default_cv + 1);
}
crd->is_uref = 0;
}
@@ -344,8 +344,8 @@ usb2_fifo_alloc(void)
f = malloc(sizeof(*f), M_USBDEV, M_WAITOK | M_ZERO);
if (f) {
- usb2_cv_init(&f->cv_io, "FIFO-IO");
- usb2_cv_init(&f->cv_drain, "FIFO-DRAIN");
+ cv_init(&f->cv_io, "FIFO-IO");
+ cv_init(&f->cv_drain, "FIFO-DRAIN");
f->refcount = 1;
}
return (f);
@@ -567,21 +567,21 @@ usb2_fifo_free(struct usb_fifo *f)
/* get I/O thread out of any sleep state */
if (f->flag_sleeping) {
f->flag_sleeping = 0;
- usb2_cv_broadcast(&f->cv_io);
+ cv_broadcast(&f->cv_io);
}
mtx_unlock(f->priv_mtx);
mtx_lock(&usb2_ref_lock);
/* wait for sync */
- usb2_cv_wait(&f->cv_drain, &usb2_ref_lock);
+ cv_wait(&f->cv_drain, &usb2_ref_lock);
}
mtx_unlock(&usb2_ref_lock);
/* take care of closing the device here, if any */
usb2_fifo_close(f, 0);
- usb2_cv_destroy(&f->cv_io);
- usb2_cv_destroy(&f->cv_drain);
+ cv_destroy(&f->cv_io);
+ cv_destroy(&f->cv_drain);
free(f, M_USBDEV);
}
@@ -768,7 +768,7 @@ usb2_fifo_close(struct usb_fifo *f, int fflags)
(!f->flag_iserror)) {
/* wait until all data has been written */
f->flag_sleeping = 1;
- err = usb2_cv_wait_sig(&f->cv_io, f->priv_mtx);
+ err = cv_wait_sig(&f->cv_io, f->priv_mtx);
if (err) {
DPRINTF("signal received\n");
break;
@@ -1454,7 +1454,7 @@ usb2_fifo_wait(struct usb_fifo *f)
}
f->flag_sleeping = 1;
- err = usb2_cv_wait_sig(&f->cv_io, f->priv_mtx);
+ err = cv_wait_sig(&f->cv_io, f->priv_mtx);
if (f->flag_iserror) {
/* we are gone */
@@ -1468,7 +1468,7 @@ usb2_fifo_signal(struct usb_fifo *f)
{
if (f->flag_sleeping) {
f->flag_sleeping = 0;
- usb2_cv_broadcast(&f->cv_io);
+ cv_broadcast(&f->cv_io);
}
}
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
index a037e3d..1e7cf51 100644
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -1464,8 +1464,8 @@ usb2_alloc_device(device_t parent_dev, struct usb_bus *bus,
/* initialise our SX-lock */
sx_init(udev->default_sx + 1, "0123456789ABCDEF - USB config SX lock" + depth);
- usb2_cv_init(udev->default_cv, "WCTRL");
- usb2_cv_init(udev->default_cv + 1, "UGONE");
+ cv_init(udev->default_cv, "WCTRL");
+ cv_init(udev->default_cv + 1, "UGONE");
/* initialise our mutex */
mtx_init(udev->default_mtx, "USB device mutex", NULL, MTX_DEF);
@@ -1947,7 +1947,7 @@ usb2_free_device(struct usb_device *udev, uint8_t flag)
mtx_lock(&usb2_ref_lock);
udev->refcount--;
while (udev->refcount != 0) {
- usb2_cv_wait(udev->default_cv + 1, &usb2_ref_lock);
+ cv_wait(udev->default_cv + 1, &usb2_ref_lock);
}
mtx_unlock(&usb2_ref_lock);
@@ -1981,8 +1981,8 @@ usb2_free_device(struct usb_device *udev, uint8_t flag)
sx_destroy(udev->default_sx);
sx_destroy(udev->default_sx + 1);
- usb2_cv_destroy(udev->default_cv);
- usb2_cv_destroy(udev->default_cv + 1);
+ cv_destroy(udev->default_cv);
+ cv_destroy(udev->default_cv + 1);
mtx_destroy(udev->default_mtx);
#if USB_HAVE_UGEN
diff --git a/sys/dev/usb/usb_msctest.c b/sys/dev/usb/usb_msctest.c
index 51ba897..f8981ac 100644
--- a/sys/dev/usb/usb_msctest.c
+++ b/sys/dev/usb/usb_msctest.c
@@ -214,7 +214,7 @@ bbb_done(struct bbb_transfer *sc, uint8_t error)
sc->error = error;
sc->state = ST_COMMAND;
sc->status_try = 1;
- usb2_cv_signal(&sc->cv);
+ cv_signal(&sc->cv);
}
static void
@@ -450,7 +450,7 @@ bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun,
usb2_transfer_start(sc->xfer[sc->state]);
while (usb2_transfer_pending(sc->xfer[sc->state])) {
- usb2_cv_wait(&sc->cv, &sc->mtx);
+ cv_wait(&sc->cv, &sc->mtx);
}
return (sc->error);
}
@@ -508,7 +508,7 @@ usb2_test_autoinstall(struct usb_device *udev, uint8_t iface_index,
return (USB_ERR_NOMEM);
}
mtx_init(&sc->mtx, "USB autoinstall", NULL, MTX_DEF);
- usb2_cv_init(&sc->cv, "WBBB");
+ cv_init(&sc->cv, "WBBB");
err = usb2_transfer_setup(udev,
&iface_index, sc->xfer, bbb_config,
@@ -568,7 +568,7 @@ done:
mtx_unlock(&sc->mtx);
usb2_transfer_unsetup(sc->xfer, ST_MAX);
mtx_destroy(&sc->mtx);
- usb2_cv_destroy(&sc->cv);
+ cv_destroy(&sc->cv);
free(sc, M_USB);
return (err);
}
diff --git a/sys/dev/usb/usb_process.c b/sys/dev/usb/usb_process.c
index ab8280a..f36d57c 100644
--- a/sys/dev/usb/usb_process.c
+++ b/sys/dev/usb/usb_process.c
@@ -150,14 +150,14 @@ usb_process(void *arg)
/* end if messages - check if anyone is waiting for sync */
if (up->up_dsleep) {
up->up_dsleep = 0;
- usb2_cv_broadcast(&up->up_drain);
+ cv_broadcast(&up->up_drain);
}
up->up_msleep = 1;
- usb2_cv_wait(&up->up_cv, up->up_mtx);
+ cv_wait(&up->up_cv, up->up_mtx);
}
up->up_ptr = NULL;
- usb2_cv_signal(&up->up_cv);
+ cv_signal(&up->up_cv);
mtx_unlock(up->up_mtx);
USB_THREAD_EXIT(0);
@@ -185,8 +185,8 @@ usb2_proc_create(struct usb_process *up, struct mtx *p_mtx,
TAILQ_INIT(&up->up_qhead);
- usb2_cv_init(&up->up_cv, "wmsg");
- usb2_cv_init(&up->up_drain, "dmsg");
+ cv_init(&up->up_cv, "wmsg");
+ cv_init(&up->up_drain, "dmsg");
if (USB_THREAD_CREATE(&usb_process, up,
&up->up_ptr, pmesg)) {
@@ -219,8 +219,8 @@ usb2_proc_free(struct usb_process *up)
usb2_proc_drain(up);
- usb2_cv_destroy(&up->up_cv);
- usb2_cv_destroy(&up->up_drain);
+ cv_destroy(&up->up_cv);
+ cv_destroy(&up->up_drain);
/* make sure that we do not enter here again */
up->up_mtx = NULL;
@@ -308,7 +308,7 @@ usb2_proc_msignal(struct usb_process *up, void *_pm0, void *_pm1)
if (up->up_msleep) {
up->up_msleep = 0; /* save "cv_signal()" calls */
- usb2_cv_signal(&up->up_cv);
+ cv_signal(&up->up_cv);
}
return (pm2);
}
@@ -366,7 +366,7 @@ usb2_proc_mwait(struct usb_process *up, void *_pm0, void *_pm1)
if (up->up_gone)
break;
up->up_dsleep = 1;
- usb2_cv_wait(&up->up_drain, up->up_mtx);
+ cv_wait(&up->up_drain, up->up_mtx);
}
}
@@ -402,7 +402,7 @@ usb2_proc_drain(struct usb_process *up)
if (up->up_msleep || up->up_csleep) {
up->up_msleep = 0;
up->up_csleep = 0;
- usb2_cv_signal(&up->up_cv);
+ cv_signal(&up->up_cv);
}
/* Check if we are still cold booted */
@@ -412,13 +412,13 @@ usb2_proc_drain(struct usb_process *up)
"been left suspended!\n");
break;
}
- usb2_cv_wait(&up->up_cv, up->up_mtx);
+ cv_wait(&up->up_cv, up->up_mtx);
}
/* Check if someone is waiting - should not happen */
if (up->up_dsleep) {
up->up_dsleep = 0;
- usb2_cv_broadcast(&up->up_drain);
+ cv_broadcast(&up->up_drain);
DPRINTF("WARNING: Someone is waiting "
"for USB process drain!\n");
}
diff --git a/sys/dev/usb/usb_request.c b/sys/dev/usb/usb_request.c
index e4e7fe8..da694c5 100644
--- a/sys/dev/usb/usb_request.c
+++ b/sys/dev/usb/usb_request.c
@@ -79,7 +79,7 @@ usb2_do_request_callback(struct usb_xfer *xfer)
usb2_start_hardware(xfer);
break;
default:
- usb2_cv_signal(xfer->xroot->udev->default_cv);
+ cv_signal(xfer->xroot->udev->default_cv);
break;
}
}
@@ -437,7 +437,7 @@ usb2_do_request_flags(struct usb_device *udev, struct mtx *mtx,
usb2_transfer_start(xfer);
while (usb2_transfer_pending(xfer)) {
- usb2_cv_wait(udev->default_cv,
+ cv_wait(udev->default_cv,
xfer->xroot->xfer_mtx);
}
diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c
index fbd071d..f258314 100644
--- a/sys/dev/usb/usb_transfer.c
+++ b/sys/dev/usb/usb_transfer.c
@@ -799,7 +799,7 @@ usb2_transfer_setup(struct usb_device *udev,
info->xfer_page_cache_start = USB_ADD_BYTES(buf, parm.size[5]);
info->xfer_page_cache_end = USB_ADD_BYTES(buf, parm.size[2]);
- usb2_cv_init(&info->cv_drain, "WDRAIN");
+ cv_init(&info->cv_drain, "WDRAIN");
info->xfer_mtx = xfer_mtx;
#if USB_HAVE_BUSDMA
@@ -1089,7 +1089,7 @@ usb2_transfer_unsetup_sub(struct usb_xfer_root *info, uint8_t needs_delay)
usb2_dma_tag_unsetup(&info->dma_parent_tag);
#endif
- usb2_cv_destroy(&info->cv_drain);
+ cv_destroy(&info->cv_drain);
/*
* free the "memory_base" last, hence the "info" structure is
@@ -1775,7 +1775,7 @@ usb2_transfer_drain(struct usb_xfer *xfer)
* Wait until the current outstanding USB
* transfer is complete !
*/
- usb2_cv_wait(&xfer->xroot->cv_drain, xfer->xroot->xfer_mtx);
+ cv_wait(&xfer->xroot->cv_drain, xfer->xroot->xfer_mtx);
}
USB_XFER_UNLOCK(xfer);
}
@@ -1988,7 +1988,7 @@ done:
(!xfer->flags_int.transferring)) {
/* "usb2_transfer_drain()" is waiting for end of transfer */
xfer->flags_int.draining = 0;
- usb2_cv_broadcast(&info->cv_drain);
+ cv_broadcast(&info->cv_drain);
}
/* do the next callback, if any */
diff --git a/sys/dev/usb/usb_util.c b/sys/dev/usb/usb_util.c
index 5e5bf83..ab0c987 100644
--- a/sys/dev/usb/usb_util.c
+++ b/sys/dev/usb/usb_util.c
@@ -38,11 +38,6 @@
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
-/* function prototypes */
-#if (USB_HAVE_CONDVAR == 0)
-static int usb2_msleep(void *chan, struct mtx *mtx, int priority, const char *wmesg, int timo);
-
-#endif
/*------------------------------------------------------------------------*
* device_delete_all_children - delete all children of a device
@@ -233,101 +228,3 @@ usb2_make_str_desc(void *ptr, uint16_t max_len, const char *s)
}
return (totlen);
}
-
-#if (USB_HAVE_CONDVAR == 0)
-
-/*------------------------------------------------------------------------*
- * usb2_cv_init - wrapper function
- *------------------------------------------------------------------------*/
-void
-usb2_cv_init(struct cv *cv, const char *desc)
-{
- cv_init(cv, desc);
-}
-
-/*------------------------------------------------------------------------*
- * usb2_cv_destroy - wrapper function
- *------------------------------------------------------------------------*/
-void
-usb2_cv_destroy(struct cv *cv)
-{
- cv_destroy(cv);
-}
-
-/*------------------------------------------------------------------------*
- * usb2_cv_wait - wrapper function
- *------------------------------------------------------------------------*/
-void
-usb2_cv_wait(struct cv *cv, struct mtx *mtx)
-{
- int err;
-
- err = usb2_msleep(cv, mtx, 0, cv_wmesg(cv), 0);
-}
-
-/*------------------------------------------------------------------------*
- * usb2_cv_wait_sig - wrapper function
- *------------------------------------------------------------------------*/
-int
-usb2_cv_wait_sig(struct cv *cv, struct mtx *mtx)
-{
- int err;
-
- err = usb2_msleep(cv, mtx, PCATCH, cv_wmesg(cv), 0);
- return (err);
-}
-
-/*------------------------------------------------------------------------*
- * usb2_cv_timedwait - wrapper function
- *------------------------------------------------------------------------*/
-int
-usb2_cv_timedwait(struct cv *cv, struct mtx *mtx, int timo)
-{
- int err;
-
- if (timo == 0)
- timo = 1; /* zero means no timeout */
- err = usb2_msleep(cv, mtx, 0, cv_wmesg(cv), timo);
- return (err);
-}
-
-/*------------------------------------------------------------------------*
- * usb2_cv_signal - wrapper function
- *------------------------------------------------------------------------*/
-void
-usb2_cv_signal(struct cv *cv)
-{
- wakeup_one(cv);
-}
-
-/*------------------------------------------------------------------------*
- * usb2_cv_broadcast - wrapper function
- *------------------------------------------------------------------------*/
-void
-usb2_cv_broadcast(struct cv *cv)
-{
- wakeup(cv);
-}
-
-/*------------------------------------------------------------------------*
- * usb2_msleep - wrapper function
- *------------------------------------------------------------------------*/
-static int
-usb2_msleep(void *chan, struct mtx *mtx, int priority, const char *wmesg,
- int timo)
-{
- int err;
-
- if (mtx == &Giant) {
- err = tsleep(chan, priority, wmesg, timo);
- } else {
-#ifdef mtx_sleep
- err = mtx_sleep(chan, mtx, priority, wmesg, timo);
-#else
- err = msleep(chan, mtx, priority, wmesg, timo);
-#endif
- }
- return (err);
-}
-
-#endif
diff --git a/sys/dev/usb/usb_util.h b/sys/dev/usb/usb_util.h
index a265a44..4273306 100644
--- a/sys/dev/usb/usb_util.h
+++ b/sys/dev/usb/usb_util.h
@@ -34,23 +34,4 @@ void usb2_pause_mtx(struct mtx *mtx, int _ticks);
void usb2_printBCD(char *p, uint16_t p_len, uint16_t bcd);
void usb2_trim_spaces(char *p);
-#if (USB_HAVE_CONDVAR == 0)
-void usb2_cv_init(struct cv *cv, const char *desc);
-void usb2_cv_destroy(struct cv *cv);
-void usb2_cv_wait(struct cv *cv, struct mtx *mtx);
-int usb2_cv_wait_sig(struct cv *cv, struct mtx *mtx);
-int usb2_cv_timedwait(struct cv *cv, struct mtx *mtx, int timo);
-void usb2_cv_signal(struct cv *cv);
-void usb2_cv_broadcast(struct cv *cv);
-
-#else
-#define usb2_cv_init cv_init
-#define usb2_cv_destroy cv_destroy
-#define usb2_cv_wait cv_wait
-#define usb2_cv_wait_sig cv_wait_sig
-#define usb2_cv_timedwait cv_timedwait
-#define usb2_cv_signal cv_signal
-#define usb2_cv_broadcast cv_broadcast
-#endif
-
#endif /* _USB2_UTIL_H_ */
OpenPOWER on IntegriCloud