ksz_sw_mdio_read() and ksz_sw_mdio_write() respectively call ksz_dev_ops::phy_r() and ksz_dev_ops::phy_w() just like dsa_switch_ops::phy_read() and dsa_switch_ops::phy_write() do. Call dsa_switch_ops::phy_read() from ksz_sw_mdio_read() and dsa_switch_ops::phy_write() from ksz_sw_mdio_write() so we'll be able to get rid of the useless indirections provided by ksz_dev_ops in upcoming patch. Signed-off-by: Bastien Curutchet (Schneider Electric) --- drivers/net/dsa/microchip/ksz_common.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index f44974cf4e595..0d66592dff703 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -2260,22 +2260,18 @@ static void ksz_update_port_member(struct ksz_device *dev, int port) static int ksz_sw_mdio_read(struct mii_bus *bus, int addr, int regnum) { struct ksz_device *dev = bus->priv; - u16 val; - int ret; - - ret = dev->dev_ops->r_phy(dev, addr, regnum, &val); - if (ret < 0) - return ret; + struct dsa_switch *ds = dev->ds; - return val; + return ds->ops->phy_read(ds, addr, regnum); } static int ksz_sw_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) { struct ksz_device *dev = bus->priv; + struct dsa_switch *ds = dev->ds; - return dev->dev_ops->w_phy(dev, addr, regnum, val); + return ds->ops->phy_write(ds, addr, regnum, val); } /** -- 2.53.0