Date: Thu, 3 Jan 2013 19:03:03 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245002 - head/sys/dev/ath Message-ID: <201301031903.r03J33an065889@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Thu Jan 3 19:03:03 2013 New Revision: 245002 URL: http://svnweb.freebsd.org/changeset/base/245002 Log: Don't call the spectral methods for NICS that don't implement them. Modified: head/sys/dev/ath/if_ath_spectral.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath_spectral.c ============================================================================== --- head/sys/dev/ath/if_ath_spectral.c Thu Jan 3 19:02:52 2013 (r245001) +++ head/sys/dev/ath/if_ath_spectral.c Thu Jan 3 19:03:03 2013 (r245002) @@ -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, 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. Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Thu Jan 3 19:02:52 2013 (r245001) +++ head/sys/dev/ath/if_athvar.h Thu Jan 3 19:03:03 2013 (r245002) @@ -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) \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301031903.r03J33an065889>