Re: [net-next: PATCH v4 2/8] net: mdio: switch fixed-link PHYs API to fwnode_

From: Andrew Lunn
Date: Mon Jan 16 2023 - 17:15:42 EST


> +int fwnode_phy_register_fixed_link(struct fwnode_handle *fwnode)
> +{
> + struct fixed_phy_status status = {};
> + struct fwnode_handle *fixed_link_node;
> + u32 fixed_link_prop[5];
> + const char *managed;
> + int rc;
> +
> + if (fwnode_property_read_string(fwnode, "managed", &managed) == 0 &&
> + strcmp(managed, "in-band-status") == 0) {
> + /* status is zeroed, namely its .link member */
> + goto register_phy;
> + }
> +
> + /* New binding */
> + fixed_link_node = fwnode_get_named_child_node(fwnode, "fixed-link");
> + if (fixed_link_node) {
> + status.link = 1;
> + status.duplex = fwnode_property_present(fixed_link_node,
> + "full-duplex");
> + rc = fwnode_property_read_u32(fixed_link_node, "speed",
> + &status.speed);
> + if (rc) {
> + fwnode_handle_put(fixed_link_node);
> + return rc;
> + }
> + status.pause = fwnode_property_present(fixed_link_node, "pause");
> + status.asym_pause = fwnode_property_present(fixed_link_node,
> + "asym-pause");
> + fwnode_handle_put(fixed_link_node);
> +
> + goto register_phy;
> + }
> +
> + /* Old binding */
> + rc = fwnode_property_read_u32_array(fwnode, "fixed-link", fixed_link_prop,
> + ARRAY_SIZE(fixed_link_prop));
> + if (rc)
> + return rc;
> +
> + status.link = 1;
> + status.duplex = fixed_link_prop[1];
> + status.speed = fixed_link_prop[2];
> + status.pause = fixed_link_prop[3];
> + status.asym_pause = fixed_link_prop[4];

This is one example of the issue i just pointed out. The "Old binding"
has been deprecated for years. Maybe a decade? There is no reason it
should be used in ACPI.

Andrew