Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb document usbnet_private locking. minor knf.



details:   https://anonhg.NetBSD.org/src/rev/c8c42e43559c
branches:  trunk
changeset: 965270:c8c42e43559c
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Sep 09 07:20:16 2019 +0000

description:
document usbnet_private locking.  minor knf.

diffstat:

 sys/dev/usb/usbnet.c |  9 +++++++--
 sys/dev/usb/usbnet.h |  5 +++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diffs (49 lines):

diff -r 5b8d101d8136 -r c8c42e43559c sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Mon Sep 09 05:36:21 2019 +0000
+++ b/sys/dev/usb/usbnet.c      Mon Sep 09 07:20:16 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbnet.c,v 1.27 2019/09/08 19:00:33 mrg Exp $  */
+/*     $NetBSD: usbnet.c,v 1.28 2019/09/09 07:20:16 mrg Exp $  */
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.27 2019/09/08 19:00:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.28 2019/09/09 07:20:16 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -59,6 +59,11 @@
         * - unp_rxlock protects the rx path and its data
         * - unp_txlock protects the tx path and its data
         * - unp_detachcv handles detach vs open references
+        *
+        * the lock ordering is:
+        *      ifnet lock -> unp_lock -> unp_rxlock -> unp_txlock
+        *      unp_lock -> unp_miilock
+        * and unp_lock may be dropped after taking unp_miilock.
         */
        kmutex_t                unp_lock;
        kmutex_t                unp_miilock;
diff -r 5b8d101d8136 -r c8c42e43559c sys/dev/usb/usbnet.h
--- a/sys/dev/usb/usbnet.h      Mon Sep 09 05:36:21 2019 +0000
+++ b/sys/dev/usb/usbnet.h      Mon Sep 09 07:20:16 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbnet.h,v 1.14 2019/08/23 04:32:57 mrg Exp $  */
+/*     $NetBSD: usbnet.h,v 1.15 2019/09/09 07:20:16 mrg Exp $  */
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -343,7 +343,8 @@
 
 /* autoconf */
 void   usbnet_attach(struct usbnet *un, const char *);
-void   usbnet_attach_ifp(struct usbnet *, unsigned, unsigned, const struct usbnet_mii *);
+void   usbnet_attach_ifp(struct usbnet *, unsigned, unsigned,
+                         const struct usbnet_mii *);
 int    usbnet_detach(device_t, int);
 int    usbnet_activate(device_t, devact_t);
 



Home | Main Index | Thread Index | Old Index