Commit a76037ff authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Martin K. Petersen

scsi: pm8001: switch to pci_irq_alloc_vectors

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarJack Wang <jinpu.wang@profitbricks.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 556e26a7
...@@ -888,7 +888,6 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha) ...@@ -888,7 +888,6 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
u32 i = 0, j = 0; u32 i = 0, j = 0;
u32 number_of_intr; u32 number_of_intr;
int flag = 0; int flag = 0;
u32 max_entry;
int rc; int rc;
static char intr_drvname[PM8001_MAX_MSIX_VEC][sizeof(DRV_NAME)+3]; static char intr_drvname[PM8001_MAX_MSIX_VEC][sizeof(DRV_NAME)+3];
...@@ -900,18 +899,14 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha) ...@@ -900,18 +899,14 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
flag &= ~IRQF_SHARED; flag &= ~IRQF_SHARED;
} }
max_entry = sizeof(pm8001_ha->msix_entries) / rc = pci_alloc_irq_vectors(pm8001_ha->pdev, number_of_intr,
sizeof(pm8001_ha->msix_entries[0]); number_of_intr, PCI_IRQ_MSIX);
for (i = 0; i < max_entry ; i++) if (rc < 0)
pm8001_ha->msix_entries[i].entry = i;
rc = pci_enable_msix_exact(pm8001_ha->pdev, pm8001_ha->msix_entries,
number_of_intr);
pm8001_ha->number_of_intr = number_of_intr;
if (rc)
return rc; return rc;
pm8001_ha->number_of_intr = number_of_intr;
PM8001_INIT_DBG(pm8001_ha, pm8001_printk( PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
"pci_enable_msix_exact request ret:%d no of intr %d\n", "pci_alloc_irq_vectors request ret:%d no of intr %d\n",
rc, pm8001_ha->number_of_intr)); rc, pm8001_ha->number_of_intr));
for (i = 0; i < number_of_intr; i++) { for (i = 0; i < number_of_intr; i++) {
...@@ -920,15 +915,15 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha) ...@@ -920,15 +915,15 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
pm8001_ha->irq_vector[i].irq_id = i; pm8001_ha->irq_vector[i].irq_id = i;
pm8001_ha->irq_vector[i].drv_inst = pm8001_ha; pm8001_ha->irq_vector[i].drv_inst = pm8001_ha;
rc = request_irq(pm8001_ha->msix_entries[i].vector, rc = request_irq(pci_irq_vector(pm8001_ha->pdev, i),
pm8001_interrupt_handler_msix, flag, pm8001_interrupt_handler_msix, flag,
intr_drvname[i], &(pm8001_ha->irq_vector[i])); intr_drvname[i], &(pm8001_ha->irq_vector[i]));
if (rc) { if (rc) {
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
free_irq(pm8001_ha->msix_entries[j].vector, free_irq(pci_irq_vector(pm8001_ha->pdev, i),
&(pm8001_ha->irq_vector[i])); &(pm8001_ha->irq_vector[i]));
} }
pci_disable_msix(pm8001_ha->pdev); pci_free_irq_vectors(pm8001_ha->pdev);
break; break;
} }
} }
...@@ -1102,11 +1097,10 @@ static void pm8001_pci_remove(struct pci_dev *pdev) ...@@ -1102,11 +1097,10 @@ static void pm8001_pci_remove(struct pci_dev *pdev)
#ifdef PM8001_USE_MSIX #ifdef PM8001_USE_MSIX
for (i = 0; i < pm8001_ha->number_of_intr; i++) for (i = 0; i < pm8001_ha->number_of_intr; i++)
synchronize_irq(pm8001_ha->msix_entries[i].vector); synchronize_irq(pci_irq_vector(pdev, i));
for (i = 0; i < pm8001_ha->number_of_intr; i++) for (i = 0; i < pm8001_ha->number_of_intr; i++)
free_irq(pm8001_ha->msix_entries[i].vector, free_irq(pci_irq_vector(pdev, i), &pm8001_ha->irq_vector[i]);
&(pm8001_ha->irq_vector[i])); pci_free_irq_vectors(pdev);
pci_disable_msix(pdev);
#else #else
free_irq(pm8001_ha->irq, sha); free_irq(pm8001_ha->irq, sha);
#endif #endif
...@@ -1152,11 +1146,10 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -1152,11 +1146,10 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state)
PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha); PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha);
#ifdef PM8001_USE_MSIX #ifdef PM8001_USE_MSIX
for (i = 0; i < pm8001_ha->number_of_intr; i++) for (i = 0; i < pm8001_ha->number_of_intr; i++)
synchronize_irq(pm8001_ha->msix_entries[i].vector); synchronize_irq(pci_irq_vector(pdev, i));
for (i = 0; i < pm8001_ha->number_of_intr; i++) for (i = 0; i < pm8001_ha->number_of_intr; i++)
free_irq(pm8001_ha->msix_entries[i].vector, free_irq(pci_irq_vector(pdev, i), &pm8001_ha->irq_vector[i]);
&(pm8001_ha->irq_vector[i])); pci_free_irq_vectors(pdev);
pci_disable_msix(pdev);
#else #else
free_irq(pm8001_ha->irq, sha); free_irq(pm8001_ha->irq, sha);
#endif #endif
......
...@@ -521,8 +521,6 @@ struct pm8001_hba_info { ...@@ -521,8 +521,6 @@ struct pm8001_hba_info {
struct pm8001_device *devices; struct pm8001_device *devices;
struct pm8001_ccb_info *ccb_info; struct pm8001_ccb_info *ccb_info;
#ifdef PM8001_USE_MSIX #ifdef PM8001_USE_MSIX
struct msix_entry msix_entries[PM8001_MAX_MSIX_VEC];
/*for msi-x interrupt*/
int number_of_intr;/*will be used in remove()*/ int number_of_intr;/*will be used in remove()*/
#endif #endif
#ifdef PM8001_USE_TASKLET #ifdef PM8001_USE_TASKLET
......
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