linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Girish Moodalbail <girish.moodalbail@oracle.com>
To: David Miller <davem@davemloft.net>, karim.eshapa@gmail.com
Cc: inaky.perez-gonzalez@intel.com, linux-wimax@intel.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: net: wimax: i2400m: i2400m-usb: Use time_after for time comparison
Date: Mon, 8 May 2017 16:27:14 -0700	[thread overview]
Message-ID: <5ad8948b-4262-37d5-316d-f9c5f37f1e09@oracle.com> (raw)
In-Reply-To: <20170508.172618.676839687841750049.davem@davemloft.net>

On 5/8/17 2:26 PM, David Miller wrote:
> From: Karim Eshapa <karim.eshapa@gmail.com>
> Date: Mon,  8 May 2017 18:58:02 +0200
>
>> diff --git a/drivers/net/wimax/i2400m/i2400m-usb.h b/drivers/net/wimax/i2400m/i2400m-usb.h
>> index 649ecad..6fc941c 100644
>> --- a/drivers/net/wimax/i2400m/i2400m-usb.h
>> +++ b/drivers/net/wimax/i2400m/i2400m-usb.h
>> @@ -131,7 +131,7 @@ static inline int edc_inc(struct edc *edc, u16 max_err, u16 timeframe)
>>  	unsigned long now;
>>
>>  	now = jiffies;
>> -	if (now - edc->timestart > timeframe) {
>> +	if (time_after(now - edc->timestart, (unsigned long)timeframe)) {
>
> This is far from correct.
>
> time_after() compares two "jiffies" timestamp values.  The second
> argument here is not a jiffies timestamp value.
>

Perhaps, what is needed here is:

+	if (time_after(jiffies, edc->timestart + timeframe)) {

where in 'timeframe' is set in HZ in all the callers I checked (for the most 
part it is set to EDC_ERROR_TIMEFRAME which is 1HZ).

~Girish

  reply	other threads:[~2017-05-08 23:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 16:58 [PATCH] drivers: net: wimax: i2400m: i2400m-usb: Use time_after for time comparison Karim Eshapa
2017-05-08 21:26 ` David Miller
2017-05-08 23:27   ` Girish Moodalbail [this message]
2017-05-09  0:06 ` Karim Eshapa
2017-05-09 13:40   ` David Miller

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=5ad8948b-4262-37d5-316d-f9c5f37f1e09@oracle.com \
    --to=girish.moodalbail@oracle.com \
    --cc=davem@davemloft.net \
    --cc=inaky.perez-gonzalez@intel.com \
    --cc=karim.eshapa@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wimax@intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).