Skip to content

Commit

Permalink
smc91x: improve definition of debug macros
Browse files Browse the repository at this point in the history
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: Joe Perches <joe@perches.com>
Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Zi Shen Lim authored and David S. Miller committed Apr 24, 2014
1 parent 83d5b7e commit a450a68
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions drivers/net/ethernet/smsc/smc91x.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,19 @@ MODULE_ALIAS("platform:smc91x");
*/
#define MII_DELAY 1

#if SMC_DEBUG > 0
#define DBG(n, dev, args...) \
do { \
if (SMC_DEBUG >= (n)) \
netdev_dbg(dev, args); \
#define DBG(n, dev, fmt, ...) \
do { \
if (SMC_DEBUG >= (n)) \
netdev_dbg(dev, fmt, ##__VA_ARGS__); \
} while (0)

#define PRINTK(dev, args...) netdev_info(dev, args)
#else
#define DBG(n, dev, args...) do { } while (0)
#define PRINTK(dev, args...) netdev_dbg(dev, args)
#endif
#define PRINTK(dev, fmt, ...) \
do { \
if (SMC_DEBUG > 0) \
netdev_info(dev, fmt, ##__VA_ARGS__); \
else \
netdev_dbg(dev, fmt, ##__VA_ARGS__); \
} while (0)

#if SMC_DEBUG > 3
static void PRINT_PKT(u_char *buf, int length)
Expand Down Expand Up @@ -191,7 +192,7 @@ static void PRINT_PKT(u_char *buf, int length)
pr_cont("\n");
}
#else
#define PRINT_PKT(x...) do { } while (0)
static inline void PRINT_PKT(u_char *buf, int length) { }
#endif


Expand Down

0 comments on commit a450a68

Please sign in to comment.