Commit 10ad63da authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski

net: mdio-mux: be compatible with parent buses which only support C45

After the mii_bus API conversion to a split read() / read_c45(), there
might be MDIO parent buses which only populate the read_c45() and
write_c45() function pointers but not the C22 variants.

We haven't seen these in the wild paired with MDIO multiplexers, but
Andrew points out we should treat the corner case.

Link: https://lore.kernel.org/netdev/4ccd7dc9-b611-48aa-865f-68d3a1327ce8@lunn.ch/Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20231213152712.320842-3-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d215ab4d
......@@ -214,7 +214,9 @@ int mdio_mux_init(struct device *dev,
snprintf(cb->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x.%x",
cb->mii_bus->name, pb->parent_id, v);
cb->mii_bus->parent = dev;
if (parent_bus->read)
cb->mii_bus->read = mdio_mux_read;
if (parent_bus->write)
cb->mii_bus->write = mdio_mux_write;
if (parent_bus->read_c45)
cb->mii_bus->read_c45 = mdio_mux_read_c45;
......
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