net: phy: expose PHY device interface mode

Expose the PHY device interface mode through sysfs since this is an
useful piece of information for knowing how the attached networking
device will have configured its transmit/receive path.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Florian Fainelli
2014-02-11 17:27:40 -08:00
committed by David S. Miller
parent 8a2fe56e88
commit 3d055d8d1c
2 changed files with 20 additions and 0 deletions

View File

@@ -432,8 +432,18 @@ phy_id_show(struct device *dev, struct device_attribute *attr, char *buf)
}
static DEVICE_ATTR_RO(phy_id);
static ssize_t
phy_interface_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct phy_device *phydev = to_phy_device(dev);
return sprintf(buf, "%s\n", phy_modes(phydev->interface));
}
static DEVICE_ATTR_RO(phy_interface);
static struct attribute *mdio_dev_attrs[] = {
&dev_attr_phy_id.attr,
&dev_attr_phy_interface.attr,
NULL,
};
ATTRIBUTE_GROUPS(mdio_dev);