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: Omit needless locking/busying/testing in...



details:   https://anonhg.NetBSD.org/src/rev/b9b3100532ed
branches:  trunk
changeset: 362504:b9b3100532ed
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:49:29 2022 +0000

description:
usbnet: Omit needless locking/busying/testing in usbnet_tick_task.

usbnet_stop waits for the task to complete before resetting the
hardware, and usbnet_detach waits for usbnet_stop to complete before
destroying anything, so there's no need for any of this.

diffstat:

 sys/dev/usb/usbnet.c |  19 +++----------------
 1 files changed, 3 insertions(+), 16 deletions(-)

diffs (50 lines):

diff -r 782752fcd4d0 -r b9b3100532ed sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Thu Mar 03 05:49:22 2022 +0000
+++ b/sys/dev/usb/usbnet.c      Thu Mar 03 05:49:29 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbnet.c,v 1.64 2022/03/03 05:49:22 riastradh Exp $    */
+/*     $NetBSD: usbnet.c,v 1.65 2022/03/03 05:49:29 riastradh Exp $    */
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.64 2022/03/03 05:49:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.65 2022/03/03 05:49:29 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -1239,22 +1239,10 @@
        USBNETHIST_FUNC();
        struct usbnet * const un = arg;
        struct usbnet_private * const unp = un->un_pri;
-
-       USBNETHIST_CALLARGSN(8, "%jd: enter", unp->unp_number, 0, 0, 0);
-
-       mutex_enter(&unp->unp_core_lock);
-       if (unp->unp_stopping || unp->unp_dying) {
-               mutex_exit(&unp->unp_core_lock);
-               return;
-       }
-
        struct ifnet * const ifp = usbnet_ifp(un);
        struct mii_data * const mii = usbnet_mii(un);
 
-       KASSERT(ifp != NULL);   /* embedded member */
-
-       usbnet_busy(un);
-       mutex_exit(&unp->unp_core_lock);
+       USBNETHIST_CALLARGSN(8, "%jd: enter", unp->unp_number, 0, 0, 0);
 
        mutex_enter(&unp->unp_txlock);
        const bool timeout = unp->unp_timer != 0 && --unp->unp_timer == 0;
@@ -1275,7 +1263,6 @@
        uno_tick(un);
 
        mutex_enter(&unp->unp_core_lock);
-       usbnet_unbusy(un);
        if (!unp->unp_stopping && !unp->unp_dying)
                callout_schedule(&unp->unp_stat_ch, hz);
        mutex_exit(&unp->unp_core_lock);



Home | Main Index | Thread Index | Old Index