Skip to content

Commit

Permalink
rtlwifi: Rework RT_PRINT_DATA 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 15,000 bytes.

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

void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
const char *modname, const char *titlestring,
const void *hexdata, int hexdatalen)
{
if (unlikely(((comp) & rtlpriv->dbg.global_debug_mask) ||
((level) <= rtlpriv->dbg.global_debuglevel))) {
printk(KERN_DEBUG "%s: In process \"%s\" (pid %i): %s\n",
KBUILD_MODNAME, current->comm, current->pid,
titlestring);
print_hex_dump_bytes("", DUMP_PREFIX_NONE,
hexdata, hexdatalen);
}
}
EXPORT_SYMBOL_GPL(_rtl_dbg_print_data);

#endif

static struct dentry *debugfs_topdir;
Expand Down
17 changes: 6 additions & 11 deletions debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ void _rtl_dbg_trace(struct rtl_priv *rtlpriv, u64 comp, int level,
void _rtl_dbg_trace_string(struct rtl_priv *rtlpriv, u64 comp, int level,
const char *modname, const char *string);

void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
const char *modname, const char *titlestring,
const void *hexdata, int hexdatalen);

#define RT_TRACE(rtlpriv, comp, level, fmt, ...) \
_rtl_dbg_trace(rtlpriv, comp, level, \
KBUILD_MODNAME, fmt, ##__VA_ARGS__)
Expand All @@ -194,17 +198,8 @@ do { \

#define RT_PRINT_DATA(rtlpriv, _comp, _level, _titlestring, _hexdata, \
_hexdatalen) \
do { \
if (unlikely(((_comp) & rtlpriv->dbg.global_debug_mask) || \
(_level <= rtlpriv->dbg.global_debuglevel))) { \
printk(KERN_DEBUG "%s: In process \"%s\" (pid %i): %s\n", \
KBUILD_MODNAME, current->comm, current->pid, \
_titlestring); \
print_hex_dump_bytes("", DUMP_PREFIX_NONE, \
_hexdata, _hexdatalen); \
} \
} while (0)

_rtl_dbg_print_data(rtlpriv, _comp, _level, KBUILD_MODNAME, \
_titlestring, _hexdata, _hexdatalen)
#else

struct rtl_priv;
Expand Down

0 comments on commit 2c28e57

Please sign in to comment.