Skip to content

Commit

Permalink
rtlwifi: Rework RTPRINT macro
Browse files Browse the repository at this point in the history
The macro definition has been replaced by the equivalent compiled
routine. This change saves roughly 3,000 bytes.

Signed-off-by: Larry Finger <[email protected]>
  • Loading branch information
lwfinger committed Dec 9, 2016
1 parent 2c28e57 commit f9fdbf0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
21 changes: 21 additions & 0 deletions debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,27 @@ void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
}
EXPORT_SYMBOL_GPL(_rtl_dbg_print_data);

void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
const char *modname, const char *fmt, ...)
{
if (unlikely((comp & rtlpriv->dbg.global_debug_mask) ||
(level <= rtlpriv->dbg.global_debuglevel))) {
struct va_format vaf;
va_list args;

va_start(args, fmt);

vaf.fmt = fmt;
vaf.va = &args;

printk(KERN_DEBUG "%s: %pV",
modname, &vaf);

va_end(args);
}
}
EXPORT_SYMBOL_GPL(_rtl_dbg_print);

#endif

static struct dentry *debugfs_topdir;
Expand Down
11 changes: 5 additions & 6 deletions debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,16 @@ void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
const char *modname, const char *titlestring,
const void *hexdata, int hexdatalen);

void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
const char *modname, const char *fmt, ...);

#define RT_TRACE(rtlpriv, comp, level, fmt, ...) \
_rtl_dbg_trace(rtlpriv, comp, level, \
KBUILD_MODNAME, fmt, ##__VA_ARGS__)

#define RTPRINT(rtlpriv, dbgtype, dbgflag, fmt, ...) \
do { \
if (unlikely(rtlpriv->dbg.dbgp_type[dbgtype] & dbgflag)) { \
printk(KERN_DEBUG KBUILD_MODNAME ": " fmt, \
##__VA_ARGS__); \
} \
} while (0)
_rtl_dbg_print(rtlpriv, dbgtype, dbgflag, KBUILD_MODNAME, \
fmt, ##__VA_ARGS__)

#define RT_TRACE_STRING(__priv, comp, level, string) \
_rtl_dbg_trace_string(__priv, comp, level, \
Expand Down

0 comments on commit f9fdbf0

Please sign in to comment.