Module Name:    src
Committed By:   mrg
Date:           Tue Sep 20 07:15:46 UTC 2022

Modified Files:
        src/sys/dev/usb: usbnet.c

Log Message:
revert rev 1.111 (which was 1.106 again, without the 1.107 changes).

fixes an assert reported by msaitoh@.  also fix another missing miilock
assert in usbnet_stop() that triggered for me.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/usb/usbnet.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.111 src/sys/dev/usb/usbnet.c:1.112
--- src/sys/dev/usb/usbnet.c:1.111	Tue Sep 13 09:38:19 2022
+++ src/sys/dev/usb/usbnet.c	Tue Sep 20 07:15:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.111 2022/09/13 09:38:19 riastradh Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.112 2022/09/20 07:15:46 mrg Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.111 2022/09/13 09:38:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.112 2022/09/20 07:15:46 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -1162,13 +1162,6 @@ usbnet_stop(struct usbnet *un, struct if
 		mutex_exit(&unp->unp_miilock);
 	}
 
-	/*
-	 * Now that we have stopped calling mii_tick, bring the MII
-	 * state machine down.
-	 */
-	if (mii)
-		mii_down(mii);
-
 	/* Stop transfers. */
 	usbnet_ep_stop_pipes(un);
 
@@ -1182,8 +1175,11 @@ usbnet_stop(struct usbnet *un, struct if
 	 * it's been unplugged then there's no point in trying to touch
 	 * the registers.
 	 */
-	if (!usbnet_isdying(un))
+	if (!usbnet_isdying(un)) {
+		mutex_enter(&unp->unp_miilock);
 		uno_stop(un, ifp, disable);
+		mutex_exit(&unp->unp_miilock);
+	}
 
 	/* Free RX/TX resources. */
 	usbnet_rx_list_fini(un);

Reply via email to