From owner-svn-src-all@FreeBSD.ORG Sat Mar 5 21:20:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D0721065673; Sat, 5 Mar 2011 21:20:19 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D66388FC14; Sat, 5 Mar 2011 21:20:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p25LKIJh076541; Sat, 5 Mar 2011 21:20:18 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p25LKI1O076538; Sat, 5 Mar 2011 21:20:18 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201103052120.p25LKI1O076538@svn.freebsd.org> From: Adrian Chadd Date: Sat, 5 Mar 2011 21:20:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219315 - in head/sys/dev/ath: . ath_hal X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 05 Mar 2011 21:20:19 -0000 Author: adrian Date: Sat Mar 5 21:20:18 2011 New Revision: 219315 URL: http://svn.freebsd.org/changeset/base/219315 Log: Change HALDEBUG() to be a macro that conditionally calls the debug output routine. The earlier way of doing debugging would evaluate the function parameters before calling the HALDEBUG. In the case of detailed register debugging would mean a -lot- of unneeded register IO and other stuff was going on. This method evaluates the ath_hal_debug variable before the function parameters are evaluated, drastically reducing the amount of overhead enabling HAL debugging during compilation. Modified: head/sys/dev/ath/ah_osdep.c head/sys/dev/ath/ath_hal/ah_internal.h Modified: head/sys/dev/ath/ah_osdep.c ============================================================================== --- head/sys/dev/ath/ah_osdep.c Sat Mar 5 20:59:25 2011 (r219314) +++ head/sys/dev/ath/ah_osdep.c Sat Mar 5 21:20:18 2011 (r219315) @@ -71,7 +71,7 @@ extern void ath_hal_assert_failed(const int lineno, const char* msg); #endif #ifdef AH_DEBUG -extern void HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...); +extern void DO_HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...); #endif /* AH_DEBUG */ /* NB: put this here instead of the driver to avoid circular references */ @@ -79,7 +79,7 @@ SYSCTL_NODE(_hw, OID_AUTO, ath, CTLFLAG_ SYSCTL_NODE(_hw_ath, OID_AUTO, hal, CTLFLAG_RD, 0, "Atheros HAL parameters"); #ifdef AH_DEBUG -static int ath_hal_debug = 0; +int ath_hal_debug = 0; SYSCTL_INT(_hw_ath_hal, OID_AUTO, debug, CTLFLAG_RW, &ath_hal_debug, 0, "Atheros HAL debugging printfs"); TUNABLE_INT("hw.ath.hal.debug", &ath_hal_debug); @@ -136,7 +136,7 @@ ath_hal_ether_sprintf(const u_int8_t *ma #ifdef AH_DEBUG void -HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...) +DO_HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...) { if (ath_hal_debug & mask) { __va_list ap; Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Sat Mar 5 20:59:25 2011 (r219314) +++ head/sys/dev/ath/ath_hal/ah_internal.h Sat Mar 5 21:20:18 2011 (r219315) @@ -501,7 +501,14 @@ extern void ath_hal_free(void *); #ifdef AH_DEBUG #include "ah_debug.h" extern int ath_hal_debug; -extern void HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...) +#define HALDEBUG(_ah, __m, ...) \ + do { \ + if (ath_hal_debug & (__m)) { \ + DO_HALDEBUG((_ah), (__m), __VA_ARGS__); \ + } \ + } while(0); + +extern void DO_HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...) __printflike(3,4); #else #define HALDEBUG(_ah, __m, _fmt, ...)