aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorMarcelo Feitoza Parisi <marcelo@feitoza.com.br>2006-03-28 04:56:47 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 12:16:07 -0500
commit60c904ae5bded8bb71f7bff7d63f2a6959d2a8e4 (patch)
treeaf7593441b9d640302a73a6406218a6b9cdc6aa2 /drivers/scsi
parent9bae1ff3e7926fe5e92db2f3c6d8832f18f777bc (diff)
[PATCH] drivers/scsi/*: use time_after() and friends
They deal with wrapping correctly and are nicer to read. Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: James Bottomley <James.Bottomley@steeleye.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/BusLogic.c3
-rw-r--r--drivers/scsi/osst.c5
-rw-r--r--drivers/scsi/ppa.c3
-rw-r--r--drivers/scsi/qlogicfc.c3
-rw-r--r--drivers/scsi/qlogicpti.c3
5 files changed, 11 insertions, 6 deletions
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 1c459343292b..5bf83cbca868 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -41,6 +41,7 @@
41#include <linux/stat.h> 41#include <linux/stat.h>
42#include <linux/pci.h> 42#include <linux/pci.h>
43#include <linux/spinlock.h> 43#include <linux/spinlock.h>
44#include <linux/jiffies.h>
44#include <scsi/scsicam.h> 45#include <scsi/scsicam.h>
45 46
46#include <asm/dma.h> 47#include <asm/dma.h>
@@ -2896,7 +2897,7 @@ static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRou
2896 */ 2897 */
2897 if (HostAdapter->ActiveCommands[TargetID] == 0) 2898 if (HostAdapter->ActiveCommands[TargetID] == 0)
2898 HostAdapter->LastSequencePoint[TargetID] = jiffies; 2899 HostAdapter->LastSequencePoint[TargetID] = jiffies;
2899 else if (jiffies - HostAdapter->LastSequencePoint[TargetID] > 4 * HZ) { 2900 else if (time_after(jiffies, HostAdapter->LastSequencePoint[TargetID] + 4 * HZ)) {
2900 HostAdapter->LastSequencePoint[TargetID] = jiffies; 2901 HostAdapter->LastSequencePoint[TargetID] = jiffies;
2901 QueueTag = BusLogic_OrderedQueueTag; 2902 QueueTag = BusLogic_OrderedQueueTag;
2902 } 2903 }
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 66ea47a9c53c..e3bd4bc339f4 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -49,6 +49,7 @@ static const char * osst_version = "0.99.4";
49#include <linux/blkdev.h> 49#include <linux/blkdev.h>
50#include <linux/moduleparam.h> 50#include <linux/moduleparam.h>
51#include <linux/delay.h> 51#include <linux/delay.h>
52#include <linux/jiffies.h>
52#include <asm/uaccess.h> 53#include <asm/uaccess.h>
53#include <asm/dma.h> 54#include <asm/dma.h>
54#include <asm/system.h> 55#include <asm/system.h>
@@ -856,7 +857,7 @@ static int osst_wait_frame(struct osst_tape * STp, struct osst_request ** aSRpnt
856 ) && result >= 0) 857 ) && result >= 0)
857 { 858 {
858#if DEBUG 859#if DEBUG
859 if (debugging || jiffies - startwait >= 2*HZ/OSST_POLL_PER_SEC) 860 if (debugging || time_after_eq(jiffies, startwait + 2*HZ/OSST_POLL_PER_SEC))
860 printk (OSST_DEB_MSG 861 printk (OSST_DEB_MSG
861 "%s:D: Succ wait f fr %i (>%i): %i-%i %i (%i): %3li.%li s\n", 862 "%s:D: Succ wait f fr %i (>%i): %i-%i %i (%i): %3li.%li s\n",
862 name, curr, curr+minlast, STp->first_frame_position, 863 name, curr, curr+minlast, STp->first_frame_position,
@@ -867,7 +868,7 @@ static int osst_wait_frame(struct osst_tape * STp, struct osst_request ** aSRpnt
867 return 0; 868 return 0;
868 } 869 }
869#if DEBUG 870#if DEBUG
870 if (jiffies - startwait >= 2*HZ/OSST_POLL_PER_SEC && notyetprinted) 871 if (time_after_eq(jiffies, startwait + 2*HZ/OSST_POLL_PER_SEC) && notyetprinted)
871 { 872 {
872 printk (OSST_DEB_MSG "%s:D: Wait for frame %i (>%i): %i-%i %i (%i)\n", 873 printk (OSST_DEB_MSG "%s:D: Wait for frame %i (>%i): %i-%i %i (%i)\n",
873 name, curr, curr+minlast, STp->first_frame_position, 874 name, curr, curr+minlast, STp->first_frame_position,
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index 05347eed9dd5..fee843fab1c7 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -18,6 +18,7 @@
18#include <linux/parport.h> 18#include <linux/parport.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/jiffies.h>
21#include <asm/io.h> 22#include <asm/io.h>
22 23
23#include <scsi/scsi.h> 24#include <scsi/scsi.h>
@@ -726,7 +727,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
726 retv--; 727 retv--;
727 728
728 if (retv) { 729 if (retv) {
729 if ((jiffies - dev->jstart) > (1 * HZ)) { 730 if (time_after(jiffies, dev->jstart + (1 * HZ))) {
730 printk 731 printk
731 ("ppa: Parallel port cable is unplugged!!\n"); 732 ("ppa: Parallel port cable is unplugged!!\n");
732 ppa_fail(dev, DID_BUS_BUSY); 733 ppa_fail(dev, DID_BUS_BUSY);
diff --git a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c
index 94ef3f08d378..5b15998c71a6 100644
--- a/drivers/scsi/qlogicfc.c
+++ b/drivers/scsi/qlogicfc.c
@@ -61,6 +61,7 @@
61#include <linux/unistd.h> 61#include <linux/unistd.h>
62#include <linux/spinlock.h> 62#include <linux/spinlock.h>
63#include <linux/interrupt.h> 63#include <linux/interrupt.h>
64#include <linux/jiffies.h>
64#include <asm/io.h> 65#include <asm/io.h>
65#include <asm/irq.h> 66#include <asm/irq.h>
66#include "scsi.h" 67#include "scsi.h"
@@ -1325,7 +1326,7 @@ static int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
1325 cmd->control_flags = cpu_to_le16(CFLAG_READ); 1326 cmd->control_flags = cpu_to_le16(CFLAG_READ);
1326 1327
1327 if (Cmnd->device->tagged_supported) { 1328 if (Cmnd->device->tagged_supported) {
1328 if ((jiffies - hostdata->tag_ages[Cmnd->device->id]) > (2 * ISP_TIMEOUT)) { 1329 if (time_after(jiffies, hostdata->tag_ages[Cmnd->device->id] + (2 * ISP_TIMEOUT))) {
1329 cmd->control_flags |= cpu_to_le16(CFLAG_ORDERED_TAG); 1330 cmd->control_flags |= cpu_to_le16(CFLAG_ORDERED_TAG);
1330 hostdata->tag_ages[Cmnd->device->id] = jiffies; 1331 hostdata->tag_ages[Cmnd->device->id] = jiffies;
1331 } else 1332 } else
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 1fd5fc6d0fe3..c7e78dcf09df 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -24,6 +24,7 @@
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/jiffies.h>
27 28
28#include <asm/byteorder.h> 29#include <asm/byteorder.h>
29 30
@@ -1017,7 +1018,7 @@ static inline void cmd_frob(struct Command_Entry *cmd, struct scsi_cmnd *Cmnd,
1017 if (Cmnd->device->tagged_supported) { 1018 if (Cmnd->device->tagged_supported) {
1018 if (qpti->cmd_count[Cmnd->device->id] == 0) 1019 if (qpti->cmd_count[Cmnd->device->id] == 0)
1019 qpti->tag_ages[Cmnd->device->id] = jiffies; 1020 qpti->tag_ages[Cmnd->device->id] = jiffies;
1020 if ((jiffies - qpti->tag_ages[Cmnd->device->id]) > (5*HZ)) { 1021 if (time_after(jiffies, qpti->tag_ages[Cmnd->device->id] + (5*HZ))) {
1021 cmd->control_flags = CFLAG_ORDERED_TAG; 1022 cmd->control_flags = CFLAG_ORDERED_TAG;
1022 qpti->tag_ages[Cmnd->device->id] = jiffies; 1023 qpti->tag_ages[Cmnd->device->id] = jiffies;
1023 } else 1024 } else