diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-03-03 05:49:37 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-03-03 05:49:37 +0000 |
| commit | 458bf894dec31cf7d7c2fdec30b368984623921b (patch) | |
| tree | b2cdf7db8c1b92de1f119b73d4a5d49f38130c68 /sys/dev | |
| parent | b74084dc3f086e5fa83e3aef422dd3078392e5aa (diff) | |
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 (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/usbnet.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/usb/usbnet.c b/sys/dev/usb/usbnet.c index 7c87f2dce5d..0b66295f48a 100644 --- a/sys/dev/usb/usbnet.c +++ b/sys/dev/usb/usbnet.c @@ -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_stop(struct usbnet *un, struct ifnet *ifp, int disable) 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 @@ usbnet_stop(struct usbnet *un, struct ifnet *ifp, int disable) */ 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); |
