Skip to content

Commit e27f178

Browse files
ffainellidavem330
authored andcommitted
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. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 76ccf52 commit e27f178

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

drivers/net/phy/phy_device.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,9 +1107,8 @@ void phy_attached_info(struct phy_device *phydev)
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, ...)
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, ...)
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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
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,
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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,8 @@ static inline void phy_unlock_mdio_bus(struct phy_device *phydev)
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 */

0 commit comments

Comments
 (0)