Commit 595fa763 authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Jakub Kicinski

net: dpaa2-mac: use lynx_pcs_create_fwnode()

Use lynx_pcs_create_fwnode() to create a lynx PCS from a fwnode handle.
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6e1a1282
...@@ -247,8 +247,8 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac, ...@@ -247,8 +247,8 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac,
struct fwnode_handle *dpmac_node, struct fwnode_handle *dpmac_node,
int id) int id)
{ {
struct mdio_device *mdiodev;
struct fwnode_handle *node; struct fwnode_handle *node;
struct phylink_pcs *pcs;
node = fwnode_find_reference(dpmac_node, "pcs-handle", 0); node = fwnode_find_reference(dpmac_node, "pcs-handle", 0);
if (IS_ERR(node)) { if (IS_ERR(node)) {
...@@ -263,20 +263,22 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac, ...@@ -263,20 +263,22 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac,
return -ENODEV; return -ENODEV;
} }
mdiodev = fwnode_mdio_find_device(node); pcs = lynx_pcs_create_fwnode(node);
fwnode_handle_put(node); fwnode_handle_put(node);
if (!mdiodev) {
if (pcs == ERR_PTR(-EPROBE_DEFER)) {
netdev_dbg(mac->net_dev, "missing PCS device\n"); netdev_dbg(mac->net_dev, "missing PCS device\n");
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
mac->pcs = lynx_pcs_create(mdiodev); if (IS_ERR(pcs)) {
mdio_device_put(mdiodev); netdev_err(mac->net_dev,
if (!mac->pcs) { "lynx_pcs_create_fwnode() failed: %pe\n", pcs);
netdev_err(mac->net_dev, "lynx_pcs_create() failed\n"); return PTR_ERR(pcs);
return -ENOMEM;
} }
mac->pcs = pcs;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment