From: "Russell King (Oracle)" <rmk+kernel@armlinux•org.uk>
To: Andrew Lunn <andrew@lunn•ch>,
Heiner Kallweit <hkallweit1@gmail•com>,
Sean Anderson <sean.anderson@seco•com>
Cc: "David S. Miller" <davem@davemloft•net>,
Jakub Kicinski <kuba@kernel•org>,
netdev@vger•kernel.org
Subject: [PATCH v2 net-next 2/2] net: phylink: use mdiobus_modify_changed() helper
Date: Wed, 06 Oct 2021 13:19:25 +0100 [thread overview]
Message-ID: <E1mY5tN-001SlT-DB@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <YV2UIa2eU+UjmWaE@shell.armlinux.org.uk>
Use the mdiobus_modify_changed() helper in the C22 PCS advertisement
helper.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux•org.uk>
---
v2: fix build warnings
drivers/net/phy/phylink.c | 29 ++++-------------------------
1 file changed, 4 insertions(+), 25 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index b32774fd65f8..16240f2dd161 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -2596,7 +2596,6 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs,
{
struct mii_bus *bus = pcs->bus;
int addr = pcs->addr;
- int val, ret;
u16 adv;
switch (interface) {
@@ -2610,32 +2609,12 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs,
advertising))
adv |= ADVERTISE_1000XPSE_ASYM;
- val = mdiobus_read(bus, addr, MII_ADVERTISE);
- if (val < 0)
- return val;
-
- if (val == adv)
- return 0;
-
- ret = mdiobus_write(bus, addr, MII_ADVERTISE, adv);
- if (ret < 0)
- return ret;
-
- return 1;
+ return mdiobus_modify_changed(bus, addr, MII_ADVERTISE,
+ 0xffff, adv);
case PHY_INTERFACE_MODE_SGMII:
- val = mdiobus_read(bus, addr, MII_ADVERTISE);
- if (val < 0)
- return val;
-
- if (val == 0x0001)
- return 0;
-
- ret = mdiobus_write(bus, addr, MII_ADVERTISE, 0x0001);
- if (ret < 0)
- return ret;
-
- return 1;
+ return mdiobus_modify_changed(bus, addr, MII_ADVERTISE,
+ 0xffff, 0x0001);
default:
/* Nothing to do for other modes */
--
2.30.2
next prev parent reply other threads:[~2021-10-06 12:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-06 12:18 [PATCH net-next 0/2] Add mdiobus_modify_changed() helper Russell King (Oracle)
2021-10-06 12:19 ` [PATCH v2 net-next 1/2] net: mdio: add mdiobus_modify_changed() Russell King (Oracle)
2021-10-06 12:19 ` Russell King (Oracle) [this message]
2021-10-06 21:14 ` [PATCH v2 net-next 2/2] net: phylink: use mdiobus_modify_changed() helper Andrew Lunn
2021-10-07 1:10 ` [PATCH net-next 0/2] Add " patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1mY5tN-001SlT-DB@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux$(echo .)org.uk \
--cc=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=hkallweit1@gmail$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=sean.anderson@seco$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox