static int phylink_register_sfp(struct phylink *pl, struct fwnode_handle *fwnode) { struct fwnode_reference_args ref; 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; netdev_err(pl->netdev, "unable to parse \"sfp\" node: %d\n", ret); return ret; } pl->sfp_bus = sfp_register_upstream(ref.fwnode, pl->netdev, pl, &sfp_phylink_ops); if (!pl->sfp_bus) return -ENOMEM; return 0; }
static int phylink_register_sfp(struct phylink *pl, struct device_node *np) { struct device_node *sfp_np; sfp_np = of_parse_phandle(np, "sfp", 0); if (!sfp_np) return 0; pl->sfp_bus = sfp_register_upstream(sfp_np, pl->netdev, pl, &sfp_phylink_ops); if (!pl->sfp_bus) return -ENOMEM; return 0; }