From: "S.Çağlar Onur" <caglar@pardus.org.tr>
To: linux-kernel@vger.kernel.org
Cc: Jeff Garzik <jeff@garzik.org>, David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] drivers/net/arcnet/arcnet.c: Use time_* macros
Date: Mon, 17 Mar 2008 11:36:27 +0200 [thread overview]
Message-ID: <1205746593-24820-5-git-send-email-caglar@pardus.org.tr> (raw)
In-Reply-To: <1205746593-24820-4-git-send-email-caglar@pardus.org.tr>
The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values.
So following patch implements usage of the time_after() macro, defined at linux/jiffies.h, which deals with wrapping correctly
Cc: Jeff Garzik <jeff@garzik.org>
Cc: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
drivers/net/arcnet/arcnet.c | 4 ++--
include/linux/arcdevice.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index c59c806..c298615 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -940,7 +940,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
/* is the RECON info empty or old? */
if (!lp->first_recon || !lp->last_recon ||
- jiffies - lp->last_recon > HZ * 10) {
+ time_after(jiffies, lp->last_recon + HZ * 10)) {
if (lp->network_down)
BUGMSG(D_NORMAL, "reconfiguration detected: cabling restored?\n");
lp->first_recon = lp->last_recon = jiffies;
@@ -974,7 +974,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
lp->num_recons = 1;
}
}
- } else if (lp->network_down && jiffies - lp->last_recon > HZ * 10) {
+ } else if (lp->network_down && time_after(jiffies, lp->last_recon + HZ * 10)) {
if (lp->network_down)
BUGMSG(D_NORMAL, "cabling restored?\n");
lp->first_recon = lp->last_recon = 0;
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index fde6758..9d33768 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -283,7 +283,7 @@ struct arcnet_local {
int next_buf, first_free_buf;
/* network "reconfiguration" handling */
- time_t first_recon, /* time of "first" RECON message to count */
+ unsigned long first_recon, /* time of "first" RECON message to count */
last_recon; /* time of most recent RECON */
int num_recons; /* number of RECONs between first and last. */
bool network_down; /* do we think the network is down? */
--
1.5.4.3
next prev parent reply other threads:[~2008-03-17 9:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-17 9:36 [PATCH] arch/alpha/kernel/traps.c: " S.Çağlar Onur
2008-03-17 9:36 ` [PATCH] arch/ia64/kernel/: " S.Çağlar Onur
2008-03-17 9:36 ` [PATCH] arch/parisc/kernel/unaligned.c: " S.Çağlar Onur
2008-03-17 9:36 ` [PATCH] arch/powerpc/platforms/iseries/pci.c: " S.Çağlar Onur
2008-03-17 9:36 ` S.Çağlar Onur [this message]
2008-03-17 9:36 ` [PATCH] drivers/net/ax88796.c: " S.Çağlar Onur
2008-03-17 9:36 ` [PATCH] net/mac80211/: " S.Çağlar Onur
2008-03-17 9:36 ` [PATCH] drivers/net/tokenring/3c359.c: " S.Çağlar Onur
2008-03-17 9:36 ` [PATCH] drivers/net/wireless/atmel.c: " S.Çağlar Onur
2008-03-17 9:36 ` [PATCH] fs/binfmt_aout.c: Use printk_ratelimit() S.Çağlar Onur
2008-03-17 9:36 ` [PATCH] Fix indentation S.Çağlar Onur
2008-03-25 18:32 ` [PATCH] net/mac80211/: Use time_* macros John W. Linville
2008-03-17 23:31 ` [PATCH] arch/powerpc/platforms/iseries/pci.c: " Stephen Rothwell
2008-03-17 15:40 ` [PATCH] arch/parisc/kernel/unaligned.c: " Kyle McMartin
2008-03-17 9:59 ` [PATCH] arch/ia64/kernel/: " KOSAKI Motohiro
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=1205746593-24820-5-git-send-email-caglar@pardus.org.tr \
--to=caglar@pardus.org.tr \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--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
Powered by JetHome