Commit 555d64c6 authored by Andrew Lunn's avatar Andrew Lunn Committed by Jakub Kicinski

net: mdio: mdiobus_register: update validation test

Now that C45 uses its own read/write methods, the validation performed
when a bus is registers needs updating. All combinations of C22 and
C45 are supported, but both read and write methods must be provided,
read only busses are not supported etc.
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarMichael Walle <michael@walle.cc>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3a65e5f9
...@@ -526,8 +526,15 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) ...@@ -526,8 +526,15 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
int i, err; int i, err;
struct gpio_desc *gpiod; struct gpio_desc *gpiod;
if (NULL == bus || NULL == bus->name || if (!bus || !bus->name)
NULL == bus->read || NULL == bus->write) return -EINVAL;
/* An access method always needs both read and write operations */
if (!!bus->read != !!bus->write || !!bus->read_c45 != !!bus->write_c45)
return -EINVAL;
/* At least one method is mandatory */
if (!bus->read && !bus->read_c45)
return -EINVAL; return -EINVAL;
if (bus->parent && bus->parent->of_node) if (bus->parent && bus->parent->of_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