Skip to content

Commit

Permalink
net: phylink: Fix phylink_dbg() macro
Browse files Browse the repository at this point in the history
The phylink_dbg() macro does not follow dynamic debug or defined(DEBUG)
and as a result, it spams the kernel log since a PR_DEBUG level is
currently used. Fix it to be defined appropriately whether
CONFIG_DYNAMIC_DEBUG or defined(DEBUG) are set.

Fixes: 1709118 ("net: phylink: Add phylink_{printk, err, warn, info, dbg} macros")
Signed-off-by: Florian Fainelli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ffainelli authored and davem330 committed Nov 1, 2019
1 parent 9cfeeb5 commit 9d68db5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/net/phy/phylink.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,24 @@ struct phylink {
phylink_printk(KERN_WARNING, pl, fmt, ##__VA_ARGS__)
#define phylink_info(pl, fmt, ...) \
phylink_printk(KERN_INFO, pl, fmt, ##__VA_ARGS__)
#if defined(CONFIG_DYNAMIC_DEBUG)
#define phylink_dbg(pl, fmt, ...) \
do { \
if ((pl)->config->type == PHYLINK_NETDEV) \
netdev_dbg((pl)->netdev, fmt, ##__VA_ARGS__); \
else if ((pl)->config->type == PHYLINK_DEV) \
dev_dbg((pl)->dev, fmt, ##__VA_ARGS__); \
} while (0)
#elif defined(DEBUG)
#define phylink_dbg(pl, fmt, ...) \
phylink_printk(KERN_DEBUG, pl, fmt, ##__VA_ARGS__)
#else
#define phylink_dbg(pl, fmt, ...) \
({ \
if (0) \
phylink_printk(KERN_DEBUG, pl, fmt, ##__VA_ARGS__); \
})
#endif

/**
* phylink_set_port_modes() - set the port type modes in the ethtool mask
Expand Down

0 comments on commit 9d68db5

Please sign in to comment.