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)
This commit is contained in:
Gabe Black
2012-11-01 15:44:10 -07:00
committed by Stefan Reinauer
parent 8670b9b81a
commit 93ded5905c
14 changed files with 129 additions and 125 deletions

View File

@ -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