diff options
| author | Don Fry <brazilnut@us.ibm.com> | 2004-03-12 03:23:52 -0500 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@redhat.com> | 2004-03-12 03:23:52 -0500 |
| commit | 6bdf757d649024b8f9549c773e13e78ae74dcf67 (patch) | |
| tree | 8b2816b6d13f397a2dd9243b75e1c93273accb8e /include/linux | |
| parent | 17638114c55ffb30346c332dc6a28b34913cf791 (diff) | |
[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.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/netdevice.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index fd5ae72d8ae9..eca216f21e9d 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -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) |
