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: Clear watchdog timer before stopping har...



details:   https://anonhg.NetBSD.org/src/rev/d1bc3937ca3f
branches:  trunk
changeset: 362505:d1bc3937ca3f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:49:37 2022 +0000

description:
usbnet: Clear watchdog timer before stopping hardware.

No need to take the lock again -- which might not be necessary
because the callout and task have completed, but let's obviate the
need to think about that.

diffstat:

 sys/dev/usb/usbnet.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (45 lines):

diff -r b9b3100532ed -r d1bc3937ca3f sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Thu Mar 03 05:49:29 2022 +0000
+++ b/sys/dev/usb/usbnet.c      Thu Mar 03 05:49:37 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbnet.c,v 1.65 2022/03/03 05:49:29 riastradh Exp $    */
+/*     $NetBSD: usbnet.c,v 1.66 2022/03/03 05:49:37 riastradh Exp $    */
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.65 2022/03/03 05:49:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.66 2022/03/03 05:49:37 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -1128,9 +1128,14 @@
 
        usbnet_busy(un);
 
+       /*
+        * Prevent new activity (rescheduling ticks, xfers, &c.) and
+        * clear the watchdog timer.
+        */
        mutex_enter(&unp->unp_rxlock);
        mutex_enter(&unp->unp_txlock);
        unp->unp_stopping = true;
+       unp->unp_timer = 0;
        mutex_exit(&unp->unp_txlock);
        mutex_exit(&unp->unp_rxlock);
 
@@ -1152,11 +1157,6 @@
         */
        uno_stop(un, ifp, disable);
 
-       /* Clear the watchdog timer.  */
-       mutex_enter(&unp->unp_txlock);
-       unp->unp_timer = 0;
-       mutex_exit(&unp->unp_txlock);
-
        /* Stop transfers. */
        usbnet_ep_stop_pipes(un);
 



Home | Main Index | Thread Index | Old Index