[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8XL+PKLabp9oTsZ@lunn.ch>
Date: Mon, 16 Jan 2023 23:13:12 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Marcin Wojtas <mw@...ihalf.com>
Cc: linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
netdev@...r.kernel.org, rafael@...nel.org,
andriy.shevchenko@...ux.intel.com, sean.wang@...iatek.com,
Landen.Chao@...iatek.com, linus.walleij@...aro.org,
vivien.didelot@...il.com, f.fainelli@...il.com, olteanv@...il.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, linux@...linux.org.uk, hkallweit1@...il.com,
jaz@...ihalf.com, tn@...ihalf.com, Samer.El-Haj-Mahmoud@....com
Subject: Re: [net-next: PATCH v4 2/8] net: mdio: switch fixed-link PHYs API
to fwnode_
> +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
Powered by blists - more mailing lists