]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: dsa: microchip: call DSA's phy_{read/write} to do mdio {read/write}
authorBastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Thu, 21 May 2026 06:12:42 +0000 (08:12 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 23 May 2026 01:40:49 +0000 (18:40 -0700)
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) <bastien.curutchet@bootlin.com>
Link: https://patch.msgid.link/20260521-clean-ksz-2nd-series-v3-7-75c38971c19a@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/microchip/ksz_common.c

index e3f481c32e09305bea3f6f8262459abf06b7c97c..3c09bc8ffaec4e5b317d300c9acad677f1124bed 100644 (file)
@@ -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);
 }
 
 /**