Skip to content

Commit cf99686

Browse files
calvinjolinuxdavem330
authored andcommitted
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: Calvin Johnson <[email protected]> Signed-off-by: Ioana Ciornei <[email protected]> Acked-by: Grant Likely <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 114dea6 commit cf99686

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

drivers/net/mdio/of_mdio.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,7 @@ MODULE_LICENSE("GPL");
2929
* ethernet-phy-idAAAA.BBBB */
3030
static int of_get_phy_id(struct device_node *device, u32 *phy_id)
3131
{
32-
struct property *prop;
33-
const char *cp;
34-
unsigned int upper, lower;
35-
36-
of_property_for_each_string(device, "compatible", prop, cp) {
37-
if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) == 2) {
38-
*phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF);
39-
return 0;
40-
}
41-
}
42-
return -EINVAL;
32+
return fwnode_get_phy_id(of_fwnode_handle(device), phy_id);
4333
}
4434

4535
static struct mii_timestamper *of_find_mii_timestamper(struct device_node *node)

0 commit comments

Comments
 (0)