net: stmmac: Delete dead code for MDIO registration
Subsystems (5)
PATCH v3 1/1 net: stmmac: Delete dead code for MDIO registration
This code is no longer used, the logging function was changed by commit fbca164776e4 ("net: stmmac: Use the right logging functi"). It was previously showing information about the type if the IRQ, if it's polled, ignored or a normal interrupt. As we don't want information loss, I have moved this code to phy_attached_print().
---
Hello,
This is the continuity of "[PATCH v2 0/2] net: stmmac: phy logging fixes", see https://lkml.org/lkml/2017/8/21/288
Changes in v3:
- Removed patch 2/2: "net: phy: Don't use drv when it is NULL in phy_attached_print", fixed upstream by fcd03e362b1c
("net: phy: Deal with unbound PHY driver in phy_attached_print()")
- Moved this code to phy_attached_print(), so we have more informations about the IRQ (poll, ignore or normal irq) and no information are loss.
- Re-worded commit message
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 16 ---------------- drivers/net/phy/phy_device.c | 21 ++++++++++++++++++--- 2 files changed, 18 insertions(+), 19 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +0 -16
@@ -248,9 +248,6 @@ int stmmac_mdio_register(struct net_device *ndev) found =0 ;for (addr =0 ; addr <PHY_MAX_ADDR ; addr++) {struct phy_device *phydev =mdiobus_get_phy (new_bus, addr); -int act =0 ; -char irq_num[4 ]; -char *irq_str;if (!phydev)continue ;
@@ -273,19 +270,6 @@ int stmmac_mdio_register(struct net_device *ndev)if (priv->plat->phy_addr ==-1 ) priv->plat->phy_addr = addr; - act = (priv->plat->phy_addr == addr); -switch (phydev->irq) { -case PHY_POLL : - irq_str ="POLL" ; -break ; -case PHY_IGNORE_INTERRUPT : - irq_str ="IGNORE" ; -break ; -default : -sprintf (irq_num,"%d" , phydev->irq); - irq_str = irq_num; -break ; - }phy_attached_info (phydev); found =1 ; }
drivers/net/phy/phy_device.c +18 -3
@@ -874,21 +874,36 @@ 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=%d)" +#define ATTACHED_FMT "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%s)"void phy_attached_print (struct phy_device *phydev,const char *fmt, ...) {const char *drv_name = phydev->drv ? phydev->drv->name :"unbound" ; +char *irq_str; +char irq_num[4 ]; + +switch (phydev->irq) { +case PHY_POLL : + irq_str ="POLL" ; +break ; +case PHY_IGNORE_INTERRUPT : + irq_str ="IGNORE" ; +break ; +default : +snprintf (irq_num,sizeof (irq_str),"%d" , phydev->irq); + irq_str = irq_num; +break ; + }if (!fmt) {dev_info (&phydev->mdio.dev,ATTACHED_FMT "\n" , drv_name,phydev_name (phydev), - phydev->irq); + irq_str); }else {va_list ap;dev_info (&phydev->mdio.dev,ATTACHED_FMT , drv_name,phydev_name (phydev), - phydev->irq); + irq_str);va_start (ap, fmt);vprintk (fmt, ap);
Signature · 1 line
2.11.0
Quoted 7 lines · Romain Perier
This code is no longer used, the logging function was changed by commit
fbca164776e4("net: stmmac: Use the right logging functi"). It was previously showing information about the type if the IRQ, if it's polled, ignored or a normal interrupt. As we don't want information loss, I have moved this code tophy_attached_print().Fixes fbca164776e4 ("net: stmmac: Use the right logging functi")
For future submissions, do not truncate the commit subject that you are referencing.
Quoted 1 line
Signed-off-by Romain Perier <[email protected]>
Since this is a fix you should indicate in the patch subject that this is targeting David's "net" tree, see
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/netdev-FAQ.txt#n85
drivers/net/phy/phy_device.c void phy_attached_info(struct phy_device *phydev) · line 892
Quoted 13 lines
drivers/net/phy/phy_device.c +12
-0const char *drv_name = phydev->drv ? phydev->drv->name :"unbound" ; +char *irq_str; +char irq_num[4 ]; + +switch (phydev->irq) { +case PHY_POLL : + irq_str ="POLL" ; +break ; +case PHY_IGNORE_INTERRUPT : + irq_str ="IGNORE" ; +break ; +default : +snprintf (irq_num,sizeof (irq_str),"%d" , phydev->irq);
sizeof(irq_str) = 4 or 8 depending on the architecture because it's a pointer, did not you mean sizeof(irq_num) here instead?
Quoted 20 lines
drivers/net/phy/phy_device.c +5
-2+ irq_str = irq_num; +break ; + }if (!fmt) {dev_info (&phydev->mdio.dev,ATTACHED_FMT "\n" , drv_name,phydev_name (phydev), - phydev->irq); + irq_str); }else {va_list ap;dev_info (&phydev->mdio.dev,ATTACHED_FMT , drv_name,phydev_name (phydev), - phydev->irq); + irq_str);va_start (ap, fmt);vprintk (fmt, ap);
Signature · 1 line
Florian
Hello,
Quoted 10 lines · Florian Fainelli
Quoted 7 lines · Romain Perier
This code is no longer used, the logging function was changed by commit
fbca164776e4("net: stmmac: Use the right logging functi"). It was previously showing information about the type if the IRQ, if it's polled, ignored or a normal interrupt. As we don't want information loss, I have moved this code tophy_attached_print().Fixes fbca164776e4 ("net: stmmac: Use the right logging functi")For future submissions, do not truncate the commit subject that you are referencing.
Even if it exceeds 72 characters ?
Quoted 5 lines
Quoted 2 lines
Signed-off-by Romain Perier <[email protected]>Since this is a fix you should indicate in the patch subject that this is targeting David's "net" tree, see
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/netdev-FAQ.txt#n85
Ok, will do
Quoted 17 lines
Quoted 5 lines
drivers/net/phy/phy_device.c +2
-0const char *drv_name = phydev->drv ? phydev->drv->name :"unbound" ; +char *irq_str; +char irq_num[4 ];drivers/net/phy/phy_device.c void phy_attached_info(struct phy_device *phydev) · line 892
Quoted 10 lines
drivers/net/phy/phy_device.c +10
-0+ +switch (phydev->irq) { +case PHY_POLL : + irq_str ="POLL" ; +break ; +case PHY_IGNORE_INTERRUPT : + irq_str ="IGNORE" ; +break ; +default : +snprintf (irq_num,sizeof (irq_str),"%d" , phydev->irq);
sizeof(irq_str)= 4 or 8 depending on the architecture because it's a pointer, did not you meansizeof(irq_num)here instead?
Ah good catch, yeah that's a stupid error
Regards,
Romain
David Miller
maintainerFrom: Romain Perier <[email protected]>
Date: Thu, 24 Aug 2017 08:49:18 +0200
Quoted 8 lines · Florian Fainelli
Quoted 7 lines · Romain Perier
Quoted 6 lines
This code is no longer used, the logging function was changed by commit
fbca164776e4("net: stmmac: Use the right logging functi"). It was previously showing information about the type if the IRQ, if it's polled, ignored or a normal interrupt. As we don't want information loss, I have moved this code tophy_attached_print().
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Fixes fbca164776e4 ("net: stmmac: Use the right logging functi")For future submissions, do not truncate the commit subject that you are referencing.
Even if it exceeds 72 characters ?
Yes, always.