Skip to content

Commit 9307b57

Browse files
caglar10urJeff Garzik
authored andcommitted
drivers/net/arcnet/arcnet.c: use time_* macros
The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values. So use the time_after() macro, defined in linux/jiffies.h, which deals with wrapping correctly. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: S.Caglar Onur <caglar@pardus.org.tr> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
1 parent ac4bed1 commit 9307b57

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎drivers/net/arcnet/arcnet.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
940940

941941
/* is the RECON info empty or old? */
942942
if (!lp->first_recon || !lp->last_recon ||
943-
jiffies - lp->last_recon > HZ * 10) {
943+
time_after(jiffies, lp->last_recon + HZ * 10)) {
944944
if (lp->network_down)
945945
BUGMSG(D_NORMAL, "reconfiguration detected: cabling restored?\n");
946946
lp->first_recon = lp->last_recon = jiffies;
@@ -974,7 +974,8 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
974974
lp->num_recons = 1;
975975
}
976976
}
977-
} else if (lp->network_down && jiffies - lp->last_recon > HZ * 10) {
977+
} else if (lp->network_down &&
978+
time_after(jiffies, lp->last_recon + HZ * 10)) {
978979
if (lp->network_down)
979980
BUGMSG(D_NORMAL, "cabling restored?\n");
980981
lp->first_recon = lp->last_recon = 0;

‎include/linux/arcdevice.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ struct arcnet_local {
283283
int next_buf, first_free_buf;
284284

285285
/* network "reconfiguration" handling */
286-
time_t first_recon, /* time of "first" RECON message to count */
287-
last_recon; /* time of most recent RECON */
286+
unsigned long first_recon; /* time of "first" RECON message to count */
287+
unsigned long last_recon; /* time of most recent RECON */
288288
int num_recons; /* number of RECONs between first and last. */
289289
bool network_down; /* do we think the network is down? */
290290

0 commit comments

Comments
 (0)