diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2011-05-03 15:53:16 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-05-06 10:23:49 -0400 |
commit | 2b48085f972a761b38cf60c626031a7fdd9e6d55 (patch) | |
tree | 7067ea5a2634e838c57de235d9a7cac7e157d506 /drivers/block/cciss.c | |
parent | abf7966e616ef6e04393ef3678227f77d6179a8a (diff) |
cciss: factor out irq request code
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 55ca1f45c0c7..63fe05af2c5d 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -4719,6 +4719,28 @@ static void cciss_free_cmd_pool(ctlr_info_t *h) | |||
4719 | h->errinfo_pool, h->errinfo_pool_dhandle); | 4719 | h->errinfo_pool, h->errinfo_pool_dhandle); |
4720 | } | 4720 | } |
4721 | 4721 | ||
4722 | static int cciss_request_irq(ctlr_info_t *h, | ||
4723 | irqreturn_t (*msixhandler)(int, void *), | ||
4724 | irqreturn_t (*intxhandler)(int, void *)) | ||
4725 | { | ||
4726 | if (h->msix_vector || h->msi_vector) { | ||
4727 | if (!request_irq(h->intr[PERF_MODE_INT], msixhandler, | ||
4728 | IRQF_DISABLED, h->devname, h)) | ||
4729 | return 0; | ||
4730 | dev_err(&h->pdev->dev, "Unable to get msi irq %d" | ||
4731 | " for %s\n", h->intr[PERF_MODE_INT], | ||
4732 | h->devname); | ||
4733 | return -1; | ||
4734 | } | ||
4735 | |||
4736 | if (!request_irq(h->intr[PERF_MODE_INT], intxhandler, | ||
4737 | IRQF_DISABLED, h->devname, h)) | ||
4738 | return 0; | ||
4739 | dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", | ||
4740 | h->intr[PERF_MODE_INT], h->devname); | ||
4741 | return -1; | ||
4742 | } | ||
4743 | |||
4722 | /* | 4744 | /* |
4723 | * This is it. Find all the controllers and register them. I really hate | 4745 | * This is it. Find all the controllers and register them. I really hate |
4724 | * stealing all these major device numbers. | 4746 | * stealing all these major device numbers. |
@@ -4789,22 +4811,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
4789 | 4811 | ||
4790 | /* make sure the board interrupts are off */ | 4812 | /* make sure the board interrupts are off */ |
4791 | h->access.set_intr_mask(h, CCISS_INTR_OFF); | 4813 | h->access.set_intr_mask(h, CCISS_INTR_OFF); |
4792 | if (h->msi_vector || h->msix_vector) { | 4814 | rc = cciss_request_irq(h, do_cciss_msix_intr, do_cciss_intx); |
4793 | if (request_irq(h->intr[PERF_MODE_INT], | 4815 | if (rc) |
4794 | do_cciss_msix_intr, | 4816 | goto clean2; |
4795 | IRQF_DISABLED, h->devname, h)) { | ||
4796 | dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", | ||
4797 | h->intr[PERF_MODE_INT], h->devname); | ||
4798 | goto clean2; | ||
4799 | } | ||
4800 | } else { | ||
4801 | if (request_irq(h->intr[PERF_MODE_INT], do_cciss_intx, | ||
4802 | IRQF_DISABLED, h->devname, h)) { | ||
4803 | dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", | ||
4804 | h->intr[PERF_MODE_INT], h->devname); | ||
4805 | goto clean2; | ||
4806 | } | ||
4807 | } | ||
4808 | 4817 | ||
4809 | dev_info(&h->pdev->dev, "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n", | 4818 | dev_info(&h->pdev->dev, "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n", |
4810 | h->devname, pdev->device, pci_name(pdev), | 4819 | h->devname, pdev->device, pci_name(pdev), |