Commit 078e0b53 authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Jakub Kicinski

net: phylink: use mdiobus_modify_changed() helper

Use the mdiobus_modify_changed() helper in the C22 PCS advertisement
helper.
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 79365f36
...@@ -2596,7 +2596,6 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs, ...@@ -2596,7 +2596,6 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs,
{ {
struct mii_bus *bus = pcs->bus; struct mii_bus *bus = pcs->bus;
int addr = pcs->addr; int addr = pcs->addr;
int val, ret;
u16 adv; u16 adv;
switch (interface) { switch (interface) {
...@@ -2610,32 +2609,12 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs, ...@@ -2610,32 +2609,12 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs,
advertising)) advertising))
adv |= ADVERTISE_1000XPSE_ASYM; adv |= ADVERTISE_1000XPSE_ASYM;
val = mdiobus_read(bus, addr, MII_ADVERTISE); return mdiobus_modify_changed(bus, addr, MII_ADVERTISE,
if (val < 0) 0xffff, adv);
return val;
if (val == adv)
return 0;
ret = mdiobus_write(bus, addr, MII_ADVERTISE, adv);
if (ret < 0)
return ret;
return 1;
case PHY_INTERFACE_MODE_SGMII: case PHY_INTERFACE_MODE_SGMII:
val = mdiobus_read(bus, addr, MII_ADVERTISE); return mdiobus_modify_changed(bus, addr, MII_ADVERTISE,
if (val < 0) 0xffff, 0x0001);
return val;
if (val == 0x0001)
return 0;
ret = mdiobus_write(bus, addr, MII_ADVERTISE, 0x0001);
if (ret < 0)
return ret;
return 1;
default: default:
/* Nothing to do for other modes */ /* Nothing to do for other modes */
......
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