diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2014-08-27 14:44:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-29 23:17:53 -0400 |
commit | 574746ddeca959cba407d6b556f96cb580fca8af (patch) | |
tree | e861c480ed7d5114b27f5e73e6fa3950b9ea2f2a | |
parent | 879ece6ecb2107ef1bbc3332cb2fea54c7d3a636 (diff) |
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 <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 8 |
1 files changed, 7 insertions, 1 deletions
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 | |||
553 | phy_interface_show(struct device *dev, struct device_attribute *attr, char *buf) | 553 | phy_interface_show(struct device *dev, struct device_attribute *attr, char *buf) |
554 | { | 554 | { |
555 | struct phy_device *phydev = to_phy_device(dev); | 555 | struct phy_device *phydev = to_phy_device(dev); |
556 | const char *mode = NULL; | ||
556 | 557 | ||
557 | return sprintf(buf, "%s\n", phy_modes(phydev->interface)); | 558 | if (phy_is_internal(phydev)) |
559 | mode = "internal"; | ||
560 | else | ||
561 | mode = phy_modes(phydev->interface); | ||
562 | |||
563 | return sprintf(buf, "%s\n", mode); | ||
558 | } | 564 | } |
559 | static DEVICE_ATTR_RO(phy_interface); | 565 | static DEVICE_ATTR_RO(phy_interface); |
560 | 566 | ||