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.
Unified · Split
| @@ -1107,9 +1107,8 @@ void phy_attached_info(struct phy_device *phydev) · 1106 unmodified lines | ||
| 1107 | 1107 | EXPORT_SYMBOL(phy_attached_info); |
| 1108 | 1108 | |
| 1109 | 1109 | #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) | |
| 1111 | 1111 | { |
| 1112 | − const char *drv_name = phydev->drv ? phydev->drv->name : "unbound"; | |
| 1113 | 1112 | char *irq_str; |
| 1114 | 1113 | char irq_num[8]; |
| 1115 | 1114 | |
| @@ -1126,6 +1125,14 @@ void phy_attached_print(struct phy_device *phydev, const char *fmt, ...) · 10 unmodified lines | ||
| 1126 | 1125 | break; |
| 1127 | 1126 | } |
| 1128 | 1127 | |
| 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); | |
| 1129 | 1136 | |
| 1130 | 1137 | if (!fmt) { |
| 1131 | 1138 | phydev_info(phydev, ATTACHED_FMT "\n", |
| @@ -1142,6 +1149,7 @@ void phy_attached_print(struct phy_device *phydev, const char *fmt, ...) · 10 unmodified lines | ||
| 1142 | 1149 | vprintk(fmt, ap); |
| 1143 | 1150 | va_end(ap); |
| 1144 | 1151 | } |
| 1152 | + kfree(irq_str); | |
| 1145 | 1153 | } |
| 1146 | 1154 | EXPORT_SYMBOL(phy_attached_print); |
| 1147 | 1155 | |
| @@ -726,6 +726,7 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, · 725 unmodified lines | ||
| 726 | 726 | { |
| 727 | 727 | struct phylink_link_state config; |
| 728 | 728 | __ETHTOOL_DECLARE_LINK_MODE_MASK(supported); |
| 729 | + char *irq_str; | |
| 729 | 730 | int ret; |
| 730 | 731 | |
| 731 | 732 | /* |
| @@ -761,9 +762,11 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, · 29 unmodified lines | ||
| 761 | 762 | phy->phylink = pl; |
| 762 | 763 | phy->phy_link_change = phylink_phy_change; |
| 763 | 764 | |
| 765 | + irq_str = phy_attached_info_irq(phy); | |
| 764 | 766 | 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); | |
| 767 | 770 | |
| 768 | 771 | mutex_lock(&phy->lock); |
| 769 | 772 | mutex_lock(&pl->state_mutex); |
| @@ -1131,6 +1131,8 @@ static inline void phy_unlock_mdio_bus(struct phy_device *phydev) · 1130 unmodified lines | ||
| 1131 | 1131 | |
| 1132 | 1132 | void phy_attached_print(struct phy_device *phydev, const char *fmt, ...) |
| 1133 | 1133 | __printf(2, 3); |
| 1134 | +char *phy_attached_info_irq(struct phy_device *phydev) | |
| 1135 | + __malloc; | |
| 1134 | 1136 | void phy_attached_info(struct phy_device *phydev); |
| 1135 | 1137 | |
| 1136 | 1138 | /* Clause 22 PHY */ |