aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic94xx/aic94xx_tmf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aic94xx/aic94xx_tmf.c')
-rw-r--r--drivers/scsi/aic94xx/aic94xx_tmf.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_tmf.c b/drivers/scsi/aic94xx/aic94xx_tmf.c
index 9a14a6d97275..c0d0b7d7a8ce 100644
--- a/drivers/scsi/aic94xx/aic94xx_tmf.c
+++ b/drivers/scsi/aic94xx/aic94xx_tmf.c
@@ -290,6 +290,7 @@ static void asd_tmf_tasklet_complete(struct asd_ascb *ascb,
290static inline int asd_clear_nexus(struct sas_task *task) 290static inline int asd_clear_nexus(struct sas_task *task)
291{ 291{
292 int res = TMF_RESP_FUNC_FAILED; 292 int res = TMF_RESP_FUNC_FAILED;
293 int leftover;
293 struct asd_ascb *tascb = task->lldd_task; 294 struct asd_ascb *tascb = task->lldd_task;
294 unsigned long flags; 295 unsigned long flags;
295 296
@@ -298,10 +299,12 @@ static inline int asd_clear_nexus(struct sas_task *task)
298 res = asd_clear_nexus_tag(task); 299 res = asd_clear_nexus_tag(task);
299 else 300 else
300 res = asd_clear_nexus_index(task); 301 res = asd_clear_nexus_index(task);
301 wait_for_completion_timeout(&tascb->completion, 302 leftover = wait_for_completion_timeout(&tascb->completion,
302 AIC94XX_SCB_TIMEOUT); 303 AIC94XX_SCB_TIMEOUT);
303 ASD_DPRINTK("came back from clear nexus\n"); 304 ASD_DPRINTK("came back from clear nexus\n");
304 spin_lock_irqsave(&task->task_state_lock, flags); 305 spin_lock_irqsave(&task->task_state_lock, flags);
306 if (leftover < 1)
307 res = TMF_RESP_FUNC_FAILED;
305 if (task->task_state_flags & SAS_TASK_STATE_DONE) 308 if (task->task_state_flags & SAS_TASK_STATE_DONE)
306 res = TMF_RESP_FUNC_COMPLETE; 309 res = TMF_RESP_FUNC_COMPLETE;
307 spin_unlock_irqrestore(&task->task_state_lock, flags); 310 spin_unlock_irqrestore(&task->task_state_lock, flags);
@@ -350,6 +353,7 @@ int asd_abort_task(struct sas_task *task)
350 unsigned long flags; 353 unsigned long flags;
351 struct asd_ascb *ascb = NULL; 354 struct asd_ascb *ascb = NULL;
352 struct scb *scb; 355 struct scb *scb;
356 int leftover;
353 357
354 spin_lock_irqsave(&task->task_state_lock, flags); 358 spin_lock_irqsave(&task->task_state_lock, flags);
355 if (task->task_state_flags & SAS_TASK_STATE_DONE) { 359 if (task->task_state_flags & SAS_TASK_STATE_DONE) {
@@ -455,9 +459,11 @@ int asd_abort_task(struct sas_task *task)
455 break; 459 break;
456 case TF_TMF_TASK_DONE + 0xFF00: /* done but not reported yet */ 460 case TF_TMF_TASK_DONE + 0xFF00: /* done but not reported yet */
457 res = TMF_RESP_FUNC_FAILED; 461 res = TMF_RESP_FUNC_FAILED;
458 wait_for_completion_timeout(&tascb->completion, 462 leftover = wait_for_completion_timeout(&tascb->completion,
459 AIC94XX_SCB_TIMEOUT); 463 AIC94XX_SCB_TIMEOUT);
460 spin_lock_irqsave(&task->task_state_lock, flags); 464 spin_lock_irqsave(&task->task_state_lock, flags);
465 if (leftover < 1)
466 res = TMF_RESP_FUNC_FAILED;
461 if (task->task_state_flags & SAS_TASK_STATE_DONE) 467 if (task->task_state_flags & SAS_TASK_STATE_DONE)
462 res = TMF_RESP_FUNC_COMPLETE; 468 res = TMF_RESP_FUNC_COMPLETE;
463 spin_unlock_irqrestore(&task->task_state_lock, flags); 469 spin_unlock_irqrestore(&task->task_state_lock, flags);