Skip to content

Commit 10ad63d

Browse files
vladimirolteankuba-moo
authored andcommitted
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/[email protected]/ Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d215ab4 commit 10ad63d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/net/mdio/mdio-mux.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ int mdio_mux_init(struct device *dev,
214214
snprintf(cb->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x.%x",
215215
cb->mii_bus->name, pb->parent_id, v);
216216
cb->mii_bus->parent = dev;
217-
cb->mii_bus->read = mdio_mux_read;
218-
cb->mii_bus->write = mdio_mux_write;
217+
if (parent_bus->read)
218+
cb->mii_bus->read = mdio_mux_read;
219+
if (parent_bus->write)
220+
cb->mii_bus->write = mdio_mux_write;
219221
if (parent_bus->read_c45)
220222
cb->mii_bus->read_c45 = mdio_mux_read_c45;
221223
if (parent_bus->write_c45)

0 commit comments

Comments
 (0)