Thread (13 messages) 13 messages, 5 authors, 2021-12-14

Re: [RFC PATCH 1/2] net: fec: make fec_reset_phy not only usable once

flat view

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-12-06 13:13:47
Also in: lkml

quoted hunk ↗ jump to hunk
 #ifdef CONFIG_OF
-static int fec_reset_phy(struct platform_device *pdev)
+static int fec_reset_phy_probe(struct platform_device *pdev,
+			       struct net_device *ndev)
 {
-	int err, phy_reset;
-	bool active_high = false;
-	int msec = 1, phy_post_delay = 0;
 	struct device_node *np = pdev->dev.of_node;
+	struct fec_enet_private *fep = netdev_priv(ndev);
+	int tmp, ret;
 
 	if (!np)
 		return 0;
 
-	err = of_property_read_u32(np, "phy-reset-duration", &msec);
+	tmp = 1;
+	ret = of_property_read_u32(np, "phy-reset-duration", &tmp);
 	/* A sane reset duration should not be longer than 1s */
-	if (!err && msec > 1000)
-		msec = 1;
+	if (!ret && tmp > 1000)
+		tmp = 1;
+
+	fep->phy_reset_duration = tmp;
If you don't change the names msec and ret, this code would be
unchanged. It then becomes a lot easier to see you have not changed,
the code, only moved it around.

    Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help