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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 31 Mar 2022 11:25:28 +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 06/11] net: mdio: of: wrap fwnode_mdio_parse_addr() in of_mdio_parse_addr()

Since function fwnode_mdio_parse_addr() returns the same value that is
done by of_mdio_parse_addr() and has the same behavior, wrap the first
one. The function was switched as non static in of_mdio.c to avoid
including fwnode_mdio.h in of_mdio.h.

Signed-off-by: Clément Léger <clement.leger@...tlin.com>
---
 drivers/net/mdio/of_mdio.c |  6 ++++++
 include/linux/of_mdio.h    | 23 +----------------------
 2 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c
index 9e3c815a070f..b8fc1245048e 100644
--- a/drivers/net/mdio/of_mdio.c
+++ b/drivers/net/mdio/of_mdio.c
@@ -26,6 +26,12 @@
 MODULE_AUTHOR("Grant Likely <grant.likely@...retlab.ca>");
 MODULE_LICENSE("GPL");
 
+int of_mdio_parse_addr(struct device *dev, const struct device_node *np)
+{
+	return fwnode_mdio_parse_addr(dev, of_fwnode_handle(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)
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index da633d34ab86..1de67a1e5cd7 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -33,28 +33,7 @@ void of_phy_deregister_fixed_link(struct device_node *np);
 bool of_phy_is_fixed_link(struct device_node *np);
 int of_mdiobus_phy_device_register(struct mii_bus *mdio, struct phy_device *phy,
 				   struct device_node *child, u32 addr);
-
-static inline int of_mdio_parse_addr(struct device *dev,
-				     const struct device_node *np)
-{
-	u32 addr;
-	int ret;
-
-	ret = of_property_read_u32(np, "reg", &addr);
-	if (ret < 0) {
-		dev_err(dev, "%s has invalid PHY address\n", np->full_name);
-		return ret;
-	}
-
-	/* A PHY must have a reg property in the range [0-31] */
-	if (addr >= PHY_MAX_ADDR) {
-		dev_err(dev, "%s PHY address %i is too large\n",
-			np->full_name, addr);
-		return -EINVAL;
-	}
-
-	return addr;
-}
+int of_mdio_parse_addr(struct device *dev, const struct device_node *np);
 
 #else /* CONFIG_OF_MDIO */
 static inline bool of_mdiobus_child_is_phy(struct device_node *child)
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ