diff options
author | Gabe Black <gabeblack@google.com> | 2012-11-01 15:44:10 -0700 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-11-07 18:38:37 +0100 |
commit | 93ded5905c36d34c4e4f132623c854bbd895b8c9 (patch) | |
tree | 242d35c611db91e2351a4e942ff518a66110ca38 /payloads/libpayload/include/usb | |
parent | 8670b9b81aba6bf51510e337d4f7208d2b4ea320 (diff) |
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 <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/1738
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'payloads/libpayload/include/usb')
-rw-r--r-- | payloads/libpayload/include/usb/usb.h | 10 |
1 files changed, 7 insertions, 3 deletions
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 |