Skip to content

Commit c917748

Browse files
damien-lemoalmartinkpetersen
authored andcommitted
scsi: pm8001: Setup IRQs on resume
The function pm8001_pci_resume() only calls pm8001_request_irq() without calling pm8001_setup_irq(). This causes the IRQ allocation to fail, which leads all drives being removed from the system. Fix this issue by integrating the code for pm8001_setup_irq() directly inside pm8001_request_irq() so that MSI-X setup is performed both during normal initialization and resume operations. Fixes: dbf9bfe ("[SCSI] pm8001: add SAS/SATA HBA driver") Cc: [email protected] Signed-off-by: Damien Le Moal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Jack Wang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent c13e733 commit c917748

File tree

1 file changed

+17
-34
lines changed

1 file changed

+17
-34
lines changed

drivers/scsi/pm8001/pm8001_init.c

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ static irqreturn_t pm8001_interrupt_handler_intx(int irq, void *dev_id)
273273
return ret;
274274
}
275275

276-
static u32 pm8001_setup_irq(struct pm8001_hba_info *pm8001_ha);
277276
static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha);
278277

279278
/**
@@ -294,13 +293,6 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
294293
pm8001_dbg(pm8001_ha, INIT, "pm8001_alloc: PHY:%x\n",
295294
pm8001_ha->chip->n_phy);
296295

297-
/* Setup Interrupt */
298-
rc = pm8001_setup_irq(pm8001_ha);
299-
if (rc) {
300-
pm8001_dbg(pm8001_ha, FAIL,
301-
"pm8001_setup_irq failed [ret: %d]\n", rc);
302-
goto err_out;
303-
}
304296
/* Request Interrupt */
305297
rc = pm8001_request_irq(pm8001_ha);
306298
if (rc)
@@ -1031,47 +1023,38 @@ static u32 pm8001_request_msix(struct pm8001_hba_info *pm8001_ha)
10311023
}
10321024
#endif
10331025

1034-
static u32 pm8001_setup_irq(struct pm8001_hba_info *pm8001_ha)
1035-
{
1036-
struct pci_dev *pdev;
1037-
1038-
pdev = pm8001_ha->pdev;
1039-
1040-
#ifdef PM8001_USE_MSIX
1041-
if (pci_find_capability(pdev, PCI_CAP_ID_MSIX))
1042-
return pm8001_setup_msix(pm8001_ha);
1043-
pm8001_dbg(pm8001_ha, INIT, "MSIX not supported!!!\n");
1044-
#endif
1045-
return 0;
1046-
}
1047-
10481026
/**
10491027
* pm8001_request_irq - register interrupt
10501028
* @pm8001_ha: our ha struct.
10511029
*/
10521030
static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha)
10531031
{
1054-
struct pci_dev *pdev;
1032+
struct pci_dev *pdev = pm8001_ha->pdev;
1033+
#ifdef PM8001_USE_MSIX
10551034
int rc;
10561035

1057-
pdev = pm8001_ha->pdev;
1036+
if (pci_find_capability(pdev, PCI_CAP_ID_MSIX)) {
1037+
rc = pm8001_setup_msix(pm8001_ha);
1038+
if (rc) {
1039+
pm8001_dbg(pm8001_ha, FAIL,
1040+
"pm8001_setup_irq failed [ret: %d]\n", rc);
1041+
return rc;
1042+
}
10581043

1059-
#ifdef PM8001_USE_MSIX
1060-
if (pdev->msix_cap && pci_msi_enabled())
1061-
return pm8001_request_msix(pm8001_ha);
1062-
else {
1063-
pm8001_dbg(pm8001_ha, INIT, "MSIX not supported!!!\n");
1064-
goto intx;
1044+
if (pdev->msix_cap && pci_msi_enabled())
1045+
return pm8001_request_msix(pm8001_ha);
10651046
}
1047+
1048+
pm8001_dbg(pm8001_ha, INIT, "MSIX not supported!!!\n");
10661049
#endif
10671050

1068-
intx:
10691051
/* initialize the INT-X interrupt */
10701052
pm8001_ha->irq_vector[0].irq_id = 0;
10711053
pm8001_ha->irq_vector[0].drv_inst = pm8001_ha;
1072-
rc = request_irq(pdev->irq, pm8001_interrupt_handler_intx, IRQF_SHARED,
1073-
pm8001_ha->name, SHOST_TO_SAS_HA(pm8001_ha->shost));
1074-
return rc;
1054+
1055+
return request_irq(pdev->irq, pm8001_interrupt_handler_intx,
1056+
IRQF_SHARED, pm8001_ha->name,
1057+
SHOST_TO_SAS_HA(pm8001_ha->shost));
10751058
}
10761059

10771060
/**

0 commit comments

Comments
 (0)