Author: thompsa
Date: Mon Jun 15 00:33:18 2009
New Revision: 194227
URL: http://svn.freebsd.org/changeset/base/194227

Log:
  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.

Modified:
  head/sys/dev/usb/serial/ufoma.c
  head/sys/dev/usb/serial/usb_serial.c
  head/sys/dev/usb/usb_busdma.c
  head/sys/dev/usb/usb_compat_linux.c
  head/sys/dev/usb/usb_core.h
  head/sys/dev/usb/usb_dev.c
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_msctest.c
  head/sys/dev/usb/usb_process.c
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/usb_util.c
  head/sys/dev/usb/usb_util.h

Modified: head/sys/dev/usb/serial/ufoma.c
==============================================================================
--- head/sys/dev/usb/serial/ufoma.c     Mon Jun 15 00:17:22 2009        
(r194226)
+++ head/sys/dev/usb/serial/ufoma.c     Mon Jun 15 00:33:18 2009        
(r194227)
@@ -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 
        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_so
        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 *xfe
                        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;

Modified: head/sys/dev/usb/serial/usb_serial.c
==============================================================================
--- head/sys/dev/usb/serial/usb_serial.c        Mon Jun 15 00:17:22 2009        
(r194226)
+++ head/sys/dev/usb/serial/usb_serial.c        Mon Jun 15 00:33:18 2009        
(r194227)
@@ -328,7 +328,7 @@ usb2_com_attach_tty(struct ucom_softc *s
        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 *s
                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 *s
                }
                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);
 }

Modified: head/sys/dev/usb/usb_busdma.c
==============================================================================
--- head/sys/dev/usb/usb_busdma.c       Mon Jun 15 00:17:22 2009        
(r194226)
+++ head/sys/dev/usb/usb_busdma.c       Mon Jun 15 00:33:18 2009        
(r194227)
@@ -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, (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->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
                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_pare
 
        if (udpt->utag_max) {
                /* destroy the condition variable */
-               usb2_cv_destroy(udpt->cv);
+               cv_destroy(udpt->cv);
        }
 }
 

Modified: head/sys/dev/usb/usb_compat_linux.c
==============================================================================
--- head/sys/dev/usb/usb_compat_linux.c Mon Jun 15 00:17:22 2009        
(r194226)
+++ head/sys/dev/usb/usb_compat_linux.c Mon Jun 15 00:33:18 2009        
(r194227)
@@ -556,7 +556,7 @@ usb_start_wait_urb(struct urb *urb, usb_
         */
        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, uint
        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;
 }

Modified: head/sys/dev/usb/usb_core.h
==============================================================================
--- head/sys/dev/usb/usb_core.h Mon Jun 15 00:17:22 2009        (r194226)
+++ head/sys/dev/usb/usb_core.h Mon Jun 15 00:33:18 2009        (r194227)
@@ -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.
  */

Modified: head/sys/dev/usb/usb_dev.c
==============================================================================
--- head/sys/dev/usb/usb_dev.c  Mon Jun 15 00:17:22 2009        (r194226)
+++ head/sys/dev/usb/usb_dev.c  Mon Jun 15 00:33:18 2009        (r194227)
@@ -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_privda
        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 
                            (!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);
        }
 }
 

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c       Mon Jun 15 00:17:22 2009        
(r194226)
+++ head/sys/dev/usb/usb_device.c       Mon Jun 15 00:33:18 2009        
(r194227)
@@ -1464,8 +1464,8 @@ usb2_alloc_device(device_t parent_dev, s
        /* 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
        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
        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

Modified: head/sys/dev/usb/usb_msctest.c
==============================================================================
--- head/sys/dev/usb/usb_msctest.c      Mon Jun 15 00:17:22 2009        
(r194226)
+++ head/sys/dev/usb/usb_msctest.c      Mon Jun 15 00:33:18 2009        
(r194227)
@@ -214,7 +214,7 @@ bbb_done(struct bbb_transfer *sc, uint8_
        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 *s
        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 
                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);
 }

Modified: head/sys/dev/usb/usb_process.c
==============================================================================
--- head/sys/dev/usb/usb_process.c      Mon Jun 15 00:17:22 2009        
(r194226)
+++ head/sys/dev/usb/usb_process.c      Mon Jun 15 00:33:18 2009        
(r194227)
@@ -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,
 
        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
 
        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, 
                        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");
        }

Modified: head/sys/dev/usb/usb_request.c
==============================================================================
--- head/sys/dev/usb/usb_request.c      Mon Jun 15 00:17:22 2009        
(r194226)
+++ head/sys/dev/usb/usb_request.c      Mon Jun 15 00:33:18 2009        
(r194227)
@@ -79,7 +79,7 @@ usb2_do_request_callback(struct usb_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 
                usb2_transfer_start(xfer);
 
                while (usb2_transfer_pending(xfer)) {
-                       usb2_cv_wait(udev->default_cv,
+                       cv_wait(udev->default_cv,
                            xfer->xroot->xfer_mtx);
                }
 

Modified: head/sys/dev/usb/usb_transfer.c
==============================================================================
--- head/sys/dev/usb/usb_transfer.c     Mon Jun 15 00:17:22 2009        
(r194226)
+++ head/sys/dev/usb/usb_transfer.c     Mon Jun 15 00:33:18 2009        
(r194227)
@@ -799,7 +799,7 @@ usb2_transfer_setup(struct usb_device *u
                        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_xfe
        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 *xfe
                 * 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 */

Modified: head/sys/dev/usb/usb_util.c
==============================================================================
--- head/sys/dev/usb/usb_util.c Mon Jun 15 00:17:22 2009        (r194226)
+++ head/sys/dev/usb/usb_util.c Mon Jun 15 00:33:18 2009        (r194227)
@@ -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 m
        }
        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

Modified: head/sys/dev/usb/usb_util.h
==============================================================================
--- head/sys/dev/usb/usb_util.h Mon Jun 15 00:17:22 2009        (r194226)
+++ head/sys/dev/usb/usb_util.h Mon Jun 15 00:33:18 2009        (r194227)
@@ -34,23 +34,4 @@ void usb2_pause_mtx(struct mtx *mtx, int
 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_ */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to