[PATCH] drivers/scsi/*: use time_after macro From: Marcelo Feitoza Parisi It deals with wrapping correctly and is nicer to read. Signed-off-by: Marcelo Feitoza Parisi Signed-off-by: Alexey Dobriyan Index: linux-kj/drivers/scsi/BusLogic.c =================================================================== --- linux-kj.orig/drivers/scsi/BusLogic.c 2005-10-01 02:55:25.000000000 +0400 +++ linux-kj/drivers/scsi/BusLogic.c 2005-10-01 02:57:15.000000000 +0400 @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -2896,7 +2897,8 @@ static int BusLogic_QueueCommand(struct */ if (HostAdapter->ActiveCommands[TargetID] == 0) HostAdapter->LastSequencePoint[TargetID] = jiffies; - else if (jiffies - HostAdapter->LastSequencePoint[TargetID] > 4 * HZ) { + else if (time_after(jiffies, + HostAdapter->LastSequencePoint[TargetID] + 4 * HZ)) { HostAdapter->LastSequencePoint[TargetID] = jiffies; QueueTag = BusLogic_OrderedQueueTag; } Index: linux-kj/drivers/scsi/osst.c =================================================================== --- linux-kj.orig/drivers/scsi/osst.c 2005-10-01 02:49:48.000000000 +0400 +++ linux-kj/drivers/scsi/osst.c 2005-10-01 02:57:15.000000000 +0400 @@ -50,6 +50,7 @@ static const char * osst_version = "0.99 #include #include #include +#include #include #include #include @@ -803,7 +804,7 @@ static int osst_wait_frame(struct osst_t ) && result >= 0) { #if DEBUG - if (debugging || jiffies - startwait >= 2*HZ/OSST_POLL_PER_SEC) + if (debugging || time_after_eq(jiffies, startwait + 2*HZ/OSST_POLL_PER_SEC)) printk (OSST_DEB_MSG "%s:D: Succ wait f fr %i (>%i): %i-%i %i (%i): %3li.%li s\n", name, curr, curr+minlast, STp->first_frame_position, @@ -814,7 +815,7 @@ static int osst_wait_frame(struct osst_t return 0; } #if DEBUG - if (jiffies - startwait >= 2*HZ/OSST_POLL_PER_SEC && notyetprinted) + if (time_after_eq(jiffies, startwait + 2*HZ/OSST_POLL_PER_SEC) && notyetprinted) { printk (OSST_DEB_MSG "%s:D: Wait for frame %i (>%i): %i-%i %i (%i)\n", name, curr, curr+minlast, STp->first_frame_position, Index: linux-kj/drivers/scsi/ppa.c =================================================================== --- linux-kj.orig/drivers/scsi/ppa.c 2005-10-01 02:49:46.000000000 +0400 +++ linux-kj/drivers/scsi/ppa.c 2005-10-01 02:57:15.000000000 +0400 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -726,7 +727,7 @@ static int ppa_engine(ppa_struct *dev, s retv--; if (retv) { - if ((jiffies - dev->jstart) > (1 * HZ)) { + if (time_after(jiffies, dev->jstart + 1 * HZ)) { printk ("ppa: Parallel port cable is unplugged!!\n"); ppa_fail(dev, DID_BUS_BUSY); Index: linux-kj/drivers/scsi/qlogicpti.c =================================================================== --- linux-kj.orig/drivers/scsi/qlogicpti.c 2005-10-01 02:49:46.000000000 +0400 +++ linux-kj/drivers/scsi/qlogicpti.c 2005-10-01 02:57:15.000000000 +0400 @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -1017,7 +1018,8 @@ static inline void cmd_frob(struct Comma if (Cmnd->device->tagged_supported) { if (qpti->cmd_count[Cmnd->device->id] == 0) qpti->tag_ages[Cmnd->device->id] = jiffies; - if ((jiffies - qpti->tag_ages[Cmnd->device->id]) > (5*HZ)) { + if (time_after(jiffies, + qpti->tag_ages[Cmnd->device->id] + 5*HZ)) { cmd->control_flags = CFLAG_ORDERED_TAG; qpti->tag_ages[Cmnd->device->id] = jiffies; } else