History

net: phy: Added IRQ print to phylink_bringup_phy()

The information about the PHY attached to the PHYLINK instance is useful but is missing the IRQ prints that phy_attached_info() adds. phy_attached_info() is a bit long and it would not be possible to use phylink_info() anyway.

Florian Fainelli committed 6 years ago

Commit e27f1781 parent 76ccf523 files · +17 −4Browse files

Unified · Split

3 files
  1. drivers/net/phy/phy_device.c +10 −2
  2. drivers/net/phy/phylink.c +5 −2
  3. include/linux/phy.h +2 −0
drivers/net/phy/phy_device.c+10−2
@@ -1107,9 +1107,8 @@ void phy_attached_info(struct phy_device *phydev) · 1106 unmodified lines
11071107 EXPORT_SYMBOL(phy_attached_info);
11081108
11091109 #define ATTACHED_FMT "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%s)"
1110−void phy_attached_print(struct phy_device *phydev, const char *fmt, ...)
1110+char *phy_attached_info_irq(struct phy_device *phydev)
11111111 {
1112− const char *drv_name = phydev->drv ? phydev->drv->name : "unbound";
11131112 char *irq_str;
11141113 char irq_num[8];
11151114
@@ -1126,6 +1125,14 @@ void phy_attached_print(struct phy_device *phydev, const char *fmt, ...) · 10 unmodified lines
11261125 break;
11271126 }
11281127
1128+ return kasprintf(GFP_KERNEL, "%s", irq_str);
1129+}
1130+EXPORT_SYMBOL(phy_attached_info_irq);
1131+
1132+void phy_attached_print(struct phy_device *phydev, const char *fmt, ...)
1133+{
1134+ const char *drv_name = phydev->drv ? phydev->drv->name : "unbound";
1135+ char *irq_str = phy_attached_info_irq(phydev);
11291136
11301137 if (!fmt) {
11311138 phydev_info(phydev, ATTACHED_FMT "\n",
@@ -1142,6 +1149,7 @@ void phy_attached_print(struct phy_device *phydev, const char *fmt, ...) · 10 unmodified lines
11421149 vprintk(fmt, ap);
11431150 va_end(ap);
11441151 }
1152+ kfree(irq_str);
11451153 }
11461154 EXPORT_SYMBOL(phy_attached_print);
11471155
drivers/net/phy/phylink.c+5−2
@@ -726,6 +726,7 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, · 725 unmodified lines
726726 {
727727 struct phylink_link_state config;
728728 __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
729+ char *irq_str;
729730 int ret;
730731
731732 /*
@@ -761,9 +762,11 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, · 29 unmodified lines
761762 phy->phylink = pl;
762763 phy->phy_link_change = phylink_phy_change;
763764
765+ irq_str = phy_attached_info_irq(phy);
764766 phylink_info(pl,
765− "PHY [%s] driver [%s]\n", dev_name(&phy->mdio.dev),
766− phy->drv->name);
767+ "PHY [%s] driver [%s] (irq=%s)\n",
768+ dev_name(&phy->mdio.dev), phy->drv->name, irq_str);
769+ kfree(irq_str);
767770
768771 mutex_lock(&phy->lock);
769772 mutex_lock(&pl->state_mutex);
include/linux/phy.h+2−0
@@ -1131,6 +1131,8 @@ static inline void phy_unlock_mdio_bus(struct phy_device *phydev) · 1130 unmodified lines
11311131
11321132 void phy_attached_print(struct phy_device *phydev, const char *fmt, ...)
11331133 __printf(2, 3);
1134+char *phy_attached_info_irq(struct phy_device *phydev)
1135+ __malloc;
11341136 void phy_attached_info(struct phy_device *phydev);
11351137
11361138 /* Clause 22 PHY */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t