Don't call the spectral methods for NICS that don't implement them.

This commit is contained in:
adrian 2013-01-03 19:03:03 +00:00
parent bc62472c88
commit 34b50799cd
2 changed files with 18 additions and 2 deletions

View File

@ -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.

View File

@ -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) \