diff options
author | sam <sam@FreeBSD.org> | 2007-02-24 23:23:29 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2007-02-24 23:23:29 +0000 |
commit | a95c51b9e7cc53e67b4c98f5bbf806aa8df2e32c (patch) | |
tree | e83e60117b2c599ad5925c603bc9470dcdc61121 | |
parent | faef66011a2046c4e005e5f3746991bbe51305f4 (diff) | |
download | FreeBSD-src-a95c51b9e7cc53e67b4c98f5bbf806aa8df2e32c.zip FreeBSD-src-a95c51b9e7cc53e67b4c98f5bbf806aa8df2e32c.tar.gz |
don't call ath_reset when processing sysctl's before the device
is marked running; we don't have all the needed state in place
Noticed by: Hugo Silva <hugo@barafranca.com>
MFC after: 1 week
-rw-r--r-- | sys/dev/ath/if_ath.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 5adb917..596c13d 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -5421,7 +5421,8 @@ ath_sysctl_tpscale(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &scale, 0, req); if (error || !req->newptr) return error; - return !ath_hal_settpscale(sc->sc_ah, scale) ? EINVAL : ath_reset(ifp); + return !ath_hal_settpscale(sc->sc_ah, scale) ? EINVAL : + (ifp->if_drv_flags & IFF_DRV_RUNNING) ? ath_reset(ifp) : 0; } static int @@ -5441,6 +5442,7 @@ static int ath_sysctl_rfkill(SYSCTL_HANDLER_ARGS) { struct ath_softc *sc = arg1; + struct ifnet *ifp = sc->sc_ifp; struct ath_hal *ah = sc->sc_ah; u_int rfkill = ath_hal_getrfkill(ah); int error; @@ -5450,10 +5452,9 @@ ath_sysctl_rfkill(SYSCTL_HANDLER_ARGS) return error; if (rfkill == ath_hal_getrfkill(ah)) /* unchanged */ return 0; - if (!ath_hal_setrfkill(ah, rfkill) || ath_reset(sc->sc_ifp) != 0) + if (!ath_hal_setrfkill(ah, rfkill)) return EINVAL; - else - return 0; + return (ifp->if_drv_flags & IFF_DRV_RUNNING) ? ath_reset(ifp) : 0; } static int |