Thu Mar 3 05:51:56 2022 UTC ()
usbnet: No need for usbnet_busy in usbnet_init_rx_tx or usbnet_stop.

These run with IFNET_LOCK held, and the interface cannot be detached
until the IFNET_LOCK is released, so there is no need to hang onto a
reference count here.


(riastradh)
diff -r1.75 -r1.76 src/sys/dev/usb/usbnet.c

cvs diff -r1.75 -r1.76 src/sys/dev/usb/usbnet.c (expand / switch to context diff)
--- src/sys/dev/usb/usbnet.c 2022/03/03 05:51:06 1.75
+++ src/sys/dev/usb/usbnet.c 2022/03/03 05:51:56 1.76
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.75 2022/03/03 05:51:06 riastradh Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.76 2022/03/03 05:51:56 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.75 2022/03/03 05:51:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.76 2022/03/03 05:51:56 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -837,8 +837,6 @@
 		return EIO;
 	}
 
-	usbnet_busy(un);
-
 	/* Open RX and TX pipes. */
 	err = usbnet_ep_open_pipes(un);
 	if (err) {
@@ -879,7 +877,6 @@
 		usbnet_tx_list_fini(un);
 		usbnet_ep_close_pipes(un);
 	}
-	usbnet_unbusy(un);
 
 	usbnet_isowned_core(un);
 
@@ -1126,8 +1123,6 @@
 	    "%s", ifp->if_xname);
 	usbnet_isowned_core(un);
 
-	usbnet_busy(un);
-
 	/*
 	 * Prevent new activity (rescheduling ticks, xfers, &c.) and
 	 * clear the watchdog timer.
@@ -1176,8 +1171,6 @@
 	KASSERTMSG(!unp->unp_ifp_attached || IFNET_LOCKED(ifp),
 	    "%s", ifp->if_xname);
 	ifp->if_flags &= ~IFF_RUNNING;
-
-	usbnet_unbusy(un);
 }
 
 static void