summaryrefslogtreecommitdiff
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorSawan Chandak <sawan.chandak@qlogic.com>2014-04-12 00:54:38 +0400
committerChristoph Hellwig <hch@lst.de>2014-05-19 15:31:04 +0400
commit638a1a01d36a1496244fb1367c5b79c6fcd62d3d (patch)
treecf6099e476a848d0b4a3f44d4e7bb613aacab56a /drivers/scsi/qla2xxx
parent7c6300e3941da8e84bf5faf1358bf3909c5ef97e (diff)
downloadlinux-638a1a01d36a1496244fb1367c5b79c6fcd62d3d.tar.xz
qla2xxx: Delay driver unload if there is any pending activity going on.
Signed-off-by: Sawan Chandak <sawan.chandak@qlogic.com> Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index d1a76a6da6e2..575404fbcbec 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -844,6 +844,28 @@ qla2x00_wait_for_hba_online(scsi_qla_host_t *vha)
}
/*
+ * qla2x00_wait_for_hba_ready
+ * Wait till the HBA is ready before doing driver unload
+ *
+ * Input:
+ * ha - pointer to host adapter structure
+ *
+ * Note:
+ * Does context switching-Release SPIN_LOCK
+ * (if any) before calling this routine.
+ *
+ */
+static void
+qla2x00_wait_for_hba_ready(scsi_qla_host_t *vha)
+{
+ struct qla_hw_data *ha = vha->hw;
+
+ while ((!(vha->flags.online) || ha->dpc_active ||
+ ha->flags.mbox_busy))
+ msleep(1000);
+}
+
+/*
* qla2x00_wait_for_reset_ready
* Wait till the HBA is online after going through
* <= MAX_RETRIES_OF_ISP_ABORT or
@@ -3161,6 +3183,8 @@ qla2x00_remove_one(struct pci_dev *pdev)
base_vha = pci_get_drvdata(pdev);
ha = base_vha->hw;
+ qla2x00_wait_for_hba_ready(base_vha);
+
set_bit(UNLOADING, &base_vha->dpc_flags);
if (IS_QLAFX00(ha))