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-09-29 10:14:45 +0100 |
commit | 8e2b4782cf6b1c7ff8cd9eb573004dd93c3e23a9 (patch) | |
tree | a2b3623514aeed41cae4da2c007f91ef93fe9f1f | |
parent | b9177c91a383b020151cb5e27c0806379addece5 (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 5b01a0e43ebe..534336a60613 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -1544,6 +1544,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 082573ae6864..cd969f27b12a 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -1587,36 +1587,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; @@ -1640,12 +1612,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); |