Module Name:    src
Committed By:   riastradh
Date:           Thu Mar  3 05:52:27 UTC 2022

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

Log Message:
usbnet: No need for the core lock in usbnet_ifflags_cb.

The only state this touches is unp_if_flags, and all paths touching
it also hold IFNET_LOCK -- not to mention this is the only path that
touches unp_if_flags in the first place!


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 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.79 src/sys/dev/usb/usbnet.c:1.80
--- src/sys/dev/usb/usbnet.c:1.79	Thu Mar  3 05:52:20 2022
+++ src/sys/dev/usb/usbnet.c	Thu Mar  3 05:52:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.79 2022/03/03 05:52:20 riastradh Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.80 2022/03/03 05:52:27 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.79 2022/03/03 05:52:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.80 2022/03/03 05:52:27 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -987,8 +987,6 @@ usbnet_ifflags_cb(struct ethercom *ec)
 
 	KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
 
-	mutex_enter(&unp->unp_core_lock);
-
 	const u_short changed = ifp->if_flags ^ unp->unp_if_flags;
 	if ((changed & ~(IFF_CANTCHANGE | IFF_DEBUG)) == 0) {
 		unp->unp_if_flags = ifp->if_flags;
@@ -998,8 +996,6 @@ usbnet_ifflags_cb(struct ethercom *ec)
 		rv = ENETRESET;
 	}
 
-	mutex_exit(&unp->unp_core_lock);
-
 	return rv;
 }
 

Reply via email to