Commit cf996860 authored by Calvin Johnson's avatar Calvin Johnson Committed by David S. Miller

of: mdio: Refactor of_get_phy_id()

With the introduction of fwnode_get_phy_id(), refactor of_get_phy_id()
to use fwnode equivalent.
Signed-off-by: default avatarCalvin Johnson <calvin.johnson@oss.nxp.com>
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Acked-by: default avatarGrant Likely <grant.likely@arm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 114dea60
...@@ -29,17 +29,7 @@ MODULE_LICENSE("GPL"); ...@@ -29,17 +29,7 @@ MODULE_LICENSE("GPL");
* ethernet-phy-idAAAA.BBBB */ * ethernet-phy-idAAAA.BBBB */
static int of_get_phy_id(struct device_node *device, u32 *phy_id) static int of_get_phy_id(struct device_node *device, u32 *phy_id)
{ {
struct property *prop; return fwnode_get_phy_id(of_fwnode_handle(device), phy_id);
const char *cp;
unsigned int upper, lower;
of_property_for_each_string(device, "compatible", prop, cp) {
if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) == 2) {
*phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF);
return 0;
}
}
return -EINVAL;
} }
static struct mii_timestamper *of_find_mii_timestamper(struct device_node *node) static struct mii_timestamper *of_find_mii_timestamper(struct device_node *node)
......
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