]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: sfp: provide sfp_get_module_caps()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 16 Sep 2025 21:46:51 +0000 (22:46 +0100)
committerJakub Kicinski <kuba@kernel.org>
Mon, 22 Sep 2025 23:05:14 +0000 (16:05 -0700)
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>
drivers/net/phy/sfp-bus.c
include/linux/sfp.h

index b77190494b0458211caeff21c8e52217c067e4d8..e8cf411396faeb334d32eca27ff4dcf189295c92 100644 (file)
@@ -33,6 +33,12 @@ struct sfp_bus {
        struct sfp_module_caps caps;
 };
 
+const struct sfp_module_caps *sfp_get_module_caps(struct sfp_bus *bus)
+{
+       return &bus->caps;
+}
+EXPORT_SYMBOL_GPL(sfp_get_module_caps);
+
 /**
  * sfp_parse_port() - Parse the EEPROM base ID, setting the port type
  * @bus: a pointer to the &struct sfp_bus structure for the sfp module
index 5fb59cf49882c3d9b0ab1679d79f551b7621cead..9f29fcad52bee510eaf6888af0138876458999a4 100644 (file)
@@ -576,6 +576,7 @@ struct sfp_upstream_ops {
 };
 
 #if IS_ENABLED(CONFIG_SFP)
+const struct sfp_module_caps *sfp_get_module_caps(struct sfp_bus *bus);
 int sfp_parse_port(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
                   unsigned long *support);
 bool sfp_may_have_phy(struct sfp_bus *bus, const struct sfp_eeprom_id *id);
@@ -600,6 +601,12 @@ int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream,
 void sfp_bus_del_upstream(struct sfp_bus *bus);
 const char *sfp_get_name(struct sfp_bus *bus);
 #else
+static inline const struct sfp_module_caps *
+sfp_get_module_caps(struct sfp_bus *bus)
+{
+       return NULL;
+}
+
 static inline int sfp_parse_port(struct sfp_bus *bus,
                                 const struct sfp_eeprom_id *id,
                                 unsigned long *support)