summaryrefslogtreecommitdiff
path: root/drivers/scsi/gdth_proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/gdth_proc.c')
-rw-r--r--drivers/scsi/gdth_proc.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
index 59349a316e13..ce0228e26aec 100644
--- a/drivers/scsi/gdth_proc.c
+++ b/drivers/scsi/gdth_proc.c
@@ -748,3 +748,69 @@ static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id)
}
spin_unlock_irqrestore(&ha->smp_lock, flags);
}
+
+static void gdth_stop_timeout(gdth_ha_str *ha, int busnum, int id)
+{
+ ulong flags;
+ Scsi_Cmnd *scp;
+ unchar b, t;
+
+ spin_lock_irqsave(&ha->smp_lock, flags);
+
+ for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
+ struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
+ if (!cmndinfo->internal_command) {
+ b = scp->device->channel;
+ t = scp->device->id;
+ if (t == (unchar)id && b == (unchar)busnum) {
+ TRACE2(("gdth_stop_timeout(): update_timeout()\n"));
+ cmndinfo->timeout = gdth_update_timeout(scp, 0);
+ }
+ }
+ }
+ spin_unlock_irqrestore(&ha->smp_lock, flags);
+}
+
+static void gdth_start_timeout(gdth_ha_str *ha, int busnum, int id)
+{
+ ulong flags;
+ Scsi_Cmnd *scp;
+ unchar b, t;
+
+ spin_lock_irqsave(&ha->smp_lock, flags);
+
+ for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
+ struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
+ if (!cmndinfo->internal_command) {
+ b = scp->device->channel;
+ t = scp->device->id;
+ if (t == (unchar)id && b == (unchar)busnum) {
+ TRACE2(("gdth_start_timeout(): update_timeout()\n"));
+ gdth_update_timeout(scp, cmndinfo->timeout);
+ }
+ }
+ }
+ spin_unlock_irqrestore(&ha->smp_lock, flags);
+}
+
+static int gdth_update_timeout(Scsi_Cmnd *scp, int timeout)
+{
+ int oldto;
+
+ oldto = scp->timeout_per_command;
+ scp->timeout_per_command = timeout;
+
+ if (timeout == 0) {
+ del_timer(&scp->eh_timeout);
+ scp->eh_timeout.data = (unsigned long) NULL;
+ scp->eh_timeout.expires = 0;
+ } else {
+ if (scp->eh_timeout.data != (unsigned long) NULL)
+ del_timer(&scp->eh_timeout);
+ scp->eh_timeout.data = (unsigned long) scp;
+ scp->eh_timeout.expires = jiffies + timeout;
+ add_timer(&scp->eh_timeout);
+ }
+
+ return oldto;
+}