Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: sfp: provide sfp_get_module_caps()

Provide a function to retrieve the current sfp_module_caps structure
so that upstreams can get the entire module support in one go.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1uydVj-000000061WQ-3q47@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Russell King (Oracle) and committed by
Jakub Kicinski
64fb4a3a a7dc35a9

+13
+6
drivers/net/phy/sfp-bus.c
··· 33 33 struct sfp_module_caps caps; 34 34 }; 35 35 36 + const struct sfp_module_caps *sfp_get_module_caps(struct sfp_bus *bus) 37 + { 38 + return &bus->caps; 39 + } 40 + EXPORT_SYMBOL_GPL(sfp_get_module_caps); 41 + 36 42 /** 37 43 * sfp_parse_port() - Parse the EEPROM base ID, setting the port type 38 44 * @bus: a pointer to the &struct sfp_bus structure for the sfp module
+7
include/linux/sfp.h
··· 576 576 }; 577 577 578 578 #if IS_ENABLED(CONFIG_SFP) 579 + const struct sfp_module_caps *sfp_get_module_caps(struct sfp_bus *bus); 579 580 int sfp_parse_port(struct sfp_bus *bus, const struct sfp_eeprom_id *id, 580 581 unsigned long *support); 581 582 bool sfp_may_have_phy(struct sfp_bus *bus, const struct sfp_eeprom_id *id); ··· 601 600 void sfp_bus_del_upstream(struct sfp_bus *bus); 602 601 const char *sfp_get_name(struct sfp_bus *bus); 603 602 #else 603 + static inline const struct sfp_module_caps * 604 + sfp_get_module_caps(struct sfp_bus *bus) 605 + { 606 + return NULL; 607 + } 608 + 604 609 static inline int sfp_parse_port(struct sfp_bus *bus, 605 610 const struct sfp_eeprom_id *id, 606 611 unsigned long *support)