Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/dev/pci Refactor condition for iwm_init.



details:   https://anonhg.NetBSD.org/src-all/rev/3084a5eafa85
branches:  trunk
changeset: 952286:3084a5eafa85
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Wed Jan 13 19:02:35 2021 +1100

description:
Refactor condition for iwm_init.

We only have to check to see if the device has stopped before calling
iwm_init.

The device has been put into the stopped state on attach more importantly
the device is marked IWM_FLAG_STOPPED.  The device is already in a stopped
state when leaving attach from code in iwm_preinit, but it is not marked
IWM_STOPPED.

This change ensures the device is marked stopped and be inited after
suspend/resume or a cold boot.

diffstat:

 sys/dev/pci/if_iwm.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 1135d70acbe4 -r 3084a5eafa85 sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c      Wed Jan 13 00:33:35 2021 +1100
+++ b/sys/dev/pci/if_iwm.c      Wed Jan 13 19:02:35 2021 +1100
@@ -8240,9 +8240,6 @@
            iwm_media_change, ieee80211_media_status, &sc->sc_media_mtx);
 #endif
 
-       /* Clear firmware flag to force full init from iwm_parent */
-       CLR(sc->sc_flags, IWM_FLAG_FW_LOADED);
-
        callout_setfunc(&sc->sc_calib_to, iwm_calib_timeout, sc);
        callout_setfunc(&sc->sc_led_blink_to, iwm_led_blink_timeout, sc);
 #ifndef IEEE80211_NO_HT
@@ -8271,6 +8268,8 @@
        }
 #endif
 
+       iwm_stop(sc);
+
        return 0;
 }
 
@@ -8286,8 +8285,7 @@
        bool startall = false;
 
        if (ic->ic_nrunning > 0) {
-               if ((sc->sc_flags & (IWM_FLAG_FW_LOADED|IWM_FLAG_STOPPED))
-                   != IWM_FLAG_FW_LOADED) {
+               if (sc->sc_flags & IWM_FLAG_STOPPED) {
                        iwm_init(vap->iv_ifp);
                        startall = true;
                } else {



Home | Main Index | Thread Index | Old Index