summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2012-05-01 11:43:21 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-05-10 09:17:51 +0100
commit0097f0f45a70cef4c2af7bdd718fc979be43aecb (patch)
tree7a7e9d20ae23b1c4b2a800200ae034bf34ea87af
parente16a33adc0e59aa96a483fd2923d77e674f013c1 (diff)
downloadlwn-0097f0f45a70cef4c2af7bdd718fc979be43aecb.tar.gz
lwn-0097f0f45a70cef4c2af7bdd718fc979be43aecb.zip
[SCSI] hpsa: factor out hpsa_free_irqs_and_disable_msix
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/hpsa.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 1834373d902f..6440171c2c83 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4487,15 +4487,23 @@ static void free_irqs(struct ctlr_info *h)
free_irq(h->intr[i], &h->q[i]);
}
-static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)
+static void hpsa_free_irqs_and_disable_msix(struct ctlr_info *h)
{
free_irqs(h);
#ifdef CONFIG_PCI_MSI
- if (h->msix_vector)
- pci_disable_msix(h->pdev);
- else if (h->msi_vector)
- pci_disable_msi(h->pdev);
+ if (h->msix_vector) {
+ if (h->pdev->msix_enabled)
+ pci_disable_msix(h->pdev);
+ } else if (h->msi_vector) {
+ if (h->pdev->msi_enabled)
+ pci_disable_msi(h->pdev);
+ }
#endif /* CONFIG_PCI_MSI */
+}
+
+static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)
+{
+ hpsa_free_irqs_and_disable_msix(h);
hpsa_free_sg_chain_blocks(h);
hpsa_free_cmd_pool(h);
kfree(h->blockFetchTable);
@@ -4850,13 +4858,7 @@ static void hpsa_shutdown(struct pci_dev *pdev)
*/
hpsa_flush_cache(h);
h->access.set_intr_mask(h, HPSA_INTR_OFF);
- free_irqs(h);
-#ifdef CONFIG_PCI_MSI
- if (h->msix_vector)
- pci_disable_msix(h->pdev);
- else if (h->msi_vector)
- pci_disable_msi(h->pdev);
-#endif /* CONFIG_PCI_MSI */
+ hpsa_free_irqs_and_disable_msix(h);
}
static void __devexit hpsa_free_device_info(struct ctlr_info *h)