netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: don't duplicate driver name in phy_attached_print
@ 2020-11-15 15:03 Heiner Kallweit
  2020-11-17  2:53 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2020-11-15 15:03 UTC (permalink / raw)
  To: Andrew Lunn, Russell King - ARM Linux, Jakub Kicinski, David Miller
  Cc: netdev

Currently we print the driver name twice in phy_attached_print():
- phy_dev_info() prints it as part of the device info
- and we print it as part of the info string

This is a little bit ugly, it makes the info harder to read,
especially if the driver name is a little bit longer.
Therefore omit the driver name (if set) in the info string.

Example from r8169 that uses phylib:

old: Generic FE-GE Realtek PHY r8169-300:00: attached PHY driver \
   [Generic FE-GE Realtek PHY] (mii_bus:phy_addr=r8169-300:00, irq=IGNORE)
new: Generic FE-GE Realtek PHY r8169-300:00: attached PHY driver \
   (mii_bus:phy_addr=r8169-300:00, irq=IGNORE)

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy_device.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index e13a46c25..04652603a 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1156,7 +1156,7 @@ void phy_attached_info(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(phy_attached_info);
 
-#define ATTACHED_FMT "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%s)"
+#define ATTACHED_FMT "attached PHY driver %s(mii_bus:phy_addr=%s, irq=%s)"
 char *phy_attached_info_irq(struct phy_device *phydev)
 {
 	char *irq_str;
@@ -1181,19 +1181,17 @@ EXPORT_SYMBOL(phy_attached_info_irq);
 
 void phy_attached_print(struct phy_device *phydev, const char *fmt, ...)
 {
-	const char *drv_name = phydev->drv ? phydev->drv->name : "unbound";
+	const char *unbound = phydev->drv ? "" : "[unbound] ";
 	char *irq_str = phy_attached_info_irq(phydev);
 
 	if (!fmt) {
-		phydev_info(phydev, ATTACHED_FMT "\n",
-			 drv_name, phydev_name(phydev),
-			 irq_str);
+		phydev_info(phydev, ATTACHED_FMT "\n", unbound,
+			    phydev_name(phydev), irq_str);
 	} else {
 		va_list ap;
 
-		phydev_info(phydev, ATTACHED_FMT,
-			 drv_name, phydev_name(phydev),
-			 irq_str);
+		phydev_info(phydev, ATTACHED_FMT, unbound,
+			    phydev_name(phydev), irq_str);
 
 		va_start(ap, fmt);
 		vprintk(fmt, ap);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: don't duplicate driver name in phy_attached_print
  2020-11-15 15:03 [PATCH net-next] net: phy: don't duplicate driver name in phy_attached_print Heiner Kallweit
@ 2020-11-17  2:53 ` Andrew Lunn
  2020-11-17 18:35   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2020-11-17  2:53 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Russell King - ARM Linux, Jakub Kicinski, David Miller, netdev

On Sun, Nov 15, 2020 at 04:03:10PM +0100, Heiner Kallweit wrote:
> Currently we print the driver name twice in phy_attached_print():
> - phy_dev_info() prints it as part of the device info
> - and we print it as part of the info string
> 
> This is a little bit ugly, it makes the info harder to read,
> especially if the driver name is a little bit longer.
> Therefore omit the driver name (if set) in the info string.
> 
> Example from r8169 that uses phylib:
> 
> old: Generic FE-GE Realtek PHY r8169-300:00: attached PHY driver \
>    [Generic FE-GE Realtek PHY] (mii_bus:phy_addr=r8169-300:00, irq=IGNORE)
> new: Generic FE-GE Realtek PHY r8169-300:00: attached PHY driver \
>    (mii_bus:phy_addr=r8169-300:00, irq=IGNORE)
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: don't duplicate driver name in phy_attached_print
  2020-11-17  2:53 ` Andrew Lunn
@ 2020-11-17 18:35   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-11-17 18:35 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Heiner Kallweit, Russell King - ARM Linux, David Miller, netdev

On Tue, 17 Nov 2020 03:53:54 +0100 Andrew Lunn wrote:
> On Sun, Nov 15, 2020 at 04:03:10PM +0100, Heiner Kallweit wrote:
> > Currently we print the driver name twice in phy_attached_print():
> > - phy_dev_info() prints it as part of the device info
> > - and we print it as part of the info string
> > 
> > This is a little bit ugly, it makes the info harder to read,
> > especially if the driver name is a little bit longer.
> > Therefore omit the driver name (if set) in the info string.
> > 
> > Example from r8169 that uses phylib:
> > 
> > old: Generic FE-GE Realtek PHY r8169-300:00: attached PHY driver \
> >    [Generic FE-GE Realtek PHY] (mii_bus:phy_addr=r8169-300:00, irq=IGNORE)
> > new: Generic FE-GE Realtek PHY r8169-300:00: attached PHY driver \
> >    (mii_bus:phy_addr=r8169-300:00, irq=IGNORE)
> > 
> > Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>  
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Applied, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-17 18:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-15 15:03 [PATCH net-next] net: phy: don't duplicate driver name in phy_attached_print Heiner Kallweit
2020-11-17  2:53 ` Andrew Lunn
2020-11-17 18:35   ` Jakub Kicinski

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).