Commit 272e253c authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi: mpt3sas: simplify _wait_for_commands_to_complete()

Use 'host_busy' instead of counting outstanding commands by hand.
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarSuganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 6da999fe
...@@ -2898,9 +2898,9 @@ _base_recovery_check(struct MPT3SAS_ADAPTER *ioc) ...@@ -2898,9 +2898,9 @@ _base_recovery_check(struct MPT3SAS_ADAPTER *ioc)
* See _wait_for_commands_to_complete() call with regards to this code. * See _wait_for_commands_to_complete() call with regards to this code.
*/ */
if (ioc->shost_recovery && ioc->pending_io_count) { if (ioc->shost_recovery && ioc->pending_io_count) {
if (ioc->pending_io_count == 1) ioc->pending_io_count = atomic_read(&ioc->shost->host_busy);
if (ioc->pending_io_count == 0)
wake_up(&ioc->reset_wq); wake_up(&ioc->reset_wq);
ioc->pending_io_count--;
} }
} }
...@@ -6310,15 +6310,13 @@ _base_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase) ...@@ -6310,15 +6310,13 @@ _base_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase)
* _wait_for_commands_to_complete - reset controller * _wait_for_commands_to_complete - reset controller
* @ioc: Pointer to MPT_ADAPTER structure * @ioc: Pointer to MPT_ADAPTER structure
* *
* This function waiting(3s) for all pending commands to complete * This function is waiting 10s for all pending commands to complete
* prior to putting controller in reset. * prior to putting controller in reset.
*/ */
static void static void
_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc) _wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc)
{ {
u32 ioc_state; u32 ioc_state;
unsigned long flags;
u16 i;
ioc->pending_io_count = 0; ioc->pending_io_count = 0;
...@@ -6327,11 +6325,7 @@ _wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc) ...@@ -6327,11 +6325,7 @@ _wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc)
return; return;
/* pending command count */ /* pending command count */
spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); ioc->pending_io_count = atomic_read(&ioc->shost->host_busy);
for (i = 0; i < ioc->scsiio_depth; i++)
if (ioc->scsi_lookup[i].cb_idx != 0xFF)
ioc->pending_io_count++;
spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
if (!ioc->pending_io_count) if (!ioc->pending_io_count)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment