From: Edward Cree Date: Fri, 27 Jan 2017 15:02:26 +0000 (+0000) Subject: net: implement netif_cond_dbg macro X-Git-Tag: v4.14-rc1~1463^2~301^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f617f27653c4d9f5b2aa43d567ac0405df889944;p=platform%2Fkernel%2Flinux-rpi3.git net: implement netif_cond_dbg macro For reporting things that may or may not be serious, depending on some condition, netif_cond_dbg will check the condition and print the report at either dbg (if the condition is true) or the specified level. Suggested-by: Jon Cooper Signed-off-by: Edward Cree Signed-off-by: David S. Miller --- diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index d63cacb..9511e5a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -4347,6 +4347,15 @@ do { \ }) #endif +/* if @cond then downgrade to debug, else print at @level */ +#define netif_cond_dbg(priv, type, netdev, cond, level, fmt, args...) \ + do { \ + if (cond) \ + netif_dbg(priv, type, netdev, fmt, ##args); \ + else \ + netif_ ## level(priv, type, netdev, fmt, ##args); \ + } while (0) + #if defined(VERBOSE_DEBUG) #define netif_vdbg netif_dbg #else