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 Reorder state machine initialization, afte...



details:   https://anonhg.NetBSD.org/src-all/rev/cc9f8d6385ac
branches:  trunk
changeset: 374973:cc9f8d6385ac
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Wed Jul 01 12:31:21 2020 +1000

description:
Reorder state machine initialization, after the hw has been configured.

diffstat:

 sys/dev/pci/if_iwn.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (44 lines):

diff -r a4b697f1a9e4 -r cc9f8d6385ac sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c      Wed Jul 01 12:30:22 2020 +1000
+++ b/sys/dev/pci/if_iwn.c      Wed Jul 01 12:31:21 2020 +1000
@@ -6960,11 +6960,6 @@ iwn_init(struct ifnet *ifp)
        ifp->if_flags &= ~IFF_OACTIVE;
        ifp->if_flags |= IFF_RUNNING;
 
-       if (ic->ic_opmode == IEEE80211_M_MONITOR)
-               ieee80211_new_state(vap, IEEE80211_S_RUN, -1);
-       else if (vap->iv_roaming != IEEE80211_ROAMING_MANUAL)
-               ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
-
        iwn_init_channels(ic);
        ieee80211_chan_init(ic);
        ieee80211_media_status(ifp, &imr);
@@ -6976,6 +6971,12 @@ iwn_init(struct ifnet *ifp)
 out:
        mutex_exit(&sc->sc_mtx);
        ieee80211_init(ifp);
+
+       if (ic->ic_opmode == IEEE80211_M_MONITOR)
+               ieee80211_new_state(vap, IEEE80211_S_RUN, -1);
+       else if (vap->iv_roaming != IEEE80211_ROAMING_MANUAL)
+               ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
+
        return 0;
 
 fail:  mutex_exit(&sc->sc_mtx);
@@ -6996,13 +6997,13 @@ iwn_stop(struct ifnet *ifp, int disable)
        ifp->if_timer = sc->sc_tx_timer = 0;
        ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
 
-       ieee80211_new_state(vap, IEEE80211_S_INIT, -1);
-
        /* Power OFF hardware. */
        iwn_hw_stop(sc);
 
        if (!disable)
                mutex_exit(&sc->sc_mtx);
+
+       ieee80211_new_state(vap, IEEE80211_S_INIT, -1);
 }
 
 /*



Home | Main Index | Thread Index | Old Index