diff options
| author | Russell King <rmk+kernel@armlinux.org.uk> | 2019-11-08 20:39:29 +0300 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2019-11-10 06:35:53 +0300 |
| commit | 727b3668b730634228fc65c336c2a7a080e02885 (patch) | |
| tree | 061758f9f98b33a681b4d564a2035fd1d361e7e4 /drivers/net/phy/phylink.c | |
| parent | 14684b93019a2d2ece0df5acaf921924541b928d (diff) | |
| download | linux-727b3668b730634228fc65c336c2a7a080e02885.tar.xz | |
net: sfp: rework upstream interface
The current upstream interface is an all-or-nothing, which is
sub-optimal for future changes, as it doesn't allow the upstream driver
to prepare for the SFP module becoming available, as it is at boot.
Switch to a find-sfp-bus, add-upstream, del-upstream, put-sfp-bus
interface structure instead, which allows the upstream driver to
prepare for a module being available as soon as add-upstream is called.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phylink.c')
| -rw-r--r-- | drivers/net/phy/phylink.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index f16d9e92a81a..e3fbc8e93317 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -567,7 +567,7 @@ static int phylink_register_sfp(struct phylink *pl, struct sfp_bus *bus; int ret; - bus = sfp_register_upstream_node(fwnode, pl, &sfp_phylink_ops); + bus = sfp_bus_find_fwnode(fwnode); if (IS_ERR(bus)) { ret = PTR_ERR(bus); phylink_err(pl, "unable to attach SFP bus: %d\n", ret); @@ -576,7 +576,10 @@ static int phylink_register_sfp(struct phylink *pl, pl->sfp_bus = bus; - return 0; + ret = sfp_bus_add_upstream(bus, pl, &sfp_phylink_ops); + sfp_bus_put(bus); + + return ret; } /** @@ -670,8 +673,7 @@ EXPORT_SYMBOL_GPL(phylink_create); */ void phylink_destroy(struct phylink *pl) { - if (pl->sfp_bus) - sfp_unregister_upstream(pl->sfp_bus); + sfp_bus_del_upstream(pl->sfp_bus); if (pl->link_gpio) gpiod_put(pl->link_gpio); |
