of_mdio: move of_mdio_parse_addr to header file

The of_mdio_parse_addr() helper function is useful to other code, but
the module dependency chain causes issues.  To work around this, we can
move of_mdio_parse_addr() to be an inline function in the header file.
This gets rid of the dependencies and still allows for the reuse of
code.

Reported-by: Liviu Dudau <[email protected]>
Signed-off-by: Jon Mason <[email protected]>
Fixes: 342fa19644 ("mdio: mux: make child bus walking more permissive and errors more verbose")
Reviewed-by: Florian Fainelli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Jon Mason 2017-06-13 10:56:08 -04:00 • committed by David S. Miller
commit 4798a714d6
2 changed files with 23 additions and 23 deletions

View file

@ -119,28 +119,6 @@ static void of_mdiobus_register_device(struct mii_bus *mdio,
child->name, addr);
}
int of_mdio_parse_addr(struct device *dev, const struct device_node *np)
{
u32 addr;
int ret;
ret = of_property_read_u32(np, "reg", &addr);
if (ret < 0) {
dev_err(dev, "%s has invalid PHY address\n", np->full_name);
return ret;
}
/* A PHY must have a reg property in the range [0-31] */
if (addr >= PHY_MAX_ADDR) {
dev_err(dev, "%s PHY address %i is too large\n",
np->full_name, addr);
return -EINVAL;
}
return addr;
}
EXPORT_SYMBOL(of_mdio_parse_addr);
/* The following is a list of PHY compatible strings which appear in
* some DTBs. The compatible string is never matched against a PHY
* driver, so is pointless. We only expect devices which are not PHYs