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

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

Log Message:
usbnet: Delete the core lock from the API.

Init/stop and ioctl happen under IFNET_LOCK.  Multicast updates only
happen after init and before stop.  Core lock is no longer a relevant
part of the API.  Internally, it serves essentially just to lock out
asynchronous mii activity during init/stop.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/usb/usbnet.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/usbnet.h

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.83 src/sys/dev/usb/usbnet.c:1.84
--- src/sys/dev/usb/usbnet.c:1.83	Thu Mar  3 05:54:28 2022
+++ src/sys/dev/usb/usbnet.c	Thu Mar  3 05:54:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.83 2022/03/03 05:54:28 riastradh Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.84 2022/03/03 05:54:52 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.83 2022/03/03 05:54:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.84 2022/03/03 05:54:52 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -102,6 +102,18 @@ volatile unsigned usbnet_number;
 static void usbnet_isowned_rx(struct usbnet *);
 static void usbnet_isowned_tx(struct usbnet *);
 
+static kmutex_t *
+usbnet_mutex_core(struct usbnet *un)
+{
+	return &un->un_pri->unp_core_lock;
+}
+
+static __inline__ void
+usbnet_isowned_core(struct usbnet *un)
+{
+	KASSERT(mutex_owned(usbnet_mutex_core(un)));
+}
+
 static int usbnet_modcmd(modcmd_t, void *);
 
 #ifdef USB_DEBUG
@@ -1312,24 +1324,6 @@ usbnet_isdying(struct usbnet *un)
 
 /* Locking. */
 
-void
-usbnet_lock_core(struct usbnet *un)
-{
-	mutex_enter(&un->un_pri->unp_core_lock);
-}
-
-void
-usbnet_unlock_core(struct usbnet *un)
-{
-	mutex_exit(&un->un_pri->unp_core_lock);
-}
-
-kmutex_t*
-usbnet_mutex_core(struct usbnet *un)
-{
-	return &un->un_pri->unp_core_lock;
-}
-
 static void
 usbnet_isowned_rx(struct usbnet *un)
 {

Index: src/sys/dev/usb/usbnet.h
diff -u src/sys/dev/usb/usbnet.h:1.27 src/sys/dev/usb/usbnet.h:1.28
--- src/sys/dev/usb/usbnet.h:1.27	Thu Mar  3 05:54:28 2022
+++ src/sys/dev/usb/usbnet.h	Thu Mar  3 05:54:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.h,v 1.27 2022/03/03 05:54:28 riastradh Exp $	*/
+/*	$NetBSD: usbnet.h,v 1.28 2022/03/03 05:54:52 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -297,20 +297,6 @@ void *usbnet_softc(struct usbnet *);
 bool usbnet_havelink(struct usbnet *);
 bool usbnet_isdying(struct usbnet *);
 
-
-/*
- * Locking.  Note that the isowned() are implemented here so that
- * empty-KASSERT() causes them to be elided for non-DIAG builds.
- */
-void	usbnet_lock_core(struct usbnet *);
-void	usbnet_unlock_core(struct usbnet *);
-kmutex_t *usbnet_mutex_core(struct usbnet *);
-static __inline__ void
-usbnet_isowned_core(struct usbnet *un)
-{
-	KASSERT(mutex_owned(usbnet_mutex_core(un)));
-}
-
 /*
  * Endpoint / rx/tx chain management:
  *

Reply via email to