net: phylink, dsa: eliminate phylink_fixed_state_cb()
Move the callback into the phylink_config structure, rather than providing a callback to set this up. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Tested-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
6861d6d9cf
commit
5c05c1dbb1
@@ -1590,10 +1590,10 @@ void dsa_port_phylink_mac_change(struct dsa_switch *ds, int port, bool up)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dsa_port_phylink_mac_change);
|
||||
|
||||
static void dsa_slave_phylink_fixed_state(struct net_device *dev,
|
||||
static void dsa_slave_phylink_fixed_state(struct phylink_config *config,
|
||||
struct phylink_link_state *state)
|
||||
{
|
||||
struct dsa_port *dp = dsa_slave_to_port(dev);
|
||||
struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
|
||||
struct dsa_switch *ds = dp->ds;
|
||||
|
||||
/* No need to check that this operation is valid, the callback would
|
||||
@@ -1633,6 +1633,15 @@ static int dsa_slave_phy_setup(struct net_device *slave_dev)
|
||||
dp->pl_config.dev = &slave_dev->dev;
|
||||
dp->pl_config.type = PHYLINK_NETDEV;
|
||||
|
||||
/* The get_fixed_state callback takes precedence over polling the
|
||||
* link GPIO in PHYLINK (see phylink_get_fixed_state). Only set
|
||||
* this if the switch provides such a callback.
|
||||
*/
|
||||
if (ds->ops->phylink_fixed_state) {
|
||||
dp->pl_config.get_fixed_state = dsa_slave_phylink_fixed_state;
|
||||
dp->pl_config.poll_fixed_state = true;
|
||||
}
|
||||
|
||||
dp->pl = phylink_create(&dp->pl_config, of_fwnode_handle(port_dn), mode,
|
||||
&dsa_port_phylink_mac_ops);
|
||||
if (IS_ERR(dp->pl)) {
|
||||
@@ -1641,13 +1650,6 @@ static int dsa_slave_phy_setup(struct net_device *slave_dev)
|
||||
return PTR_ERR(dp->pl);
|
||||
}
|
||||
|
||||
/* Register only if the switch provides such a callback, since this
|
||||
* callback takes precedence over polling the link GPIO in PHYLINK
|
||||
* (see phylink_get_fixed_state).
|
||||
*/
|
||||
if (ds->ops->phylink_fixed_state)
|
||||
phylink_fixed_state_cb(dp->pl, dsa_slave_phylink_fixed_state);
|
||||
|
||||
if (ds->ops->get_phy_flags)
|
||||
phy_flags = ds->ops->get_phy_flags(ds, dp->index);
|
||||
|
||||
|
Reference in New Issue
Block a user