Commit 6bdf757d authored by Don Fry's avatar Don Fry Committed by Jeff Garzik

[PATCH] netdevice.h add netif_msg_init helper

This patch adds a helper function to initialize the debug bit mask
for use with netif_msg_*.  When the debug_value is out of range
it returns the default_msg_enable_bits.  Tested IA32.
parent 17638114
......@@ -774,6 +774,17 @@ enum {
#define netif_msg_hw(p) ((p)->msg_enable & NETIF_MSG_HW)
#define netif_msg_wol(p) ((p)->msg_enable & NETIF_MSG_WOL)
static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
{
/* use default */
if (debug_value < 0 || debug_value >= (sizeof(u32) * 8))
return default_msg_enable_bits;
if (debug_value == 0) /* no output */
return 0;
/* set low N bits */
return (1 << debug_value) - 1;
}
/* Schedule rx intr now? */
static inline int netif_rx_schedule_prep(struct net_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment