lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220331092533.348626-10-clement.leger@bootlin.com>
Date:   Thu, 31 Mar 2022 11:25:31 +0200
From:   Clément Léger <clement.leger@...tlin.com>
To:     Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>
Cc:     Horatiu Vultur <horatiu.vultur@...rochip.com>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Allan Nielsen <allan.nielsen@...rochip.com>,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Clément Léger <clement.leger@...tlin.com>
Subject: [RFC PATCH net-next v2 09/11] net: mdio: of: use fwnode_mdiobus_child_is_phy()

Since fwnode_mdiobus_child_is_phy() does almost the same filtering
than done by of_mdiobus_child_is_phy() except the legacy OF compatible
list checking, modify the later one to use the fwnode variant. However,
keep the legacy compatible list checking for legacy purpose.

Signed-off-by: Clément Léger <clement.leger@...tlin.com>
---
 drivers/net/mdio/of_mdio.c | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c
index b8fc1245048e..9c3cd8d3d1f6 100644
--- a/drivers/net/mdio/of_mdio.c
+++ b/drivers/net/mdio/of_mdio.c
@@ -32,13 +32,6 @@ int of_mdio_parse_addr(struct device *dev, const struct device_node *np)
 }
 EXPORT_SYMBOL(of_mdio_parse_addr);
 
-/* Extract the clause 22 phy ID from the compatible string of the form
- * ethernet-phy-idAAAA.BBBB */
-static int of_get_phy_id(struct device_node *device, u32 *phy_id)
-{
-	return fwnode_get_phy_id(of_fwnode_handle(device), phy_id);
-}
-
 int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy,
 				   struct device_node *child, u32 addr)
 {
@@ -118,17 +111,6 @@ static const struct of_device_id whitelist_phys[] = {
  */
 bool of_mdiobus_child_is_phy(struct device_node *child)
 {
-	u32 phy_id;
-
-	if (of_get_phy_id(child, &phy_id) != -EINVAL)
-		return true;
-
-	if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c45"))
-		return true;
-
-	if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c22"))
-		return true;
-
 	if (of_match_node(whitelist_phys, child)) {
 		pr_warn(FW_WARN
 			"%pOF: Whitelisted compatible string. Please remove\n",
@@ -136,10 +118,7 @@ bool of_mdiobus_child_is_phy(struct device_node *child)
 		return true;
 	}
 
-	if (!of_find_property(child, "compatible", NULL))
-		return true;
-
-	return false;
+	return fwnode_mdiobus_child_is_phy(of_fwnode_handle(child));
 }
 EXPORT_SYMBOL(of_mdiobus_child_is_phy);
 
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ