]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
net: phy: properly report internal PHYs through sysfs
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 27 Aug 2014 18:44:33 +0000 (11:44 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 30 Aug 2014 03:17:53 +0000 (20:17 -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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mdio_bus.c

index 4eaadcfcb0fe5ed2d5bd82a4632989916ade90e2..50051f271b10e8c02f34fae073f8d48ee15b8a97 100644 (file)
@@ -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);