13734cd8faf2537a9eb19c9b668be37e96030014
[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 --- 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 @@ -1197,6 +1195,12 @@ static int advk_msi_set_affinity(struct
38 return -EINVAL;
39 }
40
41 +static struct irq_chip advk_msi_bottom_irq_chip = {
42 + .name = "MSI",
43 + .irq_compose_msi_msg = advk_msi_irq_compose_msi_msg,
44 + .irq_set_affinity = advk_msi_set_affinity,
45 +};
46 +
47 static int advk_msi_irq_domain_alloc(struct irq_domain *domain,
48 unsigned int virq,
49 unsigned int nr_irqs, void *args)
50 @@ -1213,7 +1217,7 @@ static int advk_msi_irq_domain_alloc(str
51
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,
57 NULL, NULL);
58
59 @@ -1283,29 +1287,23 @@ static const struct irq_domain_ops advk_
60 .xlate = irq_domain_xlate_onecell,
61 };
62
63 +static struct irq_chip advk_msi_irq_chip = {
64 + .name = "advk-MSI",
65 +};
66 +
67 static int advk_pcie_init_msi_irq_domain(struct advk_pcie *pcie)
68 {
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;
74
75 mutex_init(&pcie->msi_used_lock);
76
77 - bottom_ic = &pcie->msi_bottom_irq_chip;
78 -
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;
82 -
83 - msi_ic = &pcie->msi_irq_chip;
84 - msi_ic->name = "advk-MSI";
85 -
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;
91
92 msi_msg_phys = virt_to_phys(&pcie->msi_msg);
93