Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb usbnet: usbnet_busy is no longer referenced; rel...



details:   https://anonhg.NetBSD.org/src/rev/fc04909ab574
branches:  trunk
changeset: 362523:fc04909ab574
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:52:11 2022 +0000

description:
usbnet: usbnet_busy is no longer referenced; release it!

diffstat:

 sys/dev/usb/usbnet.c |  42 ++----------------------------------------
 sys/dev/usb/usbnet.h |   8 +-------
 2 files changed, 3 insertions(+), 47 deletions(-)

diffs (132 lines):

diff -r c3e0af5de83a -r fc04909ab574 sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Thu Mar 03 05:52:03 2022 +0000
+++ b/sys/dev/usb/usbnet.c      Thu Mar 03 05:52:11 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbnet.c,v 1.77 2022/03/03 05:52:03 riastradh Exp $    */
+/*     $NetBSD: usbnet.c,v 1.78 2022/03/03 05:52:11 riastradh Exp $    */
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.77 2022/03/03 05:52:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.78 2022/03/03 05:52:11 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -56,7 +56,6 @@
         *   and the MII / media data.
         * - unp_rxlock protects the rx path and its data
         * - unp_txlock protects the tx path and its data
-        * - unp_detachcv handles detach vs open references
         *
         * the lock ordering is:
         *      ifnet lock -> unp_core_lock -> unp_rxlock -> unp_txlock
@@ -66,7 +65,6 @@
        kmutex_t                unp_core_lock;
        kmutex_t                unp_rxlock;
        kmutex_t                unp_txlock;
-       kcondvar_t              unp_detachcv;
 
        struct usbnet_cdata     unp_cdata;
 
@@ -83,7 +81,6 @@
        bool                    unp_ifp_attached;
        bool                    unp_link;
 
-       int                     unp_refcnt;
        int                     unp_timer;
        unsigned short          unp_if_flags;
        unsigned                unp_number;
@@ -883,27 +880,6 @@
        return error;
 }
 
-void
-usbnet_busy(struct usbnet *un)
-{
-       struct usbnet_private * const unp = un->un_pri;
-
-       usbnet_isowned_core(un);
-
-       unp->unp_refcnt++;
-}
-
-void
-usbnet_unbusy(struct usbnet *un)
-{
-       struct usbnet_private * const unp = un->un_pri;
-
-       usbnet_isowned_core(un);
-
-       if (--unp->unp_refcnt < 0)
-               cv_broadcast(&unp->unp_detachcv);
-}
-
 /* MII management. */
 
 int
@@ -1443,7 +1419,6 @@
        mutex_init(&unp->unp_txlock, MUTEX_DEFAULT, IPL_SOFTUSB);
        mutex_init(&unp->unp_rxlock, MUTEX_DEFAULT, IPL_SOFTUSB);
        mutex_init(&unp->unp_core_lock, MUTEX_DEFAULT, IPL_NONE);
-       cv_init(&unp->unp_detachcv, detname);
 
        rnd_attach_source(&unp->unp_rndsrc, device_xname(un->un_dev),
            RND_TYPE_NET, RND_FLAG_DEFAULT);
@@ -1636,24 +1611,11 @@
        usb_rem_task_wait(un->un_udev, &unp->unp_mcasttask, USB_TASKQ_DRIVER,
            NULL);
 
-       mutex_enter(&unp->unp_core_lock);
-       unp->unp_refcnt--;
-       if (unp->unp_refcnt >= 0) {
-               aprint_error_dev(un->un_dev, "%d stragglers\n",
-                   unp->unp_refcnt + 1);
-       }
-       while (unp->unp_refcnt >= 0) {
-               /* Wait for processes to go away */
-               cv_wait(&unp->unp_detachcv, &unp->unp_core_lock);
-       }
-       mutex_exit(&unp->unp_core_lock);
-
        usbnet_rx_list_free(un);
        usbnet_tx_list_free(un);
 
        rnd_detach_source(&unp->unp_rndsrc);
 
-       cv_destroy(&unp->unp_detachcv);
        mutex_destroy(&unp->unp_core_lock);
        mutex_destroy(&unp->unp_rxlock);
        mutex_destroy(&unp->unp_txlock);
diff -r c3e0af5de83a -r fc04909ab574 sys/dev/usb/usbnet.h
--- a/sys/dev/usb/usbnet.h      Thu Mar 03 05:52:03 2022 +0000
+++ b/sys/dev/usb/usbnet.h      Thu Mar 03 05:52:11 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbnet.h,v 1.24 2022/03/03 05:51:06 riastradh Exp $    */
+/*     $NetBSD: usbnet.h,v 1.25 2022/03/03 05:52:11 riastradh Exp $    */
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -177,9 +177,6 @@
  * explicitly to uno_override_ioctl; for all other devices, they are
  * handled inside usbnet by scheduling a task to asynchronously call
  * uno_mcast with IFNET_LOCK held.
- *
- * Busy reference counts are maintained across calls to: uno_stop,
- * uno_read_reg, uno_write_reg, uno_statchg, and uno_tick.
  */
 struct usbnet_ops {
        usbnet_stop_cb          uno_stop;               /* C */
@@ -314,9 +311,6 @@
        KASSERT(mutex_owned(usbnet_mutex_core(un)));
 }
 
-void   usbnet_busy(struct usbnet *);
-void   usbnet_unbusy(struct usbnet *);
-
 void   usbnet_lock_rx(struct usbnet *);
 void   usbnet_unlock_rx(struct usbnet *);
 kmutex_t *usbnet_mutex_rx(struct usbnet *);



Home | Main Index | Thread Index | Old Index