From: Florian Fainelli Date: Wed, 27 Aug 2014 18:44:33 +0000 (-0700) Subject: net: phy: properly report internal PHYs through sysfs X-Git-Tag: v3.18-rc1~52^2~200 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=574746ddeca959cba407d6b556f96cb580fca8af;p=~emulex%2Finfiniband.git net: phy: properly report internal PHYs through sysfs 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 4eaadcfcb0f..50051f271b1 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);