diff options
-rw-r--r-- | sys/dev/ath/if_ath_spectral.c | 18 | ||||
-rw-r--r-- | sys/dev/ath/if_athvar.h | 2 |
2 files changed, 18 insertions, 2 deletions
diff --git a/sys/dev/ath/if_ath_spectral.c b/sys/dev/ath/if_ath_spectral.c index 12fb87a7..0dc0114 100644 --- a/sys/dev/ath/if_ath_spectral.c +++ b/sys/dev/ath/if_ath_spectral.c @@ -82,13 +82,20 @@ struct ath_spectral_state { */ /* - * Attach DFS to the given interface + * Attach spectral to the given interface */ int ath_spectral_attach(struct ath_softc *sc) { struct ath_spectral_state *ss; + /* + * If spectral isn't supported, don't error - just + * quietly complete. + */ + if (! ath_hal_spectral_supported(sc->sc_ah)) + return (0); + ss = malloc(sizeof(struct ath_spectral_state), M_TEMP, M_WAITOK | M_ZERO); @@ -106,11 +113,15 @@ ath_spectral_attach(struct ath_softc *sc) } /* - * Detach DFS from the given interface + * Detach spectral from the given interface */ int ath_spectral_detach(struct ath_softc *sc) { + + if (! ath_hal_spectral_supported(sc->sc_ah)) + return (0); + if (sc->sc_spectral != NULL) { free(sc->sc_spectral, M_TEMP); } @@ -148,6 +159,9 @@ ath_ioctl_spectral(struct ath_softc *sc, struct ath_diag *ad) HAL_SPECTRAL_PARAM *pe; struct ath_spectral_state *ss = sc->sc_spectral; + if (! ath_hal_spectral_supported(sc->sc_ah)) + return (EINVAL); + if (ad->ad_id & ATH_DIAG_IN) { /* * Copy in data. diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h index 12252ed..2e170a3 100644 --- a/sys/dev/ath/if_athvar.h +++ b/sys/dev/ath/if_athvar.h @@ -1303,6 +1303,8 @@ void ath_intr(void *); #define ath_hal_get_chan_ext_busy(_ah) \ ((*(_ah)->ah_get11nExtBusy)((_ah))) +#define ath_hal_spectral_supported(_ah) \ + (ath_hal_getcapability(_ah, HAL_CAP_SPECTRAL_SCAN, 0, NULL) == HAL_OK) #define ath_hal_spectral_get_config(_ah, _p) \ ((*(_ah)->ah_spectralGetConfig)((_ah), (_p))) #define ath_hal_spectral_configure(_ah, _p) \ |