Message ID | 1409165073-26983-1-git-send-email-f.fainelli@gmail.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Florian Fainelli <f.fainelli@gmail.com> Date: Wed, 27 Aug 2014 11:44:33 -0700 > Internal PHYs may not have a valid PHY interface defined, which will > show up in sysfs as "". Add an explicit check of internal PHYs to report > their interface correctly. > > Fixes: 3d055d8d1c24 ("net: phy: expose PHY device interface mode") > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Applied, thanks Florian. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 4eaadcfcb0fe..50051f271b10 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -553,8 +553,14 @@ static ssize_t phy_interface_show(struct device *dev, struct device_attribute *attr, char *buf) { struct phy_device *phydev = to_phy_device(dev); + const char *mode = NULL; - return sprintf(buf, "%s\n", phy_modes(phydev->interface)); + if (phy_is_internal(phydev)) + mode = "internal"; + else + mode = phy_modes(phydev->interface); + + return sprintf(buf, "%s\n", mode); } static DEVICE_ATTR_RO(phy_interface);
Internal PHYs may not have a valid PHY interface defined, which will show up in sysfs as "". Add an explicit check of internal PHYs to report their interface correctly. Fixes: 3d055d8d1c24 ("net: phy: expose PHY device interface mode") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- drivers/net/phy/mdio_bus.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)