b7d4108893607f856aadcd1f4d84627823f280fc
[openwrt/staging/dangole.git] /
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
5 structures
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
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.
14
15 Convert Aardvark's priv->msi_bottom_irq_chip and priv->msi_irq_chip to
16 static driver structure.
17
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/
20
21 Signed-off-by: Marek BehĂșn <kabel@kernel.org>
22 ---
23 drivers/pci/controller/pci-aardvark.c | 26 ++++++++++++--------------
24 1 file changed, 12 insertions(+), 14 deletions(-)
25
26 diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
27 index 4be05b52d835..c7bd6b123857 100644
28 --- a/drivers/pci/controller/pci-aardvark.c
29 +++ b/drivers/pci/controller/pci-aardvark.c
30 @@ -281,8 +281,6 @@ struct advk_pcie {
31 raw_spinlock_t irq_lock;
32 struct irq_domain *msi_domain;
33 struct irq_domain *msi_inner_domain;
34 - struct irq_chip msi_bottom_irq_chip;
35 - struct irq_chip msi_irq_chip;
36 struct msi_domain_info msi_domain_info;
37 DECLARE_BITMAP(msi_used, MSI_IRQ_NUM);
38 struct mutex msi_used_lock;
39 @@ -1197,6 +1195,12 @@ static int advk_msi_set_affinity(struct irq_data *irq_data,
40 return -EINVAL;
41 }
42
43 +static struct irq_chip advk_msi_bottom_irq_chip = {
44 + .name = "MSI",
45 + .irq_compose_msi_msg = advk_msi_irq_compose_msi_msg,
46 + .irq_set_affinity = advk_msi_set_affinity,
47 +};
48 +
49 static int advk_msi_irq_domain_alloc(struct irq_domain *domain,
50 unsigned int virq,
51 unsigned int nr_irqs, void *args)
52 @@ -1213,7 +1217,7 @@ static int advk_msi_irq_domain_alloc(struct irq_domain *domain,
53
54 for (i = 0; i < nr_irqs; i++)
55 irq_domain_set_info(domain, virq + i, hwirq + i,
56 - &pcie->msi_bottom_irq_chip,
57 + &advk_msi_bottom_irq_chip,
58 domain->host_data, handle_simple_irq,
59 NULL, NULL);
60
61 @@ -1283,29 +1287,23 @@ static const struct irq_domain_ops advk_pcie_irq_domain_ops = {
62 .xlate = irq_domain_xlate_onecell,
63 };
64
65 +static struct irq_chip advk_msi_irq_chip = {
66 + .name = "advk-MSI",
67 +};
68 +
69 static int advk_pcie_init_msi_irq_domain(struct advk_pcie *pcie)
70 {
71 struct device *dev = &pcie->pdev->dev;
72 struct device_node *node = dev->of_node;
73 - struct irq_chip *bottom_ic, *msi_ic;
74 struct msi_domain_info *msi_di;
75 phys_addr_t msi_msg_phys;
76
77 mutex_init(&pcie->msi_used_lock);
78
79 - bottom_ic = &pcie->msi_bottom_irq_chip;
80 -
81 - bottom_ic->name = "MSI";
82 - bottom_ic->irq_compose_msi_msg = advk_msi_irq_compose_msi_msg;
83 - bottom_ic->irq_set_affinity = advk_msi_set_affinity;
84 -
85 - msi_ic = &pcie->msi_irq_chip;
86 - msi_ic->name = "advk-MSI";
87 -
88 msi_di = &pcie->msi_domain_info;
89 msi_di->flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
90 MSI_FLAG_MULTI_PCI_MSI;
91 - msi_di->chip = msi_ic;
92 + msi_di->chip = &advk_msi_irq_chip;
93
94 msi_msg_phys = virt_to_phys(&pcie->msi_msg);
95
96 --
97 2.34.1
98