mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Oleksij Rempel <o.rempel@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH v1] net: phy: Add support for PHY-specific link polling interval and randomization
Date: Wed, 12 Jun 2024 16:23:41 +0200	[thread overview]
Message-ID: <9924712c-7e50-4f10-94d6-0a15a734ce12@pengutronix.de> (raw)
In-Reply-To: <20240612140918.3832186-1-o.rempel@pengutronix.de>

Hello Oleksij,

On 12.06.24 16:09, Oleksij Rempel wrote:
>  static int eth_carrier_check(struct eth_device *edev, bool may_wait)
>  {
> +	uint64_t timeout;
> +
>  	if (!IS_ENABLED(CONFIG_PHYLIB))
>  		return 0;
>  
>  	if (!edev->phydev)
>  		return 0;
>  
> +	if (edev->phydev->polling_interval)
> +		timeout = edev->phydev->polling_interval;
> +	else
> +		timeout = 5 * SECOND;

IMO, you should initialize edev->phydev->polling_interval in phy_device_create(),
so phydev->polling_interval always has a valid value.

Cheers,
Ahmad


> +
>  	if (!edev->last_link_check ||
> -	    is_timeout(edev->last_link_check, 5 * SECOND))
> +	    is_timeout(edev->last_link_check, timeout))
>  		eth_carrier_poll_once(edev);
>  
>  	if (may_wait && !edev->phydev->link) {

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2024-06-12 14:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-12 14:09 Oleksij Rempel
2024-06-12 14:23 ` Ahmad Fatoum [this message]
2024-06-12 16:21   ` Oleksij Rempel

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=9924712c-7e50-4f10-94d6-0a15a734ce12@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=o.rempel@pengutronix.de \
    /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