Messages in this thread | | | Date | Mon, 6 Dec 2021 14:13:37 +0100 | From | Andrew Lunn <> | Subject | Re: [RFC PATCH 1/2] net: fec: make fec_reset_phy not only usable once |
| |
> #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
| |