Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264867
b: refs/heads/master
c: ffa10cb
h: refs/heads/master
i:
  264865: 4ec7a20
  264863: 16b6b66
v: v3
  • Loading branch information
Jason Baron authored and Greg Kroah-Hartman committed Aug 23, 2011
1 parent e75386a commit caf63ed
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ac0ac38f68be73b92dc390ceace50a0d143d76ae
refs/heads/master: ffa10cb47a94c9b456c83301c8047e2a898dd409
17 changes: 17 additions & 0 deletions trunk/include/linux/dynamic_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ extern int __dynamic_dev_dbg(struct _ddebug *descriptor,
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));

struct net_device;

extern int __dynamic_netdev_dbg(struct _ddebug *descriptor,
const struct net_device *dev,
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));

#define dynamic_pr_debug(fmt, ...) do { \
static struct _ddebug descriptor \
__used \
Expand All @@ -67,6 +74,16 @@ extern int __dynamic_dev_dbg(struct _ddebug *descriptor,
__dynamic_dev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__); \
} while (0)

#define dynamic_netdev_dbg(dev, fmt, ...) do { \
static struct _ddebug descriptor \
__used \
__attribute__((section("__verbose"), aligned(8))) = \
{ KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
_DPRINTK_FLAGS_DEFAULT }; \
if (unlikely(descriptor.enabled)) \
__dynamic_netdev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__);\
} while (0)

#else

static inline int ddebug_remove_module(const char *mod)
Expand Down
6 changes: 4 additions & 2 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -2617,6 +2617,9 @@ static inline const char *netdev_name(const struct net_device *dev)
return dev->name;
}

extern int __netdev_printk(const char *level, const struct net_device *dev,
struct va_format *vaf);

extern int netdev_printk(const char *level, const struct net_device *dev,
const char *format, ...)
__attribute__ ((format (printf, 3, 4)));
Expand Down Expand Up @@ -2644,8 +2647,7 @@ extern int netdev_info(const struct net_device *dev, const char *format, ...)
#elif defined(CONFIG_DYNAMIC_DEBUG)
#define netdev_dbg(__dev, format, args...) \
do { \
dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \
netdev_name(__dev), ##args); \
dynamic_netdev_dbg(__dev, format, ##args); \
} while (0)
#else
#define netdev_dbg(__dev, format, args...) \
Expand Down
25 changes: 25 additions & 0 deletions trunk/lib/dynamic_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <linux/hardirq.h>
#include <linux/sched.h>
#include <linux/device.h>
#include <linux/netdevice.h>

extern struct _ddebug __start___verbose[];
extern struct _ddebug __stop___verbose[];
Expand Down Expand Up @@ -503,6 +504,30 @@ int __dynamic_dev_dbg(struct _ddebug *descriptor,
}
EXPORT_SYMBOL(__dynamic_dev_dbg);

int __dynamic_netdev_dbg(struct _ddebug *descriptor,
const struct net_device *dev, const char *fmt, ...)
{
struct va_format vaf;
va_list args;
int res;

BUG_ON(!descriptor);
BUG_ON(!fmt);

va_start(args, fmt);

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

res = dynamic_emit_prefix(descriptor);
res += __netdev_printk(KERN_CONT, dev, &vaf);

va_end(args);

return res;
}
EXPORT_SYMBOL(__dynamic_netdev_dbg);

static __initdata char ddebug_setup_string[1024];
static __init int ddebug_setup_query(char *str)
{
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -6290,7 +6290,7 @@ const char *netdev_drivername(const struct net_device *dev)
return empty;
}

static int __netdev_printk(const char *level, const struct net_device *dev,
int __netdev_printk(const char *level, const struct net_device *dev,
struct va_format *vaf)
{
int r;
Expand All @@ -6305,6 +6305,7 @@ static int __netdev_printk(const char *level, const struct net_device *dev,

return r;
}
EXPORT_SYMBOL(__netdev_printk);

int netdev_printk(const char *level, const struct net_device *dev,
const char *format, ...)
Expand Down

0 comments on commit caf63ed

Please sign in to comment.