From aaa1fdb87b7a9219e88f97fe0638f4ab166681e5 Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Fri, 11 Sep 2020 14:18:47 +0000 Subject: [PATCH] iwm: fix regression from r365419 (ieee80211_media_change()) In r365419 ieee80211_media_change() callers were updated to not longer act on the obselete ENETRESET return code. While in the old days iwm has done a stop/init cycle in these cases, this was not executed since r193340. As a consequence simplify iwm code as well by passing ieee80211_media_change() right to ieee80211_vap_attach() as there is no more need for a local implementation. Reported by: Tomoaki AOKI (junchoon dec.sakura.ne.jp) Tested by: Tomoaki AOKI (junchoon dec.sakura.ne.jp) MFC after: 3 days X-MFC: fix is already in stable/12 PR: 248955 --- sys/dev/iwm/if_iwm.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 614c75b3233..2029ddd6038 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -354,7 +354,6 @@ static struct ieee80211_node * static uint8_t iwm_rate_from_ucode_rate(uint32_t); static int iwm_rate2ridx(struct iwm_softc *, uint8_t); static void iwm_setrates(struct iwm_softc *, struct iwm_node *, int); -static int iwm_media_change(struct ifnet *); static int iwm_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void iwm_endscan_cb(void *, int); static int iwm_send_bt_init_conf(struct iwm_softc *); @@ -4417,27 +4416,6 @@ iwm_setrates(struct iwm_softc *sc, struct iwm_node *in, int rix) } } -static int -iwm_media_change(struct ifnet *ifp) -{ - struct ieee80211vap *vap = ifp->if_softc; - struct ieee80211com *ic = vap->iv_ic; - struct iwm_softc *sc = ic->ic_softc; - int error; - - error = ieee80211_media_change(ifp); - if (error != 0) - return (error); - - IWM_LOCK(sc); - if (ic->ic_nrunning > 0) { - iwm_stop(sc); - iwm_init(sc); - } - IWM_UNLOCK(sc); - return (0); -} - static void iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap) { @@ -6432,8 +6410,8 @@ iwm_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, ieee80211_ratectl_init(vap); /* Complete setup. */ - ieee80211_vap_attach(vap, iwm_media_change, ieee80211_media_status, - mac); + ieee80211_vap_attach(vap, ieee80211_media_change, + ieee80211_media_status, mac); ic->ic_opmode = opmode; return vap;