提交 a450a685 编写于 作者: Z Zi Shen Lim 提交者: David S. Miller

smc91x: improve definition of debug macros

Redefine some macros that were conditioned upon SMC_DEBUG level.

By allowing compiler to verify parameters used by these macros
unconditionally, we can flag compilation failures.

Compiler will still optimize out the unused code path depending on
SMC_DEBUG, so this is a net gain.
Signed-off-by: NJoe Perches <joe@perches.com>
Signed-off-by: NZi Shen Lim <zlim.lnx@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 83d5b7ef
...@@ -147,18 +147,19 @@ MODULE_ALIAS("platform:smc91x"); ...@@ -147,18 +147,19 @@ MODULE_ALIAS("platform:smc91x");
*/ */
#define MII_DELAY 1 #define MII_DELAY 1
#if SMC_DEBUG > 0 #define DBG(n, dev, fmt, ...) \
#define DBG(n, dev, args...) \ do { \
do { \ if (SMC_DEBUG >= (n)) \
if (SMC_DEBUG >= (n)) \ netdev_dbg(dev, fmt, ##__VA_ARGS__); \
netdev_dbg(dev, args); \
} while (0) } while (0)
#define PRINTK(dev, args...) netdev_info(dev, args) #define PRINTK(dev, fmt, ...) \
#else do { \
#define DBG(n, dev, args...) do { } while (0) if (SMC_DEBUG > 0) \
#define PRINTK(dev, args...) netdev_dbg(dev, args) netdev_info(dev, fmt, ##__VA_ARGS__); \
#endif else \
netdev_dbg(dev, fmt, ##__VA_ARGS__); \
} while (0)
#if SMC_DEBUG > 3 #if SMC_DEBUG > 3
static void PRINT_PKT(u_char *buf, int length) static void PRINT_PKT(u_char *buf, int length)
...@@ -191,7 +192,7 @@ static void PRINT_PKT(u_char *buf, int length) ...@@ -191,7 +192,7 @@ static void PRINT_PKT(u_char *buf, int length)
pr_cont("\n"); pr_cont("\n");
} }
#else #else
#define PRINT_PKT(x...) do { } while (0) static inline void PRINT_PKT(u_char *buf, int length) { }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册