PCI: epf-test: Simplify pci_epf_test_raise_irq()
Change the interface of the function pci_epf_test_raise_irq() to directly pass a pointer to the struct pci_epf_test_reg defining the test being executed. This avoids the need for grabbing this pointer using the register BAR address and simplifies the call sites as the IRQ type and IRQ numbers do not have to be passed as arguments. Link: https://lore.kernel.org/r/20230415023542.77601-8-dlemoal@kernel.org Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
This commit is contained in:
parent
62d48ec7ef
commit
5444737e16
|
@ -607,29 +607,27 @@ err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pci_epf_test_raise_irq(struct pci_epf_test *epf_test, u8 irq_type,
|
static void pci_epf_test_raise_irq(struct pci_epf_test *epf_test,
|
||||||
u16 irq)
|
struct pci_epf_test_reg *reg)
|
||||||
{
|
{
|
||||||
struct pci_epf *epf = epf_test->epf;
|
struct pci_epf *epf = epf_test->epf;
|
||||||
struct device *dev = &epf->dev;
|
struct device *dev = &epf->dev;
|
||||||
struct pci_epc *epc = epf->epc;
|
struct pci_epc *epc = epf->epc;
|
||||||
enum pci_barno test_reg_bar = epf_test->test_reg_bar;
|
|
||||||
struct pci_epf_test_reg *reg = epf_test->reg[test_reg_bar];
|
|
||||||
|
|
||||||
reg->status |= STATUS_IRQ_RAISED;
|
reg->status |= STATUS_IRQ_RAISED;
|
||||||
|
|
||||||
switch (irq_type) {
|
switch (reg->irq_type) {
|
||||||
case IRQ_TYPE_LEGACY:
|
case IRQ_TYPE_LEGACY:
|
||||||
pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no,
|
pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no,
|
||||||
PCI_EPC_IRQ_LEGACY, 0);
|
PCI_EPC_IRQ_LEGACY, 0);
|
||||||
break;
|
break;
|
||||||
case IRQ_TYPE_MSI:
|
case IRQ_TYPE_MSI:
|
||||||
pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no,
|
pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no,
|
||||||
PCI_EPC_IRQ_MSI, irq);
|
PCI_EPC_IRQ_MSI, reg->irq_number);
|
||||||
break;
|
break;
|
||||||
case IRQ_TYPE_MSIX:
|
case IRQ_TYPE_MSIX:
|
||||||
pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no,
|
pci_epc_raise_irq(epc, epf->func_no, epf->vfunc_no,
|
||||||
PCI_EPC_IRQ_MSIX, irq);
|
PCI_EPC_IRQ_MSIX, reg->irq_number);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(dev, "Failed to raise IRQ, unknown type\n");
|
dev_err(dev, "Failed to raise IRQ, unknown type\n");
|
||||||
|
@ -675,8 +673,7 @@ static void pci_epf_test_cmd_handler(struct work_struct *work)
|
||||||
reg->status |= STATUS_WRITE_FAIL;
|
reg->status |= STATUS_WRITE_FAIL;
|
||||||
else
|
else
|
||||||
reg->status |= STATUS_WRITE_SUCCESS;
|
reg->status |= STATUS_WRITE_SUCCESS;
|
||||||
pci_epf_test_raise_irq(epf_test, reg->irq_type,
|
pci_epf_test_raise_irq(epf_test, reg);
|
||||||
reg->irq_number);
|
|
||||||
goto reset_handler;
|
goto reset_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,8 +683,7 @@ static void pci_epf_test_cmd_handler(struct work_struct *work)
|
||||||
reg->status |= STATUS_READ_SUCCESS;
|
reg->status |= STATUS_READ_SUCCESS;
|
||||||
else
|
else
|
||||||
reg->status |= STATUS_READ_FAIL;
|
reg->status |= STATUS_READ_FAIL;
|
||||||
pci_epf_test_raise_irq(epf_test, reg->irq_type,
|
pci_epf_test_raise_irq(epf_test, reg);
|
||||||
reg->irq_number);
|
|
||||||
goto reset_handler;
|
goto reset_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,8 +693,7 @@ static void pci_epf_test_cmd_handler(struct work_struct *work)
|
||||||
reg->status |= STATUS_COPY_SUCCESS;
|
reg->status |= STATUS_COPY_SUCCESS;
|
||||||
else
|
else
|
||||||
reg->status |= STATUS_COPY_FAIL;
|
reg->status |= STATUS_COPY_FAIL;
|
||||||
pci_epf_test_raise_irq(epf_test, reg->irq_type,
|
pci_epf_test_raise_irq(epf_test, reg);
|
||||||
reg->irq_number);
|
|
||||||
goto reset_handler;
|
goto reset_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue