From owner-svn-src-all@FreeBSD.ORG Thu Jan 3 19:03:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 14C0265A; Thu, 3 Jan 2013 19:03:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E2E43BF1; Thu, 3 Jan 2013 19:03:03 +0000 (UTC) Received: from svn.freebsd.org (svn.FreeBSD.org [8.8.178.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r03J33Fd065891; Thu, 3 Jan 2013 19:03:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r03J33an065889; Thu, 3 Jan 2013 19:03:03 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201301031903.r03J33an065889@svn.freebsd.org> From: Adrian Chadd Date: Thu, 3 Jan 2013 19:03:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245002 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jan 2013 19:03:04 -0000 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) \