Netdev List
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: "Manuel Schölling" <manuel.schoelling@gmx.de>
Cc: davem@davemloft.net, jg1.han@samsung.com,
	dingtianhong@huawei.com, ebiederm@xmission.com,
	Julia.Lawall@lip6.fr, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] micrel: Use time_before_eq()
Date: Fri, 23 May 2014 07:06:10 +0800 (SGT)	[thread overview]
Message-ID: <alpine.DEB.2.10.1405230705350.2606@hadrien> (raw)
In-Reply-To: <1400781165-26498-1-git-send-email-manuel.schoelling@gmx.de>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1065 bytes --]

On Thu, 22 May 2014, Manuel Schölling wrote:

> To be future-proof and for better readability the time comparisons are modified
> to use time_before_eq() instead of plain, error-prone math.

I had the impression that the real reason for these functions was that
they were somehow sensitive to the possibility of overflow of jiffies?

julia

> Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
> ---
>  drivers/net/ethernet/micrel/ksz884x.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
> index 14ac0e2..90fa5f3 100644
> --- a/drivers/net/ethernet/micrel/ksz884x.c
> +++ b/drivers/net/ethernet/micrel/ksz884x.c
> @@ -4930,7 +4930,7 @@ static void netdev_tx_timeout(struct net_device *dev)
>  		 * Only reset the hardware if time between calls is long
>  		 * enough.
>  		 */
> -		if (jiffies - last_reset <= dev->watchdog_timeo)
> +		if (time_before_eq(jiffies, last_reset + dev->watchdog_timeo))
>  			hw_priv = NULL;
>  	}
>
> --
> 1.7.10.4
>
>

      parent reply	other threads:[~2014-05-22 23:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22 17:52 [PATCH] micrel: Use time_before_eq() Manuel Schölling
2014-05-22 19:50 ` David Miller
2014-05-22 23:06 ` Julia Lawall [this message]

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=alpine.DEB.2.10.1405230705350.2606@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=davem@davemloft.net \
    --cc=dingtianhong@huawei.com \
    --cc=ebiederm@xmission.com \
    --cc=jg1.han@samsung.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manuel.schoelling@gmx.de \
    --cc=netdev@vger.kernel.org \
    /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