aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hpsa.c
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2011-05-03 15:59:25 -0400
committerJames Bottomley <jbottomley@parallels.com>2011-05-17 03:05:20 -0400
commit0ae01a32cb4a89ef0ed49bb6f49bd5830b13ab3e (patch)
treedfeb2a37f06b94415f5e671e74e09454b65006a3 /drivers/scsi/hpsa.c
parent2e9d1b3626c4383362df30bb853a1b57c2798300 (diff)
[SCSI] hpsa: factor out irq request code
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <jbottomley@parallels.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r--drivers/scsi/hpsa.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 7336f3ce0d10..97db2e5d6d16 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3881,6 +3881,26 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h)
3881 h->errinfo_pool_dhandle); 3881 h->errinfo_pool_dhandle);
3882} 3882}
3883 3883
3884static int hpsa_request_irq(struct ctlr_info *h,
3885 irqreturn_t (*msixhandler)(int, void *),
3886 irqreturn_t (*intxhandler)(int, void *))
3887{
3888 int rc;
3889
3890 if (h->msix_vector || h->msi_vector)
3891 rc = request_irq(h->intr[h->intr_mode], msixhandler,
3892 IRQF_DISABLED, h->devname, h);
3893 else
3894 rc = request_irq(h->intr[h->intr_mode], intxhandler,
3895 IRQF_DISABLED, h->devname, h);
3896 if (rc) {
3897 dev_err(&h->pdev->dev, "unable to get irq %d for %s\n",
3898 h->intr[h->intr_mode], h->devname);
3899 return -ENODEV;
3900 }
3901 return 0;
3902}
3903
3884static int __devinit hpsa_init_one(struct pci_dev *pdev, 3904static int __devinit hpsa_init_one(struct pci_dev *pdev,
3885 const struct pci_device_id *ent) 3905 const struct pci_device_id *ent)
3886{ 3906{
@@ -3936,18 +3956,8 @@ static int __devinit hpsa_init_one(struct pci_dev *pdev,
3936 /* make sure the board interrupts are off */ 3956 /* make sure the board interrupts are off */
3937 h->access.set_intr_mask(h, HPSA_INTR_OFF); 3957 h->access.set_intr_mask(h, HPSA_INTR_OFF);
3938 3958
3939 if (h->msix_vector || h->msi_vector) 3959 if (hpsa_request_irq(h, do_hpsa_intr_msi, do_hpsa_intr_intx))
3940 rc = request_irq(h->intr[h->intr_mode], do_hpsa_intr_msi,
3941 IRQF_DISABLED, h->devname, h);
3942 else
3943 rc = request_irq(h->intr[h->intr_mode], do_hpsa_intr_intx,
3944 IRQF_DISABLED, h->devname, h);
3945 if (rc) {
3946 dev_err(&pdev->dev, "unable to get irq %d for %s\n",
3947 h->intr[h->intr_mode], h->devname);
3948 goto clean2; 3960 goto clean2;
3949 }
3950
3951 dev_info(&pdev->dev, "%s: <0x%x> at IRQ %d%s using DAC\n", 3961 dev_info(&pdev->dev, "%s: <0x%x> at IRQ %d%s using DAC\n",
3952 h->devname, pdev->device, 3962 h->devname, pdev->device,
3953 h->intr[h->intr_mode], dac ? "" : " not"); 3963 h->intr[h->intr_mode], dac ? "" : " not");