linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Philippe Schenker <philippe.schenker@toradex.com>
Cc: netdev@vger.kernel.org, Joakim Zhang <qiangqing.zhang@nxp.com>,
	Fabio Estevam <festevam@gmail.com>,
	Fugang Duan <fugang.duan@nxp.com>,
	"David S . Miller" <davem@davemloft.net>,
	Russell King <linux@armlinux.org.uk>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] net: fec: make fec_reset_phy not only usable once
Date: Mon, 6 Dec 2021 14:13:37 +0100	[thread overview]
Message-ID: <Ya4MgQA7lqiSrWoX@lunn.ch> (raw)
In-Reply-To: <20211206101326.1022527-2-philippe.schenker@toradex.com>

>  #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

  reply	other threads:[~2021-12-06 13:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 10:13 [RFC PATCH 0/2] Reset PHY in fec_resume if it got powered down Philippe Schenker
2021-12-06 10:13 ` [RFC PATCH 1/2] net: fec: make fec_reset_phy not only usable once Philippe Schenker
2021-12-06 13:13   ` Andrew Lunn [this message]
2021-12-06 10:13 ` [RFC PATCH 2/2] net: fec: reset phy in resume if it was powered down Philippe Schenker
2021-12-07  1:58 ` [RFC PATCH 0/2] Reset PHY in fec_resume if it got " Joakim Zhang
2021-12-10 13:51   ` Philippe Schenker
2021-12-11 13:01     ` [PATCH net-next] net: phy: perform a PHY reset on resume Francesco Dolcini
2021-12-11 14:15       ` Russell King (Oracle)
2021-12-11 14:57         ` Francesco Dolcini
2021-12-14 11:58         ` Francesco Dolcini
2021-12-13  4:40       ` Joakim Zhang
2021-12-13 10:57       ` Philippe Schenker
2021-12-13  4:39     ` [RFC PATCH 0/2] Reset PHY in fec_resume if it got powered down Joakim Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ya4MgQA7lqiSrWoX@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=festevam@gmail.com \
    --cc=fugang.duan@nxp.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=philippe.schenker@toradex.com \
    --cc=qiangqing.zhang@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).