From: Heiner Kallweit <hkallweit1@gmail.com>
To: Wei Fang <wei.fang@nxp.com>, Shenwei Wang <shenwei.wang@nxp.com>,
Clark Wang <xiaoning.wang@nxp.com>,
Siddharth Vadapalli <s-vadapalli@ti.com>,
Roger Quadros <rogerq@kernel.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
imx@lists.linux.dev, linux-omap@vger.kernel.org,
Andrew Lunn <andrew@lunn.ch>, Andrew Lunn <andrew+netdev@lunn.ch>,
Russell King - ARM Linux <linux@armlinux.org.uk>,
Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
David Miller <davem@davemloft.net>
Subject: [PATCH v2 net-next 4/4] net: phy: use new iterator mdiobus_for_each_phy in mdiobus_prevent_c45_scan
Date: Fri, 24 Oct 2025 22:24:38 +0200 [thread overview]
Message-ID: <39ea8bae-e9d0-42f0-be4f-cc3f75e4b2a1@gmail.com> (raw)
In-Reply-To: <9c6aeec5-f651-4cf0-8cca-d2455048e89e@gmail.com>
Use new iterator mdiobus_for_each_phy() to simplify the code.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/mdio_bus_provider.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/net/phy/mdio_bus_provider.c b/drivers/net/phy/mdio_bus_provider.c
index a2391d4b7..4b0637405 100644
--- a/drivers/net/phy/mdio_bus_provider.c
+++ b/drivers/net/phy/mdio_bus_provider.c
@@ -249,20 +249,15 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus)
*/
static bool mdiobus_prevent_c45_scan(struct mii_bus *bus)
{
- int i;
+ struct phy_device *phydev;
- for (i = 0; i < PHY_MAX_ADDR; i++) {
- struct phy_device *phydev;
- u32 oui;
-
- phydev = mdiobus_get_phy(bus, i);
- if (!phydev)
- continue;
- oui = phydev->phy_id >> 10;
+ mdiobus_for_each_phy(bus, phydev) {
+ u32 oui = phydev->phy_id >> 10;
if (oui == MICREL_OUI)
return true;
}
+
return false;
}
--
2.51.1
next prev parent reply other threads:[~2025-10-24 20:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 20:20 [PATCH v2 net-next 0/4] net: phy: add iterator mdiobus_for_each_phy Heiner Kallweit
2025-10-24 20:21 ` [PATCH v2 net-next 1/4] " Heiner Kallweit
2025-10-24 20:22 ` [PATCH v2 net-next 2/4] net: fec: use new " Heiner Kallweit
2025-10-24 20:23 ` [PATCH v2 net-next 3/4] net: davinci_mdio: " Heiner Kallweit
2025-10-25 5:27 ` Siddharth Vadapalli
2025-10-24 20:24 ` Heiner Kallweit [this message]
2025-10-25 18:43 ` [PATCH v2 net-next 0/4] net: phy: add " Heiner Kallweit
2025-10-25 18:44 ` Heiner Kallweit
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=39ea8bae-e9d0-42f0-be4f-cc3f75e4b2a1@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=imx@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rogerq@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=shenwei.wang@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).