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:	Fri, 27 Mar 2015 16:35:56 +0300
From:	Stas Sergeev <stsp@...t.ru>
To:	netdev@...r.kernel.org
CC:	Linux kernel <linux-kernel@...r.kernel.org>,
	Stas Sergeev <stsp@...rs.sourceforge.net>,
	Florian Fainelli <f.fainelli@...il.com>,
	Grant Likely <grant.likely@...aro.org>,
	Rob Herring <robh+dt@...nel.org>, devicetree@...r.kernel.org
Subject: [PATCH 3/6] of_mdio: restructure of_phy_register_fixed_link() for
 further modifications


This is a no-op patch needed to separate code rearrangements from
the actual changes. It allows to easily add code to the function
without duplicating it for new and old fixed-phy DT binding.
The subsequent patch therefore happily adds the code without duplications.

CC: Florian Fainelli <f.fainelli@...il.com>
CC: Grant Likely <grant.likely@...aro.org>
CC: Rob Herring <robh+dt@...nel.org>
CC: netdev@...r.kernel.org
CC: devicetree@...r.kernel.org
CC: linux-kernel@...r.kernel.org

Signed-off-by: Stas Sergeev <stsp@...rs.sourceforge.net>
---
 drivers/of/of_mdio.c |   32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 1bd4305..b3dc1e6 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -301,22 +301,26 @@ int of_phy_register_fixed_link(struct device_node *np)
 							  "asym-pause");
 		of_node_put(fixed_link_node);
 		phy = fixed_phy_register(PHY_POLL, &status, np);
-		return IS_ERR(phy) ? PTR_ERR(phy) : 0;
-	}
-
-	/* Old binding */
-	fixed_link_prop = of_get_property(np, "fixed-link", &len);
-	if (fixed_link_prop && len == (5 * sizeof(__be32))) {
-		status.link = 1;
-		status.duplex = be32_to_cpu(fixed_link_prop[1]);
-		status.speed = be32_to_cpu(fixed_link_prop[2]);
-		status.pause = be32_to_cpu(fixed_link_prop[3]);
-		status.asym_pause = be32_to_cpu(fixed_link_prop[4]);
-		phy = fixed_phy_register(PHY_POLL, &status, np);
-		return IS_ERR(phy) ? PTR_ERR(phy) : 0;
+		if (IS_ERR(phy))
+			return PTR_ERR(phy);
+	} else {
+		/* Old binding */
+		fixed_link_prop = of_get_property(np, "fixed-link", &len);
+		if (fixed_link_prop && len == (5 * sizeof(__be32))) {
+			status.link = 1;
+			status.duplex = be32_to_cpu(fixed_link_prop[1]);
+			status.speed = be32_to_cpu(fixed_link_prop[2]);
+			status.pause = be32_to_cpu(fixed_link_prop[3]);
+			status.asym_pause = be32_to_cpu(fixed_link_prop[4]);
+			phy = fixed_phy_register(PHY_POLL, &status, np);
+			if (IS_ERR(phy))
+				return PTR_ERR(phy);
+		} else {
+			return -ENODEV;
+		}
 	}

-	return -ENODEV;
+	return 0;
 }
 EXPORT_SYMBOL(of_phy_register_fixed_link);
 #endif
-- 
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ