Skip to content

Commit d4078c8

Browse files
mindachen1987bjorn-helgaas
authored andcommitted
PCI: microchip: Add num_events field to struct plda_pcie_rp
The number of events is different across platforms. In order to share interrupt processing code, add a variable that defines the number of events so that it can be set per-platform instead of hardcoding it. Link: https://lore.kernel.org/linux-pci/[email protected] Signed-off-by: Minda Chen <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Conor Dooley <[email protected]>
1 parent f966c02 commit d4078c8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

drivers/pci/controller/plda/pcie-microchip-host.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ static void plda_handle_event(struct irq_desc *desc)
653653

654654
events = mc_get_events(port);
655655

656-
for_each_set_bit(bit, &events, NUM_EVENTS)
656+
for_each_set_bit(bit, &events, port->num_events)
657657
generic_handle_domain_irq(port->event_domain, bit);
658658

659659
chained_irq_exit(chip, desc);
@@ -816,7 +816,8 @@ static int plda_pcie_init_irq_domains(struct plda_pcie_rp *port)
816816
return -EINVAL;
817817
}
818818

819-
port->event_domain = irq_domain_add_linear(pcie_intc_node, NUM_EVENTS,
819+
port->event_domain = irq_domain_add_linear(pcie_intc_node,
820+
port->num_events,
820821
&plda_event_domain_ops,
821822
port);
822823
if (!port->event_domain) {
@@ -920,7 +921,7 @@ static int plda_init_interrupts(struct platform_device *pdev, struct plda_pcie_r
920921
if (irq < 0)
921922
return -ENODEV;
922923

923-
for (i = 0; i < NUM_EVENTS; i++) {
924+
for (i = 0; i < port->num_events; i++) {
924925
event_irq = irq_create_mapping(port->event_domain, i);
925926
if (!event_irq) {
926927
dev_err(dev, "failed to map hwirq %d\n", i);
@@ -1011,6 +1012,7 @@ static int mc_host_probe(struct platform_device *pdev)
10111012

10121013
bridge_base_addr = port->axi_base_addr + MC_PCIE_BRIDGE_ADDR;
10131014
plda->bridge_addr = bridge_base_addr;
1015+
plda->num_events = NUM_EVENTS;
10141016

10151017
/* Allow enabling MSI by disabling MSI-X */
10161018
val = readl(bridge_base_addr + PCIE_PCI_IRQ_DW0);

drivers/pci/controller/plda/pcie-plda.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ struct plda_pcie_rp {
124124
raw_spinlock_t lock;
125125
struct plda_msi msi;
126126
void __iomem *bridge_addr;
127+
int num_events;
127128
};
128129

129130
void plda_pcie_setup_window(void __iomem *bridge_base_addr, u32 index,

0 commit comments

Comments
 (0)