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: Delete the core lock from the API.



details:   https://anonhg.NetBSD.org/src/rev/8dbed936ca6a
branches:  trunk
changeset: 362542:8dbed936ca6a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:54:52 2022 +0000

description:
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.

diffstat:

 sys/dev/usb/usbnet.c |  34 ++++++++++++++--------------------
 sys/dev/usb/usbnet.h |  16 +---------------
 2 files changed, 15 insertions(+), 35 deletions(-)

diffs (92 lines):

diff -r 2d7dd9174cc0 -r 8dbed936ca6a sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Thu Mar 03 05:54:45 2022 +0000
+++ b/sys/dev/usb/usbnet.c      Thu Mar 03 05:54:52 2022 +0000
@@ -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 @@
 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 @@
 
 /* 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)
 {
diff -r 2d7dd9174cc0 -r 8dbed936ca6a sys/dev/usb/usbnet.h
--- a/sys/dev/usb/usbnet.h      Thu Mar 03 05:54:45 2022 +0000
+++ b/sys/dev/usb/usbnet.h      Thu Mar 03 05:54:52 2022 +0000
@@ -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 @@
 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:
  *



Home | Main Index | Thread Index | Old Index