From 93ded5905c36d34c4e4f132623c854bbd895b8c9 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 1 Nov 2012 15:44:10 -0700 Subject: libpayload: Turn the "debug" #define into the usb_debug static inline function. The "debug" macro used internally in the libpayload USB subsystem was very generically named and would leak into consumers of the library that included usb.h directly or indirectly. This change turns that #define from a macro into a static inline function to move away from the preprocessor, and also renames it to usb_debug so it's less likely to collide with something unrelated. Change-Id: I18717df111aa9671495f8a2a5bdb2c6311fa7acf Signed-off-by: Gabe Black Reviewed-on: http://review.coreboot.org/1738 Reviewed-by: Patrick Georgi Tested-by: build bot (Jenkins) --- payloads/libpayload/include/usb/usb.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'payloads/libpayload/include') diff --git a/payloads/libpayload/include/usb/usb.h b/payloads/libpayload/include/usb/usb.h index 27af9bc3a0..17eca01bd1 100644 --- a/payloads/libpayload/include/usb/usb.h +++ b/payloads/libpayload/include/usb/usb.h @@ -253,10 +253,14 @@ int usb_interface_check(u16 vendor, u16 device); #define USB_QUIRK_TEST (1 << 31) #define USB_QUIRK_NONE 0 +static inline void usb_debug(const char *fmt, ...) +{ #ifdef USB_DEBUG -# define debug(fmt, ...) printf(fmt, ##__VA_ARGS__) -#else -# define debug(fmt, ...) while (0) { printf(fmt, ##__VA_ARGS__); } + va_list ap; + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); #endif +} #endif -- cgit v1.2.3