Skip to content

Commit 6886082

Browse files
committed
net: phylink: Convert to mdiobus_c45_{read|write}
Author: Andrew Lunn <andrew@lunn.ch> Stop using the helpers to construct a special phy address which indicates C45. Instead use the C45 accessors, which will call the busses C45 specific read/write API. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Paolo Abeni <pabeni@redhat.com> (cherry picked from commit 70dcf3c) Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2100606 Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
1 parent 6dac8f1 commit 6886082

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

drivers/net/phy/phylink.c

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,8 +2304,11 @@ static int phylink_phy_read(struct phylink *pl, unsigned int phy_id,
23042304
if (mdio_phy_id_is_c45(phy_id)) {
23052305
prtad = mdio_phy_id_prtad(phy_id);
23062306
devad = mdio_phy_id_devad(phy_id);
2307-
devad = mdiobus_c45_addr(devad, reg);
2308-
} else if (phydev->is_c45) {
2307+
return mdiobus_c45_read(pl->phydev->mdio.bus, prtad, devad,
2308+
reg);
2309+
}
2310+
2311+
if (phydev->is_c45) {
23092312
switch (reg) {
23102313
case MII_BMCR:
23112314
case MII_BMSR:
@@ -2327,12 +2330,11 @@ static int phylink_phy_read(struct phylink *pl, unsigned int phy_id,
23272330
return -EINVAL;
23282331
}
23292332
prtad = phy_id;
2330-
devad = mdiobus_c45_addr(devad, reg);
2331-
} else {
2332-
prtad = phy_id;
2333-
devad = reg;
2333+
return mdiobus_c45_read(pl->phydev->mdio.bus, prtad, devad,
2334+
reg);
23342335
}
2335-
return mdiobus_read(pl->phydev->mdio.bus, prtad, devad);
2336+
2337+
return mdiobus_read(pl->phydev->mdio.bus, phy_id, reg);
23362338
}
23372339

23382340
static int phylink_phy_write(struct phylink *pl, unsigned int phy_id,
@@ -2344,8 +2346,11 @@ static int phylink_phy_write(struct phylink *pl, unsigned int phy_id,
23442346
if (mdio_phy_id_is_c45(phy_id)) {
23452347
prtad = mdio_phy_id_prtad(phy_id);
23462348
devad = mdio_phy_id_devad(phy_id);
2347-
devad = mdiobus_c45_addr(devad, reg);
2348-
} else if (phydev->is_c45) {
2349+
return mdiobus_c45_write(pl->phydev->mdio.bus, prtad, devad,
2350+
reg, val);
2351+
}
2352+
2353+
if (phydev->is_c45) {
23492354
switch (reg) {
23502355
case MII_BMCR:
23512356
case MII_BMSR:
@@ -2366,14 +2371,11 @@ static int phylink_phy_write(struct phylink *pl, unsigned int phy_id,
23662371
default:
23672372
return -EINVAL;
23682373
}
2369-
prtad = phy_id;
2370-
devad = mdiobus_c45_addr(devad, reg);
2371-
} else {
2372-
prtad = phy_id;
2373-
devad = reg;
2374+
return mdiobus_c45_write(pl->phydev->mdio.bus, phy_id, devad,
2375+
reg, val);
23742376
}
23752377

2376-
return mdiobus_write(phydev->mdio.bus, prtad, devad, val);
2378+
return mdiobus_write(phydev->mdio.bus, phy_id, reg, val);
23772379
}
23782380

23792381
static int phylink_mii_read(struct phylink *pl, unsigned int phy_id,

0 commit comments

Comments
 (0)