diff options
author | Nick Bowler <nbowler@elliptictech.com> | 2012-11-07 01:20:34 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-09 16:38:15 -0500 |
commit | 56277f40d73f12d9ffb12b5a6bd7e0ad1f2284b3 (patch) | |
tree | 75e5fe8498c57e8d7863dfd1b0146e5eec04fcb7 /drivers/net/phy | |
parent | b1ead1aea1d7e3c260d896943056453717577525 (diff) |
phylib: mdio: Add sysfs attribute for PHY identifiers.
This adds a phy_id sysfs attribute to MDIO devices, containing the
32-bit PHY identifier reported by the device. This attribute can
be useful when debugging problems related to phy drivers. Other
enumerable buses already have similar attributes.
Signed-off-by: Nick Bowler <nbowler@elliptictech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index c1ef3000ea60..044b5326459f 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -431,10 +431,24 @@ static struct dev_pm_ops mdio_bus_pm_ops = { | |||
431 | 431 | ||
432 | #endif /* CONFIG_PM */ | 432 | #endif /* CONFIG_PM */ |
433 | 433 | ||
434 | static ssize_t | ||
435 | phy_id_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
436 | { | ||
437 | struct phy_device *phydev = to_phy_device(dev); | ||
438 | |||
439 | return sprintf(buf, "0x%.8lx\n", (unsigned long)phydev->phy_id); | ||
440 | } | ||
441 | |||
442 | static struct device_attribute mdio_dev_attrs[] = { | ||
443 | __ATTR_RO(phy_id), | ||
444 | __ATTR_NULL | ||
445 | }; | ||
446 | |||
434 | struct bus_type mdio_bus_type = { | 447 | struct bus_type mdio_bus_type = { |
435 | .name = "mdio_bus", | 448 | .name = "mdio_bus", |
436 | .match = mdio_bus_match, | 449 | .match = mdio_bus_match, |
437 | .pm = MDIO_BUS_PM_OPS, | 450 | .pm = MDIO_BUS_PM_OPS, |
451 | .dev_attrs = mdio_dev_attrs, | ||
438 | }; | 452 | }; |
439 | EXPORT_SYMBOL(mdio_bus_type); | 453 | EXPORT_SYMBOL(mdio_bus_type); |
440 | 454 | ||