diff options
author | Alexander Aring <alex.aring@gmail.com> | 2013-12-12 14:15:25 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2013-12-12 15:14:54 -0500 |
commit | 841a5ec72c028432f716670c4a7c2e1b70ee1341 (patch) | |
tree | 7f5c061987928ff287c1c55b3ffe596c4c670f98 /net/ieee802154/6lowpan.h | |
parent | 30d3db44bb337321b25344eea3ed6a64ee16fcc8 (diff) |
6lowpan: fix/move/cleanup debug functions
There are several issues on current debug behaviour.
This patch fix the following issues:
- Fix debug printout only if DEBUG is defined.
- Move debug functions of 6LoWPAN code into 6lowpan header.
- Cleanup codestyle of debug functions.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/ieee802154/6lowpan.h')
-rw-r--r-- | net/ieee802154/6lowpan.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h index 535606d45c39..10909e58bb69 100644 --- a/net/ieee802154/6lowpan.h +++ b/net/ieee802154/6lowpan.h | |||
@@ -232,6 +232,38 @@ | |||
232 | dest = 16 bit inline */ | 232 | dest = 16 bit inline */ |
233 | #define LOWPAN_NHC_UDP_CS_P_11 0xF3 /* source & dest = 0xF0B + 4bit inline */ | 233 | #define LOWPAN_NHC_UDP_CS_P_11 0xF3 /* source & dest = 0xF0B + 4bit inline */ |
234 | 234 | ||
235 | #ifdef DEBUG | ||
236 | /* print data in line */ | ||
237 | static inline void raw_dump_inline(const char *caller, char *msg, | ||
238 | unsigned char *buf, int len) | ||
239 | { | ||
240 | if (msg) | ||
241 | pr_debug("%s():%s: ", caller, msg); | ||
242 | |||
243 | print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, buf, len, false); | ||
244 | } | ||
245 | |||
246 | /* print data in a table format: | ||
247 | * | ||
248 | * addr: xx xx xx xx xx xx | ||
249 | * addr: xx xx xx xx xx xx | ||
250 | * ... | ||
251 | */ | ||
252 | static inline void raw_dump_table(const char *caller, char *msg, | ||
253 | unsigned char *buf, int len) | ||
254 | { | ||
255 | if (msg) | ||
256 | pr_debug("%s():%s:\n", caller, msg); | ||
257 | |||
258 | print_hex_dump_debug("\t", DUMP_PREFIX_OFFSET, 16, 1, buf, len, false); | ||
259 | } | ||
260 | #else | ||
261 | static inline void raw_dump_table(const char *caller, char *msg, | ||
262 | unsigned char *buf, int len) { } | ||
263 | static inline void raw_dump_inline(const char *caller, char *msg, | ||
264 | unsigned char *buf, int len) { } | ||
265 | #endif | ||
266 | |||
235 | static inline int lowpan_fetch_skb_u8(struct sk_buff *skb, u8 *val) | 267 | static inline int lowpan_fetch_skb_u8(struct sk_buff *skb, u8 *val) |
236 | { | 268 | { |
237 | if (unlikely(!pskb_may_pull(skb, 1))) | 269 | if (unlikely(!pskb_may_pull(skb, 1))) |