[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ya4MgQA7lqiSrWoX@lunn.ch>
Date: Mon, 6 Dec 2021 14:13:37 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Philippe Schenker <philippe.schenker@...adex.com>
Cc: netdev@...r.kernel.org, Joakim Zhang <qiangqing.zhang@....com>,
Fabio Estevam <festevam@...il.com>,
Fugang Duan <fugang.duan@....com>,
"David S . Miller" <davem@...emloft.net>,
Russell King <linux@...linux.org.uk>,
Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org
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
Powered by blists - more mailing lists