Skip to content

Commit

Permalink
net: 8390: use time_after() for time comparison
Browse files Browse the repository at this point in the history
To be future-proof and for better readability the time comparisons are modified
to use time_after() instead of raw math.

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Manuel Schölling authored and David S. Miller committed May 19, 2014
1 parent da26a62 commit 03b8dcb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/8390/ax88796.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static void ax_reset_8390(struct net_device *dev)

/* This check _should_not_ be necessary, omit eventually. */
while ((ei_inb(addr + EN0_ISR) & ENISR_RESET) == 0) {
if (jiffies - reset_start_time > 2 * HZ / 100) {
if (time_after(jiffies, reset_start_time + 2 * HZ / 100)) {
netdev_warn(dev, "%s: did not complete.\n", __func__);
break;
}
Expand Down Expand Up @@ -293,7 +293,7 @@ static void ax_block_output(struct net_device *dev, int count,
dma_start = jiffies;

while ((ei_inb(nic_base + EN0_ISR) & ENISR_RDC) == 0) {
if (jiffies - dma_start > 2 * HZ / 100) { /* 20ms */
if (time_after(jiffies, dma_start + 2 * HZ / 100)) { /* 20ms */
netdev_warn(dev, "timeout waiting for Tx RDC.\n");
ax_reset_8390(dev);
ax_NS8390_init(dev, 1);
Expand Down

0 comments on commit 03b8dcb

Please sign in to comment.