Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/dev/usb Only call the driver's stop function once.



details:   https://anonhg.NetBSD.org/src-all/rev/d290607d0af6
branches:  trunk
changeset: 371694:d290607d0af6
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Tue Sep 20 18:46:16 2022 +0200

description:
Only call the driver's stop function once.

diffstat:

 sys/dev/usb/usbwifi.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (36 lines):

diff -r 3d9cc86d980b -r d290607d0af6 sys/dev/usb/usbwifi.c
--- a/sys/dev/usb/usbwifi.c     Tue Sep 20 18:44:29 2022 +0200
+++ b/sys/dev/usb/usbwifi.c     Tue Sep 20 18:46:16 2022 +0200
@@ -972,15 +972,6 @@
        mutex_exit(&uwp->uwp_txlock);
        mutex_exit(&uwp->uwp_rxlock);
 
-       uwo_stop(uw);
-
-       /*
-        * XXXSMP Would like to
-        *      KASSERT(IFNET_LOCKED(ifp))
-        * here but the locking order is:
-        *      ifnet -> IEEE80211_LOCK -> rxlock -> txlock
-        * and IEEE80211_LOCK is already held.
-        */
        uwp->uwp_timer = 0;
 
        callout_halt(&uwp->uwp_stat_ch, usbwifi_mutex_ic(uw));
@@ -989,6 +980,16 @@
 
        /* Stop transfers. */
        usbwifi_ep_stop_pipes(uw);
+
+       /*
+        * Now that the software is quiescent, ask the driver to stop
+        * the hardware.  The driver's uwo_stop routine now has
+        * exclusive access to any registers.
+        *
+        * Don't bother if the device is being detached, though -- if
+        * it's been unplugged then there's no point in trying to touch
+        * the registers.
+        */
        if (!usbwifi_isdying(uw))
                uwo_stop(uw);
 



Home | Main Index | Thread Index | Old Index