From f59ff2a32d68c5a297034f80941ee0a6eb7a5563 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Thu, 2 Feb 2017 05:27:48 +0000 Subject: [PATCH] [ath] ensure the NIC is woken up before changing the spectral scan parameters. --- sys/dev/ath/if_ath_spectral.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/dev/ath/if_ath_spectral.c b/sys/dev/ath/if_ath_spectral.c index e4afdaefbbb..acbd5218eff 100644 --- a/sys/dev/ath/if_ath_spectral.c +++ b/sys/dev/ath/if_ath_spectral.c @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include @@ -191,6 +192,10 @@ ath_ioctl_spectral(struct ath_softc *sc, struct ath_diag *ad) if (! ath_hal_spectral_supported(sc->sc_ah)) return (EINVAL); + ATH_LOCK(sc); + ath_power_set_power_state(sc, HAL_PM_AWAKE); + ATH_UNLOCK(sc); + if (ad->ad_id & ATH_DIAG_IN) { /* * Copy in data. @@ -285,6 +290,10 @@ bad: free(indata, M_TEMP); if ((ad->ad_id & ATH_DIAG_DYN) && outdata != NULL) free(outdata, M_TEMP); + ATH_LOCK(sc); + ath_power_restore_power_state(sc); + ATH_UNLOCK(sc); + return (error); }