All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [PATCH] drivers/net/3c523.c : Use of time_after macro
Date: Fri, 08 Jul 2005 18:48:59 +0000	[thread overview]
Message-ID: <20050708184859.GA2596@us.ibm.com> (raw)
In-Reply-To: <425A4AAB.9060400@feitoza.com.br>

[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]

On 08.07.2005 [15:37:41 -0300], Marcelo Feitoza Parisi wrote:
> Use of the time_after() macro, defined at linux/jiffies.h, which deal
> with wrapping correctly and are nicer to read.
> 
> Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
> 
> --- linux/drivers/net/3c523.c   2005-07-07 19:11:50.000000000 -0300
> +++ linux-kj/drivers/net/3c523.c        2005-07-07 20:32:54.379096144 -0300
> @@ -105,6 +105,7 @@
>  #include <linux/mca-legacy.h>
>  #include <linux/ethtool.h>
>  #include <linux/bitops.h>
> +#include <linux/jiffies.h>
> 
>  #include <asm/uaccess.h>
>  #include <asm/processor.h>
> @@ -658,7 +659,7 @@
> 
>         s = jiffies;            /* warning: only active with interrupts
> on !! */
>         while (!(cfg_cmd->cmd_status & STAT_COMPL)) {
> -               if (jiffies - s > 30*HZ/100)
> +               if (time_after(jiffies, s + 30*HZ/100))

Just personal preference, but it seems like it might be nice to rename
"s" to "stop" and do the addition at initialization, e.g. instead of

s = jiffies;

do

stop = jiffies + msecs_to_jiffies(300);

and then the time_after() call becomes

if (time_after(jiffies, stop))

But your code is fine as is...

-Nish

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2005-07-08 18:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-11 10:00 [KJ] [PATCH] drivers/net/3c523.c : Use of time_after() macro Marcelo Feitoza Parisi
2005-04-13 16:12 ` Nish Aravamudan
2005-07-08 18:37 ` [KJ] [PATCH] drivers/net/3c523.c : Use of time_after macro Marcelo Feitoza Parisi
2005-07-08 18:48 ` Nishanth Aravamudan [this message]
2005-07-11 18:26 ` Marcelo Feitoza Parisi

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=20050708184859.GA2596@us.ibm.com \
    --to=nacc@us.ibm.com \
    --cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.