* [PATCH net] net: phylink: Fix phylink_dbg() macro
@ 2019-10-31 22:42 Florian Fainelli
2019-11-01 22:07 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2019-10-31 22:42 UTC (permalink / raw)
To: netdev
Cc: ioana.ciornei, olteanv, Florian Fainelli, Russell King,
Andrew Lunn, Heiner Kallweit, David S. Miller, open list
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: 17091180b152 ("net: phylink: Add phylink_{printk, err, warn, info, dbg} macros")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/phy/phylink.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 20e2ebe458f2..a578f7ebf715 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -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
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: phylink: Fix phylink_dbg() macro
2019-10-31 22:42 [PATCH net] net: phylink: Fix phylink_dbg() macro Florian Fainelli
@ 2019-11-01 22:07 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-11-01 22:07 UTC (permalink / raw)
To: f.fainelli
Cc: netdev, ioana.ciornei, olteanv, linux, andrew, hkallweit1, linux-kernel
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Thu, 31 Oct 2019 15:42:26 -0700
> 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: 17091180b152 ("net: phylink: Add phylink_{printk, err, warn, info, dbg} macros")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-01 22:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-31 22:42 [PATCH net] net: phylink: Fix phylink_dbg() macro Florian Fainelli
2019-11-01 22:07 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).