diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2024-05-24 22:04:13 +0100 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2025-04-04 14:39:52 +0100 |
commit | 8926cccd5024f42be8b77c8813e202870c7fd841 (patch) | |
tree | b26306cdd80eb9be38d22554ae877fb6bc541c06 | |
parent | 070be2066dd17cc6872b9eee4219a2418cfdb7ce (diff) |
net: dsa: remove obsolete phylink dsa_switch operations
No driver now uses the DSA switch phylink members, so we can now remove
the shim functions and method pointers. Arrange to print an error
message and fail registration if a DSA driver does not provide the
phylink MAC operations structure.
Signed-off-by: Russell King (oracle) <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | net/dsa/dsa.c | 5 | ||||
-rw-r--r-- | net/dsa/port.c | 34 |
2 files changed, 6 insertions, 33 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index e827775baf2e..4fc016ec1661 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -1505,6 +1505,11 @@ static int dsa_switch_probe(struct dsa_switch *ds) if (!ds->num_ports) return -EINVAL; + if (!ds->phylink_mac_ops) { + dev_err(ds->dev, "DSA switch driver does not provide phylink MAC operations"); + return -EINVAL; + } + if (np) { err = dsa_switch_parse_of(ds, np); if (err) diff --git a/net/dsa/port.c b/net/dsa/port.c index 5c9d1798e830..56ebaa4cd76a 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -1591,36 +1591,8 @@ bool dsa_supports_eee(struct dsa_switch *ds, int port) } EXPORT_SYMBOL_GPL(dsa_supports_eee); -static void dsa_port_phylink_mac_config(struct phylink_config *config, - unsigned int mode, - const struct phylink_link_state *state) -{ -} - -static void dsa_port_phylink_mac_link_down(struct phylink_config *config, - unsigned int mode, - phy_interface_t interface) -{ -} - -static void dsa_port_phylink_mac_link_up(struct phylink_config *config, - struct phy_device *phydev, - unsigned int mode, - phy_interface_t interface, - int speed, int duplex, - bool tx_pause, bool rx_pause) -{ -} - -static const struct phylink_mac_ops dsa_port_phylink_mac_ops = { - .mac_config = dsa_port_phylink_mac_config, - .mac_link_down = dsa_port_phylink_mac_link_down, - .mac_link_up = dsa_port_phylink_mac_link_up, -}; - int dsa_port_phylink_create(struct dsa_port *dp) { - const struct phylink_mac_ops *mac_ops; struct dsa_switch *ds = dp->ds; phy_interface_t mode; struct phylink *pl; @@ -1644,12 +1616,8 @@ int dsa_port_phylink_create(struct dsa_port *dp) } } - mac_ops = &dsa_port_phylink_mac_ops; - if (ds->phylink_mac_ops) - mac_ops = ds->phylink_mac_ops; - pl = phylink_create(&dp->pl_config, of_fwnode_handle(dp->dn), mode, - mac_ops); + ds->phylink_mac_ops); if (IS_ERR(pl)) { pr_err("error creating PHYLINK: %ld\n", PTR_ERR(pl)); return PTR_ERR(pl); |