diff options
author | Maxime Chevallier <maxime.chevallier@bootlin.com> | 2023-12-21 19:00:37 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-01-01 18:38:56 +0000 |
commit | dedd702a35793ab462fce4c737eeba0badf9718e (patch) | |
tree | 6e8852ae74ba33123aec0b981887511206943053 /drivers/net/phy | |
parent | 034fcc210349b873ece7356905be5c6ca11eef2a (diff) | |
download | lwn-dedd702a35793ab462fce4c737eeba0badf9718e.tar.gz lwn-dedd702a35793ab462fce4c737eeba0badf9718e.zip |
net: sfp: Add helper to return the SFP bus name
Knowing the bus name is helpful when we want to expose the link topology
to userspace, add a helper to return the SFP bus name.
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/sfp-bus.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c index 3a86c41e1235..fb1c102714b5 100644 --- a/drivers/net/phy/sfp-bus.c +++ b/drivers/net/phy/sfp-bus.c @@ -859,3 +859,14 @@ void sfp_unregister_socket(struct sfp_bus *bus) sfp_bus_put(bus); } EXPORT_SYMBOL_GPL(sfp_unregister_socket); + +const char *sfp_get_name(struct sfp_bus *bus) +{ + ASSERT_RTNL(); + + if (bus->sfp_dev) + return dev_name(bus->sfp_dev); + + return NULL; +} +EXPORT_SYMBOL_GPL(sfp_get_name); |