diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2021-03-11 01:12:43 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-03-11 23:47:27 +0300 |
commit | b0bade515d360800fc701e1a965cf41adcc4ec1b (patch) | |
tree | 992ef4a633b4924b4aafe733dc429b7d1dcee079 /drivers | |
parent | ee47ed08d75e8f16b3cf882061ee19c2ea19dd6c (diff) | |
download | linux-b0bade515d360800fc701e1a965cf41adcc4ec1b.tar.xz |
net: phy: Expose phydev::dev_flags through sysfs
phydev::dev_flags contains a bitmask of configuration bits requested by
the consumer of a PHY device (Ethernet MAC or switch) towards the PHY
driver. Since these flags are often used for requesting LED or other
type of configuration being able to quickly audit them without
instrumenting the kernel is useful.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/phy/phy_device.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index cc38e326405a..a009d1769b08 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -512,10 +512,21 @@ phy_has_fixups_show(struct device *dev, struct device_attribute *attr, } static DEVICE_ATTR_RO(phy_has_fixups); +static ssize_t phy_dev_flags_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct phy_device *phydev = to_phy_device(dev); + + return sprintf(buf, "0x%08x\n", phydev->dev_flags); +} +static DEVICE_ATTR_RO(phy_dev_flags); + static struct attribute *phy_dev_attrs[] = { &dev_attr_phy_id.attr, &dev_attr_phy_interface.attr, &dev_attr_phy_has_fixups.attr, + &dev_attr_phy_dev_flags.attr, NULL, }; ATTRIBUTE_GROUPS(phy_dev); |