mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:02:20 +00:00
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>
This commit is contained in:
parent
034fcc2103
commit
dedd702a35
@ -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);
|
||||
|
@ -570,6 +570,7 @@ struct sfp_bus *sfp_bus_find_fwnode(const struct fwnode_handle *fwnode);
|
||||
int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream,
|
||||
const struct sfp_upstream_ops *ops);
|
||||
void sfp_bus_del_upstream(struct sfp_bus *bus);
|
||||
const char *sfp_get_name(struct sfp_bus *bus);
|
||||
#else
|
||||
static inline int sfp_parse_port(struct sfp_bus *bus,
|
||||
const struct sfp_eeprom_id *id,
|
||||
@ -648,6 +649,11 @@ static inline int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream,
|
||||
static inline void sfp_bus_del_upstream(struct sfp_bus *bus)
|
||||
{
|
||||
}
|
||||
|
||||
static inline const char *sfp_get_name(struct sfp_bus *bus)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user