diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2019-09-14 14:21:22 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2019-11-25 12:05:25 +0000 |
commit | e2176c9dbda8754611a2bea746e2b642025c94d1 (patch) | |
tree | e74e787292860fd62a8f59191e0d7c76a7efebb3 /drivers/net/phy/phylink.c | |
parent | 6034505424ef0d844e778fa6dc3a62678b4fcdd4 (diff) |
net: sfp: move fwnode parsing into sfp-bus layer
Rather than parsing the sfp firmware node in phylink, parse it in the
sfp-bus code, so we can re-use this code for PHYs without having to
duplicate the parsing.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers/net/phy/phylink.c')
-rw-r--r-- | drivers/net/phy/phylink.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index dcf8ad1cf373..3ef096f185ef 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -564,26 +564,17 @@ static const struct sfp_upstream_ops sfp_phylink_ops; static int phylink_register_sfp(struct phylink *pl, struct fwnode_handle *fwnode) { - struct fwnode_reference_args ref; + struct sfp_bus *bus; int ret; - if (!fwnode) - return 0; - - ret = fwnode_property_get_reference_args(fwnode, "sfp", NULL, - 0, 0, &ref); - if (ret < 0) { - if (ret == -ENOENT) - return 0; - - phylink_err(pl, "unable to parse \"sfp\" node: %d\n", - ret); + bus = sfp_register_upstream_node(fwnode, pl, &sfp_phylink_ops); + if (IS_ERR(bus)) { + ret = PTR_ERR(bus); + phylink_err(pl, "unable to attach SFP bus: %d\n", ret); return ret; } - pl->sfp_bus = sfp_register_upstream(ref.fwnode, pl, &sfp_phylink_ops); - if (!pl->sfp_bus) - return -ENOMEM; + pl->sfp_bus = bus; return 0; } |