Date: Sat, 5 Mar 2011 21:20:18 +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: r219315 - in head/sys/dev/ath: . ath_hal Message-ID: <201103052120.p25LKI1O076538@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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, ...)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103052120.p25LKI1O076538>