mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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:
parent
efe5f9c0a7
commit
4798a714d6
2 changed files with 23 additions and 23 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue