1 From 5eb36a6b9508da442aac80f4df23e3951bbfa7aa Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= <kabel@kernel.org>
3 Date: Mon, 10 Jan 2022 00:03:41 +0100
4 Subject: [PATCH] PCI: aardvark: Make MSI irq_chip structures static driver
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 Marc Zyngier says [1] that we should use struct irq_chip as a global
11 static struct in the driver. Even though the structure currently
12 contains a dynamic member (parent_device), Marc says [2] that he plans
13 to kill it and make the structure completely static.
15 Convert Aardvark's priv->msi_bottom_irq_chip and priv->msi_irq_chip to
16 static driver structure.
18 [1] https://lore.kernel.org/linux-pci/877dbcvngf.wl-maz@kernel.org/
19 [2] https://lore.kernel.org/linux-pci/874k6gvkhz.wl-maz@kernel.org/
21 Signed-off-by: Marek BehĂșn <kabel@kernel.org>
23 drivers/pci/controller/pci-aardvark.c | 26 ++++++++++++--------------
24 1 file changed, 12 insertions(+), 14 deletions(-)
26 --- a/drivers/pci/controller/pci-aardvark.c
27 +++ b/drivers/pci/controller/pci-aardvark.c
28 @@ -281,8 +281,6 @@ struct advk_pcie {
29 raw_spinlock_t irq_lock;
30 struct irq_domain *msi_domain;
31 struct irq_domain *msi_inner_domain;
32 - struct irq_chip msi_bottom_irq_chip;
33 - struct irq_chip msi_irq_chip;
34 struct msi_domain_info msi_domain_info;
35 DECLARE_BITMAP(msi_used, MSI_IRQ_NUM);
36 struct mutex msi_used_lock;
37 @@ -1201,6 +1199,12 @@ static int advk_msi_set_affinity(struct
41 +static struct irq_chip advk_msi_bottom_irq_chip = {
43 + .irq_compose_msi_msg = advk_msi_irq_compose_msi_msg,
44 + .irq_set_affinity = advk_msi_set_affinity,
47 static int advk_msi_irq_domain_alloc(struct irq_domain *domain,
49 unsigned int nr_irqs, void *args)
50 @@ -1217,7 +1221,7 @@ static int advk_msi_irq_domain_alloc(str
52 for (i = 0; i < nr_irqs; i++)
53 irq_domain_set_info(domain, virq + i, hwirq + i,
54 - &pcie->msi_bottom_irq_chip,
55 + &advk_msi_bottom_irq_chip,
56 domain->host_data, handle_simple_irq,
59 @@ -1287,29 +1291,23 @@ static const struct irq_domain_ops advk_
60 .xlate = irq_domain_xlate_onecell,
63 +static struct irq_chip advk_msi_irq_chip = {
67 static int advk_pcie_init_msi_irq_domain(struct advk_pcie *pcie)
69 struct device *dev = &pcie->pdev->dev;
70 struct device_node *node = dev->of_node;
71 - struct irq_chip *bottom_ic, *msi_ic;
72 struct msi_domain_info *msi_di;
73 phys_addr_t msi_msg_phys;
75 mutex_init(&pcie->msi_used_lock);
77 - bottom_ic = &pcie->msi_bottom_irq_chip;
79 - bottom_ic->name = "MSI";
80 - bottom_ic->irq_compose_msi_msg = advk_msi_irq_compose_msi_msg;
81 - bottom_ic->irq_set_affinity = advk_msi_set_affinity;
83 - msi_ic = &pcie->msi_irq_chip;
84 - msi_ic->name = "advk-MSI";
86 msi_di = &pcie->msi_domain_info;
87 msi_di->flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
88 MSI_FLAG_MULTI_PCI_MSI;
89 - msi_di->chip = msi_ic;
90 + msi_di->chip = &advk_msi_irq_chip;
92 msi_msg_phys = virt_to_phys(&pcie->msi_msg);