summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2015-10-13 07:51:29 -0400
committerThomas Gleixner <tglx@linutronix.de>2015-10-13 13:01:23 -0400
commit5d4c9bc7767bc86eb9a0e66df783e3fbada7dc97 (patch)
tree0651374fe7c186cbf7825705b3d7f7dd1059f69e
parente50226b4b86755e65aef2129e94d952fee3df722 (diff)
irqdomain: Use irq_domain_get_of_node() instead of direct field access
The struct irq_domain contains a "struct device_node *" field (of_node) that is almost the only link between the irqdomain and the device tree infrastructure. In order to prepare for the removal of that field, convert all users to use irq_domain_get_of_node() instead. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Reviewed-and-tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: <linux-arm-kernel@lists.infradead.org> Cc: Tomasz Nowicki <tomasz.nowicki@linaro.org> Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Cc: Graeme Gregory <graeme@xora.org.uk> Cc: Jake Oshins <jakeo@microsoft.com> Cc: Jiang Liu <jiang.liu@linux.intel.com> Cc: Jason Cooper <jason@lakedaemon.net> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Link: http://lkml.kernel.org/r/1444737105-31573-2-git-send-email-marc.zyngier@arm.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/arm/mach-exynos/suspend.c4
-rw-r--r--arch/arm/mach-imx/gpc.c4
-rw-r--r--arch/arm/mach-omap2/omap-wakeupgen.c4
-rw-r--r--arch/c6x/platforms/megamod-pic.c2
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c4
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c2
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c9
-rw-r--r--arch/powerpc/platforms/pasemi/msi.c6
-rw-r--r--arch/powerpc/platforms/powernv/opal-irqchip.c2
-rw-r--r--arch/powerpc/sysdev/ehv_pic.c3
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c2
-rw-r--r--arch/powerpc/sysdev/i8259.c3
-rw-r--r--arch/powerpc/sysdev/ipic.c3
-rw-r--r--arch/powerpc/sysdev/mpic.c3
-rw-r--r--arch/powerpc/sysdev/mpic_msi.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_ic.c3
-rw-r--r--drivers/gpio/gpio-sodaville.c2
-rw-r--r--drivers/irqchip/exynos-combiner.c2
-rw-r--r--drivers/irqchip/irq-atmel-aic-common.c2
-rw-r--r--drivers/irqchip/irq-crossbar.c4
-rw-r--r--drivers/irqchip/irq-gic-v2m.c2
-rw-r--r--drivers/irqchip/irq-gic-v3-its.c2
-rw-r--r--drivers/irqchip/irq-gic-v3.c2
-rw-r--r--drivers/irqchip/irq-gic.c2
-rw-r--r--drivers/irqchip/irq-hip04.c2
-rw-r--r--drivers/irqchip/irq-imx-gpcv2.c4
-rw-r--r--drivers/irqchip/irq-mtk-sysirq.c2
-rw-r--r--drivers/irqchip/irq-s3c24xx.c4
-rw-r--r--drivers/irqchip/irq-tegra.c4
-rw-r--r--drivers/irqchip/irq-vf610-mscm-ir.c5
-rw-r--r--drivers/spmi/spmi-pmic-arb.c2
-rw-r--r--kernel/irq/irqdomain.c30
32 files changed, 75 insertions, 52 deletions
diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
index e00eb39453a4..af97afc6127a 100644
--- a/arch/arm/mach-exynos/suspend.c
+++ b/arch/arm/mach-exynos/suspend.c
@@ -184,7 +184,7 @@ static int exynos_pmu_domain_xlate(struct irq_domain *domain,
184 unsigned long *out_hwirq, 184 unsigned long *out_hwirq,
185 unsigned int *out_type) 185 unsigned int *out_type)
186{ 186{
187 if (domain->of_node != controller) 187 if (irq_domain_get_of_node(domain) != controller)
188 return -EINVAL; /* Shouldn't happen, really... */ 188 return -EINVAL; /* Shouldn't happen, really... */
189 if (intsize != 3) 189 if (intsize != 3)
190 return -EINVAL; /* Not GIC compliant */ 190 return -EINVAL; /* Not GIC compliant */
@@ -217,7 +217,7 @@ static int exynos_pmu_domain_alloc(struct irq_domain *domain,
217 &exynos_pmu_chip, NULL); 217 &exynos_pmu_chip, NULL);
218 218
219 parent_args = *args; 219 parent_args = *args;
220 parent_args.np = domain->parent->of_node; 220 parent_args.np = irq_domain_get_of_node(domain->parent);
221 return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &parent_args); 221 return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &parent_args);
222} 222}
223 223
diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
index 8c4467fad837..7b32255028fe 100644
--- a/arch/arm/mach-imx/gpc.c
+++ b/arch/arm/mach-imx/gpc.c
@@ -188,7 +188,7 @@ static int imx_gpc_domain_xlate(struct irq_domain *domain,
188 unsigned long *out_hwirq, 188 unsigned long *out_hwirq,
189 unsigned int *out_type) 189 unsigned int *out_type)
190{ 190{
191 if (domain->of_node != controller) 191 if (irq_domain_get_of_node(domain) != controller)
192 return -EINVAL; /* Shouldn't happen, really... */ 192 return -EINVAL; /* Shouldn't happen, really... */
193 if (intsize != 3) 193 if (intsize != 3)
194 return -EINVAL; /* Not GIC compliant */ 194 return -EINVAL; /* Not GIC compliant */
@@ -223,7 +223,7 @@ static int imx_gpc_domain_alloc(struct irq_domain *domain,
223 &imx_gpc_chip, NULL); 223 &imx_gpc_chip, NULL);
224 224
225 parent_args = *args; 225 parent_args = *args;
226 parent_args.np = domain->parent->of_node; 226 parent_args.np = irq_domain_get_of_node(domain->parent);
227 return irq_domain_alloc_irqs_parent(domain, irq, nr_irqs, &parent_args); 227 return irq_domain_alloc_irqs_parent(domain, irq, nr_irqs, &parent_args);
228} 228}
229 229
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
index e1d2e991d17a..f0f7ffd64b1a 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
@@ -406,7 +406,7 @@ static int wakeupgen_domain_xlate(struct irq_domain *domain,
406 unsigned long *out_hwirq, 406 unsigned long *out_hwirq,
407 unsigned int *out_type) 407 unsigned int *out_type)
408{ 408{
409 if (domain->of_node != controller) 409 if (irq_domain_get_of_node(domain) != controller)
410 return -EINVAL; /* Shouldn't happen, really... */ 410 return -EINVAL; /* Shouldn't happen, really... */
411 if (intsize != 3) 411 if (intsize != 3)
412 return -EINVAL; /* Not GIC compliant */ 412 return -EINVAL; /* Not GIC compliant */
@@ -441,7 +441,7 @@ static int wakeupgen_domain_alloc(struct irq_domain *domain,
441 &wakeupgen_chip, NULL); 441 &wakeupgen_chip, NULL);
442 442
443 parent_args = *args; 443 parent_args = *args;
444 parent_args.np = domain->parent->of_node; 444 parent_args.np = irq_domain_get_of_node(domain->parent);
445 return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &parent_args); 445 return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &parent_args);
446} 446}
447 447
diff --git a/arch/c6x/platforms/megamod-pic.c b/arch/c6x/platforms/megamod-pic.c
index ddcb45d7dfa7..43afc03e4125 100644
--- a/arch/c6x/platforms/megamod-pic.c
+++ b/arch/c6x/platforms/megamod-pic.c
@@ -178,7 +178,7 @@ static void __init set_megamod_mux(struct megamod_pic *pic, int src, int output)
178static void __init parse_priority_map(struct megamod_pic *pic, 178static void __init parse_priority_map(struct megamod_pic *pic,
179 int *mapping, int size) 179 int *mapping, int size)
180{ 180{
181 struct device_node *np = pic->irqhost->of_node; 181 struct device_node *np = irq_domain_get_of_node(pic->irqhost);
182 const __be32 *map; 182 const __be32 *map;
183 int i, maplen; 183 int i, maplen;
184 u32 val; 184 u32 val;
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 0352bc8d56b3..4f9eb0576884 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -1094,7 +1094,7 @@ static int octeon_irq_gpio_xlat(struct irq_domain *d,
1094 unsigned int pin; 1094 unsigned int pin;
1095 unsigned int trigger; 1095 unsigned int trigger;
1096 1096
1097 if (d->of_node != node) 1097 if (irq_domain_get_of_node(d) != node)
1098 return -EINVAL; 1098 return -EINVAL;
1099 1099
1100 if (intsize < 2) 1100 if (intsize < 2)
@@ -2163,7 +2163,7 @@ static int octeon_irq_cib_map(struct irq_domain *d,
2163 2163
2164 if (hw >= host_data->max_bits) { 2164 if (hw >= host_data->max_bits) {
2165 pr_err("ERROR: %s mapping %u is to big!\n", 2165 pr_err("ERROR: %s mapping %u is to big!\n",
2166 d->of_node->name, (unsigned)hw); 2166 irq_domain_get_of_node(d)->name, (unsigned)hw);
2167 return -EINVAL; 2167 return -EINVAL;
2168 } 2168 }
2169 2169
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index e0e68a1c0d3c..aed7714495c1 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -327,7 +327,7 @@ static void axon_msi_shutdown(struct platform_device *device)
327 u32 tmp; 327 u32 tmp;
328 328
329 pr_devel("axon_msi: disabling %s\n", 329 pr_devel("axon_msi: disabling %s\n",
330 msic->irq_domain->of_node->full_name); 330 irq_domain_get_of_node(msic->irq_domain)->full_name);
331 tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG); 331 tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG);
332 tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE; 332 tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE;
333 msic_dcr_write(msic, MSIC_CTRL_REG, tmp); 333 msic_dcr_write(msic, MSIC_CTRL_REG, tmp);
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index 9d27de62dc62..54ee5743cb72 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -231,20 +231,23 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
231 const u32 *imap, *tmp; 231 const u32 *imap, *tmp;
232 int imaplen, intsize, unit; 232 int imaplen, intsize, unit;
233 struct device_node *iic; 233 struct device_node *iic;
234 struct device_node *of_node;
235
236 of_node = irq_domain_get_of_node(pic->host);
234 237
235 /* First, we check whether we have a real "interrupts" in the device 238 /* First, we check whether we have a real "interrupts" in the device
236 * tree in case the device-tree is ever fixed 239 * tree in case the device-tree is ever fixed
237 */ 240 */
238 virq = irq_of_parse_and_map(pic->host->of_node, 0); 241 virq = irq_of_parse_and_map(of_node, 0);
239 if (virq) 242 if (virq)
240 return virq; 243 return virq;
241 244
242 /* Now do the horrible hacks */ 245 /* Now do the horrible hacks */
243 tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL); 246 tmp = of_get_property(of_node, "#interrupt-cells", NULL);
244 if (tmp == NULL) 247 if (tmp == NULL)
245 return NO_IRQ; 248 return NO_IRQ;
246 intsize = *tmp; 249 intsize = *tmp;
247 imap = of_get_property(pic->host->of_node, "interrupt-map", &imaplen); 250 imap = of_get_property(of_node, "interrupt-map", &imaplen);
248 if (imap == NULL || imaplen < (intsize + 1)) 251 if (imap == NULL || imaplen < (intsize + 1))
249 return NO_IRQ; 252 return NO_IRQ;
250 iic = of_find_node_by_phandle(imap[intsize]); 253 iic = of_find_node_by_phandle(imap[intsize]);
diff --git a/arch/powerpc/platforms/pasemi/msi.c b/arch/powerpc/platforms/pasemi/msi.c
index b304a9fe55cc..d9af76342d99 100644
--- a/arch/powerpc/platforms/pasemi/msi.c
+++ b/arch/powerpc/platforms/pasemi/msi.c
@@ -144,9 +144,11 @@ int mpic_pasemi_msi_init(struct mpic *mpic)
144{ 144{
145 int rc; 145 int rc;
146 struct pci_controller *phb; 146 struct pci_controller *phb;
147 struct device_node *of_node;
147 148
148 if (!mpic->irqhost->of_node || 149 of_node = irq_domain_get_of_node(mpic->irqhost);
149 !of_device_is_compatible(mpic->irqhost->of_node, 150 if (!of_node ||
151 !of_device_is_compatible(of_node,
150 "pasemi,pwrficient-openpic")) 152 "pasemi,pwrficient-openpic"))
151 return -ENODEV; 153 return -ENODEV;
152 154
diff --git a/arch/powerpc/platforms/powernv/opal-irqchip.c b/arch/powerpc/platforms/powernv/opal-irqchip.c
index 2c91ee7800b9..6ccfb6c1c707 100644
--- a/arch/powerpc/platforms/powernv/opal-irqchip.c
+++ b/arch/powerpc/platforms/powernv/opal-irqchip.c
@@ -137,7 +137,7 @@ static void opal_handle_irq_work(struct irq_work *work)
137static int opal_event_match(struct irq_domain *h, struct device_node *node, 137static int opal_event_match(struct irq_domain *h, struct device_node *node,
138 enum irq_domain_bus_token bus_token) 138 enum irq_domain_bus_token bus_token)
139{ 139{
140 return h->of_node == node; 140 return irq_domain_get_of_node(h) == node;
141} 141}
142 142
143static int opal_event_xlate(struct irq_domain *h, struct device_node *np, 143static int opal_event_xlate(struct irq_domain *h, struct device_node *np,
diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c
index eca0b00794fa..bffcc7a486a1 100644
--- a/arch/powerpc/sysdev/ehv_pic.c
+++ b/arch/powerpc/sysdev/ehv_pic.c
@@ -181,7 +181,8 @@ static int ehv_pic_host_match(struct irq_domain *h, struct device_node *node,
181 enum irq_domain_bus_token bus_token) 181 enum irq_domain_bus_token bus_token)
182{ 182{
183 /* Exact match, unless ehv_pic node is NULL */ 183 /* Exact match, unless ehv_pic node is NULL */
184 return h->of_node == NULL || h->of_node == node; 184 struct device_node *of_node = irq_domain_get_of_node(h);
185 return of_node == NULL || of_node == node;
185} 186}
186 187
187static int ehv_pic_host_map(struct irq_domain *h, unsigned int virq, 188static int ehv_pic_host_map(struct irq_domain *h, unsigned int virq,
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 48a576aa47b9..3a2be3676f43 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -110,7 +110,7 @@ static int fsl_msi_init_allocator(struct fsl_msi *msi_data)
110 int rc, hwirq; 110 int rc, hwirq;
111 111
112 rc = msi_bitmap_alloc(&msi_data->bitmap, NR_MSI_IRQS_MAX, 112 rc = msi_bitmap_alloc(&msi_data->bitmap, NR_MSI_IRQS_MAX,
113 msi_data->irqhost->of_node); 113 irq_domain_get_of_node(msi_data->irqhost));
114 if (rc) 114 if (rc)
115 return rc; 115 return rc;
116 116
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c
index e1a9c2c2d5d3..6f99ed3967fd 100644
--- a/arch/powerpc/sysdev/i8259.c
+++ b/arch/powerpc/sysdev/i8259.c
@@ -165,7 +165,8 @@ static struct resource pic_edgectrl_iores = {
165static int i8259_host_match(struct irq_domain *h, struct device_node *node, 165static int i8259_host_match(struct irq_domain *h, struct device_node *node,
166 enum irq_domain_bus_token bus_token) 166 enum irq_domain_bus_token bus_token)
167{ 167{
168 return h->of_node == NULL || h->of_node == node; 168 struct device_node *of_node = irq_domain_get_of_node(h);
169 return of_node == NULL || of_node == node;
169} 170}
170 171
171static int i8259_host_map(struct irq_domain *h, unsigned int virq, 172static int i8259_host_map(struct irq_domain *h, unsigned int virq,
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index b1297ab1599b..f76ee39cb337 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -675,7 +675,8 @@ static int ipic_host_match(struct irq_domain *h, struct device_node *node,
675 enum irq_domain_bus_token bus_token) 675 enum irq_domain_bus_token bus_token)
676{ 676{
677 /* Exact match, unless ipic node is NULL */ 677 /* Exact match, unless ipic node is NULL */
678 return h->of_node == NULL || h->of_node == node; 678 struct device_node *of_node = irq_domain_get_of_node(h);
679 return of_node == NULL || of_node == node;
679} 680}
680 681
681static int ipic_host_map(struct irq_domain *h, unsigned int virq, 682static int ipic_host_map(struct irq_domain *h, unsigned int virq,
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 537e5db85a06..cecd1156c185 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1011,7 +1011,8 @@ static int mpic_host_match(struct irq_domain *h, struct device_node *node,
1011 enum irq_domain_bus_token bus_token) 1011 enum irq_domain_bus_token bus_token)
1012{ 1012{
1013 /* Exact match, unless mpic node is NULL */ 1013 /* Exact match, unless mpic node is NULL */
1014 return h->of_node == NULL || h->of_node == node; 1014 struct device_node *of_node = irq_domain_get_of_node(h);
1015 return of_node == NULL || of_node == node;
1015} 1016}
1016 1017
1017static int mpic_host_map(struct irq_domain *h, unsigned int virq, 1018static int mpic_host_map(struct irq_domain *h, unsigned int virq,
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c
index 7dc39f35a4cc..1d48a5385905 100644
--- a/arch/powerpc/sysdev/mpic_msi.c
+++ b/arch/powerpc/sysdev/mpic_msi.c
@@ -84,7 +84,7 @@ int mpic_msi_init_allocator(struct mpic *mpic)
84 int rc; 84 int rc;
85 85
86 rc = msi_bitmap_alloc(&mpic->msi_bitmap, mpic->num_sources, 86 rc = msi_bitmap_alloc(&mpic->msi_bitmap, mpic->num_sources,
87 mpic->irqhost->of_node); 87 irq_domain_get_of_node(mpic->irqhost));
88 if (rc) 88 if (rc)
89 return rc; 89 return rc;
90 90
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index fbcc1f855a7f..ef36f16f9f6f 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -248,7 +248,8 @@ static int qe_ic_host_match(struct irq_domain *h, struct device_node *node,
248 enum irq_domain_bus_token bus_token) 248 enum irq_domain_bus_token bus_token)
249{ 249{
250 /* Exact match, unless qe_ic node is NULL */ 250 /* Exact match, unless qe_ic node is NULL */
251 return h->of_node == NULL || h->of_node == node; 251 struct device_node *of_node = irq_domain_get_of_node(h);
252 return of_node == NULL || of_node == node;
252} 253}
253 254
254static int qe_ic_host_map(struct irq_domain *h, unsigned int virq, 255static int qe_ic_host_map(struct irq_domain *h, unsigned int virq,
diff --git a/drivers/gpio/gpio-sodaville.c b/drivers/gpio/gpio-sodaville.c
index 65bc9f47a68e..34b02b42ab9e 100644
--- a/drivers/gpio/gpio-sodaville.c
+++ b/drivers/gpio/gpio-sodaville.c
@@ -102,7 +102,7 @@ static int sdv_xlate(struct irq_domain *h, struct device_node *node,
102{ 102{
103 u32 line, type; 103 u32 line, type;
104 104
105 if (node != h->of_node) 105 if (node != irq_domain_get_of_node(h))
106 return -EINVAL; 106 return -EINVAL;
107 107
108 if (intsize < 2) 108 if (intsize < 2)
diff --git a/drivers/irqchip/exynos-combiner.c b/drivers/irqchip/exynos-combiner.c
index cd7d3bc78e34..ead15be2d20a 100644
--- a/drivers/irqchip/exynos-combiner.c
+++ b/drivers/irqchip/exynos-combiner.c
@@ -144,7 +144,7 @@ static int combiner_irq_domain_xlate(struct irq_domain *d,
144 unsigned long *out_hwirq, 144 unsigned long *out_hwirq,
145 unsigned int *out_type) 145 unsigned int *out_type)
146{ 146{
147 if (d->of_node != controller) 147 if (irq_domain_get_of_node(d) != controller)
148 return -EINVAL; 148 return -EINVAL;
149 149
150 if (intsize < 2) 150 if (intsize < 2)
diff --git a/drivers/irqchip/irq-atmel-aic-common.c b/drivers/irqchip/irq-atmel-aic-common.c
index 63cd031b2c28..b12a5d58546f 100644
--- a/drivers/irqchip/irq-atmel-aic-common.c
+++ b/drivers/irqchip/irq-atmel-aic-common.c
@@ -114,7 +114,7 @@ int aic_common_irq_domain_xlate(struct irq_domain *d,
114 114
115static void __init aic_common_ext_irq_of_init(struct irq_domain *domain) 115static void __init aic_common_ext_irq_of_init(struct irq_domain *domain)
116{ 116{
117 struct device_node *node = domain->of_node; 117 struct device_node *node = irq_domain_get_of_node(domain);
118 struct irq_chip_generic *gc; 118 struct irq_chip_generic *gc;
119 struct aic_chip_data *aic; 119 struct aic_chip_data *aic;
120 struct property *prop; 120 struct property *prop;
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index a7f5626930f5..f1d666a835a8 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -94,7 +94,7 @@ static int allocate_gic_irq(struct irq_domain *domain, unsigned virq,
94 if (i < 0) 94 if (i < 0)
95 return -ENODEV; 95 return -ENODEV;
96 96
97 args.np = domain->parent->of_node; 97 args.np = irq_domain_get_of_node(domain->parent);
98 args.args_count = 3; 98 args.args_count = 3;
99 args.args[0] = 0; /* SPI */ 99 args.args[0] = 0; /* SPI */
100 args.args[1] = i; 100 args.args[1] = i;
@@ -172,7 +172,7 @@ static int crossbar_domain_xlate(struct irq_domain *d,
172 unsigned long *out_hwirq, 172 unsigned long *out_hwirq,
173 unsigned int *out_type) 173 unsigned int *out_type)
174{ 174{
175 if (d->of_node != controller) 175 if (irq_domain_get_of_node(d) != controller)
176 return -EINVAL; /* Shouldn't happen, really... */ 176 return -EINVAL; /* Shouldn't happen, really... */
177 if (intsize != 3) 177 if (intsize != 3)
178 return -EINVAL; /* Not GIC compliant */ 178 return -EINVAL; /* Not GIC compliant */
diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c
index 9a36ab0b544c..7c268eed402a 100644
--- a/drivers/irqchip/irq-gic-v2m.c
+++ b/drivers/irqchip/irq-gic-v2m.c
@@ -128,7 +128,7 @@ static int gicv2m_irq_gic_domain_alloc(struct irq_domain *domain,
128 struct irq_data *d; 128 struct irq_data *d;
129 int err; 129 int err;
130 130
131 args.np = domain->parent->of_node; 131 args.np = irq_domain_get_of_node(domain->parent);
132 args.args_count = 3; 132 args.args_count = 3;
133 args.args[0] = 0; 133 args.args[0] = 0;
134 args.args[1] = hwirq - 32; 134 args.args[1] = hwirq - 32;
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 5f11898b8e39..3cfafaba5300 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1267,7 +1267,7 @@ static int its_irq_gic_domain_alloc(struct irq_domain *domain,
1267{ 1267{
1268 struct of_phandle_args args; 1268 struct of_phandle_args args;
1269 1269
1270 args.np = domain->parent->of_node; 1270 args.np = irq_domain_get_of_node(domain->parent);
1271 args.args_count = 3; 1271 args.args_count = 3;
1272 args.args[0] = GIC_IRQ_TYPE_LPI; 1272 args.args[0] = GIC_IRQ_TYPE_LPI;
1273 args.args[1] = hwirq; 1273 args.args[1] = hwirq;
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 222f9cc0deae..5793880c91c6 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -742,7 +742,7 @@ static int gic_irq_domain_xlate(struct irq_domain *d,
742 const u32 *intspec, unsigned int intsize, 742 const u32 *intspec, unsigned int intsize,
743 unsigned long *out_hwirq, unsigned int *out_type) 743 unsigned long *out_hwirq, unsigned int *out_type)
744{ 744{
745 if (d->of_node != controller) 745 if (irq_domain_get_of_node(d) != controller)
746 return -EINVAL; 746 return -EINVAL;
747 if (intsize < 3) 747 if (intsize < 3)
748 return -EINVAL; 748 return -EINVAL;
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index a9f23cfa9c96..abdccfb9ad22 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -923,7 +923,7 @@ static int gic_irq_domain_xlate(struct irq_domain *d,
923{ 923{
924 unsigned long ret = 0; 924 unsigned long ret = 0;
925 925
926 if (d->of_node != controller) 926 if (irq_domain_get_of_node(d) != controller)
927 return -EINVAL; 927 return -EINVAL;
928 if (intsize < 3) 928 if (intsize < 3)
929 return -EINVAL; 929 return -EINVAL;
diff --git a/drivers/irqchip/irq-hip04.c b/drivers/irqchip/irq-hip04.c
index 8f3ca8f3a62b..9688d2e2a636 100644
--- a/drivers/irqchip/irq-hip04.c
+++ b/drivers/irqchip/irq-hip04.c
@@ -325,7 +325,7 @@ static int hip04_irq_domain_xlate(struct irq_domain *d,
325{ 325{
326 unsigned long ret = 0; 326 unsigned long ret = 0;
327 327
328 if (d->of_node != controller) 328 if (irq_domain_get_of_node(d) != controller)
329 return -EINVAL; 329 return -EINVAL;
330 if (intsize < 3) 330 if (intsize < 3)
331 return -EINVAL; 331 return -EINVAL;
diff --git a/drivers/irqchip/irq-imx-gpcv2.c b/drivers/irqchip/irq-imx-gpcv2.c
index e48d3305456f..05302cef76dd 100644
--- a/drivers/irqchip/irq-imx-gpcv2.c
+++ b/drivers/irqchip/irq-imx-gpcv2.c
@@ -158,7 +158,7 @@ static int imx_gpcv2_domain_xlate(struct irq_domain *domain,
158 unsigned int *out_type) 158 unsigned int *out_type)
159{ 159{
160 /* Shouldn't happen, really... */ 160 /* Shouldn't happen, really... */
161 if (domain->of_node != controller) 161 if (irq_domain_get_of_node(domain) != controller)
162 return -EINVAL; 162 return -EINVAL;
163 163
164 /* Not GIC compliant */ 164 /* Not GIC compliant */
@@ -202,7 +202,7 @@ static int imx_gpcv2_domain_alloc(struct irq_domain *domain,
202 } 202 }
203 203
204 parent_args = *args; 204 parent_args = *args;
205 parent_args.np = domain->parent->of_node; 205 parent_args.np = irq_domain_get_of_node(domain->parent);
206 return irq_domain_alloc_irqs_parent(domain, irq, nr_irqs, &parent_args); 206 return irq_domain_alloc_irqs_parent(domain, irq, nr_irqs, &parent_args);
207} 207}
208 208
diff --git a/drivers/irqchip/irq-mtk-sysirq.c b/drivers/irqchip/irq-mtk-sysirq.c
index c8753da4c156..b07216688cd9 100644
--- a/drivers/irqchip/irq-mtk-sysirq.c
+++ b/drivers/irqchip/irq-mtk-sysirq.c
@@ -106,7 +106,7 @@ static int mtk_sysirq_domain_alloc(struct irq_domain *domain, unsigned int virq,
106 &mtk_sysirq_chip, 106 &mtk_sysirq_chip,
107 domain->host_data); 107 domain->host_data);
108 108
109 gic_data.np = domain->parent->of_node; 109 gic_data.np = irq_domain_get_of_node(domain->parent);
110 return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &gic_data); 110 return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &gic_data);
111} 111}
112 112
diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
index 7154b011ddd2..c71914e8f596 100644
--- a/drivers/irqchip/irq-s3c24xx.c
+++ b/drivers/irqchip/irq-s3c24xx.c
@@ -311,7 +311,7 @@ static void s3c_irq_demux(struct irq_desc *desc)
311 * and one big domain for the dt case where the subintc 311 * and one big domain for the dt case where the subintc
312 * starts at hwirq number 32. 312 * starts at hwirq number 32.
313 */ 313 */
314 offset = (intc->domain->of_node) ? 32 : 0; 314 offset = irq_domain_get_of_node(intc->domain) ? 32 : 0;
315 315
316 chained_irq_enter(chip, desc); 316 chained_irq_enter(chip, desc);
317 317
@@ -342,7 +342,7 @@ static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc,
342 return false; 342 return false;
343 343
344 /* non-dt machines use individual domains */ 344 /* non-dt machines use individual domains */
345 if (!intc->domain->of_node) 345 if (!irq_domain_get_of_node(intc->domain))
346 intc_offset = 0; 346 intc_offset = 0;
347 347
348 /* We have a problem that the INTOFFSET register does not always 348 /* We have a problem that the INTOFFSET register does not always
diff --git a/drivers/irqchip/irq-tegra.c b/drivers/irqchip/irq-tegra.c
index 2fd89eb88f3a..7bbf22658c31 100644
--- a/drivers/irqchip/irq-tegra.c
+++ b/drivers/irqchip/irq-tegra.c
@@ -227,7 +227,7 @@ static int tegra_ictlr_domain_xlate(struct irq_domain *domain,
227 unsigned long *out_hwirq, 227 unsigned long *out_hwirq,
228 unsigned int *out_type) 228 unsigned int *out_type)
229{ 229{
230 if (domain->of_node != controller) 230 if (irq_domain_get_of_node(domain) != controller)
231 return -EINVAL; /* Shouldn't happen, really... */ 231 return -EINVAL; /* Shouldn't happen, really... */
232 if (intsize != 3) 232 if (intsize != 3)
233 return -EINVAL; /* Not GIC compliant */ 233 return -EINVAL; /* Not GIC compliant */
@@ -267,7 +267,7 @@ static int tegra_ictlr_domain_alloc(struct irq_domain *domain,
267 } 267 }
268 268
269 parent_args = *args; 269 parent_args = *args;
270 parent_args.np = domain->parent->of_node; 270 parent_args.np = irq_domain_get_of_node(domain->parent);
271 return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &parent_args); 271 return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &parent_args);
272} 272}
273 273
diff --git a/drivers/irqchip/irq-vf610-mscm-ir.c b/drivers/irqchip/irq-vf610-mscm-ir.c
index 2c2255886401..ae82d7e15c63 100644
--- a/drivers/irqchip/irq-vf610-mscm-ir.c
+++ b/drivers/irqchip/irq-vf610-mscm-ir.c
@@ -142,7 +142,7 @@ static int vf610_mscm_ir_domain_alloc(struct irq_domain *domain, unsigned int vi
142 &vf610_mscm_ir_irq_chip, 142 &vf610_mscm_ir_irq_chip,
143 domain->host_data); 143 domain->host_data);
144 144
145 gic_data.np = domain->parent->of_node; 145 gic_data.np = irq_domain_get_of_node(domain->parent);
146 146
147 if (mscm_ir_data->is_nvic) { 147 if (mscm_ir_data->is_nvic) {
148 gic_data.args_count = 1; 148 gic_data.args_count = 1;
@@ -205,7 +205,8 @@ static int __init vf610_mscm_ir_of_init(struct device_node *node,
205 goto out_unmap; 205 goto out_unmap;
206 } 206 }
207 207
208 if (of_device_is_compatible(domain->parent->of_node, "arm,armv7m-nvic")) 208 if (of_device_is_compatible(irq_domain_get_of_node(domain->parent),
209 "arm,armv7m-nvic"))
209 mscm_ir_data->is_nvic = true; 210 mscm_ir_data->is_nvic = true;
210 211
211 cpu_pm_register_notifier(&mscm_ir_notifier_block); 212 cpu_pm_register_notifier(&mscm_ir_notifier_block);
diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 4a3cf9ba152f..fb36810ae89a 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -657,7 +657,7 @@ static int qpnpint_irq_domain_dt_translate(struct irq_domain *d,
657 "intspec[0] 0x%1x intspec[1] 0x%02x intspec[2] 0x%02x\n", 657 "intspec[0] 0x%1x intspec[1] 0x%02x intspec[2] 0x%02x\n",
658 intspec[0], intspec[1], intspec[2]); 658 intspec[0], intspec[1], intspec[2]);
659 659
660 if (d->of_node != controller) 660 if (irq_domain_get_of_node(d) != controller)
661 return -EINVAL; 661 return -EINVAL;
662 if (intsize != 4) 662 if (intsize != 4)
663 return -EINVAL; 663 return -EINVAL;
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index dc9d27c0c158..8f8b538b067d 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -102,7 +102,7 @@ void irq_domain_remove(struct irq_domain *domain)
102 102
103 pr_debug("Removed domain %s\n", domain->name); 103 pr_debug("Removed domain %s\n", domain->name);
104 104
105 of_node_put(domain->of_node); 105 of_node_put(irq_domain_get_of_node(domain));
106 kfree(domain); 106 kfree(domain);
107} 107}
108EXPORT_SYMBOL_GPL(irq_domain_remove); 108EXPORT_SYMBOL_GPL(irq_domain_remove);
@@ -208,10 +208,12 @@ struct irq_domain *irq_find_matching_host(struct device_node *node,
208 */ 208 */
209 mutex_lock(&irq_domain_mutex); 209 mutex_lock(&irq_domain_mutex);
210 list_for_each_entry(h, &irq_domain_list, link) { 210 list_for_each_entry(h, &irq_domain_list, link) {
211 struct device_node *of_node;
212 of_node = irq_domain_get_of_node(h);
211 if (h->ops->match) 213 if (h->ops->match)
212 rc = h->ops->match(h, node, bus_token); 214 rc = h->ops->match(h, node, bus_token);
213 else 215 else
214 rc = ((h->of_node != NULL) && (h->of_node == node) && 216 rc = ((of_node != NULL) && (of_node == node) &&
215 ((bus_token == DOMAIN_BUS_ANY) || 217 ((bus_token == DOMAIN_BUS_ANY) ||
216 (h->bus_token == bus_token))); 218 (h->bus_token == bus_token)));
217 219
@@ -336,10 +338,12 @@ EXPORT_SYMBOL_GPL(irq_domain_associate);
336void irq_domain_associate_many(struct irq_domain *domain, unsigned int irq_base, 338void irq_domain_associate_many(struct irq_domain *domain, unsigned int irq_base,
337 irq_hw_number_t hwirq_base, int count) 339 irq_hw_number_t hwirq_base, int count)
338{ 340{
341 struct device_node *of_node;
339 int i; 342 int i;
340 343
344 of_node = irq_domain_get_of_node(domain);
341 pr_debug("%s(%s, irqbase=%i, hwbase=%i, count=%i)\n", __func__, 345 pr_debug("%s(%s, irqbase=%i, hwbase=%i, count=%i)\n", __func__,
342 of_node_full_name(domain->of_node), irq_base, (int)hwirq_base, count); 346 of_node_full_name(of_node), irq_base, (int)hwirq_base, count);
343 347
344 for (i = 0; i < count; i++) { 348 for (i = 0; i < count; i++) {
345 irq_domain_associate(domain, irq_base + i, hwirq_base + i); 349 irq_domain_associate(domain, irq_base + i, hwirq_base + i);
@@ -359,12 +363,14 @@ EXPORT_SYMBOL_GPL(irq_domain_associate_many);
359 */ 363 */
360unsigned int irq_create_direct_mapping(struct irq_domain *domain) 364unsigned int irq_create_direct_mapping(struct irq_domain *domain)
361{ 365{
366 struct device_node *of_node;
362 unsigned int virq; 367 unsigned int virq;
363 368
364 if (domain == NULL) 369 if (domain == NULL)
365 domain = irq_default_domain; 370 domain = irq_default_domain;
366 371
367 virq = irq_alloc_desc_from(1, of_node_to_nid(domain->of_node)); 372 of_node = irq_domain_get_of_node(domain);
373 virq = irq_alloc_desc_from(1, of_node_to_nid(of_node));
368 if (!virq) { 374 if (!virq) {
369 pr_debug("create_direct virq allocation failed\n"); 375 pr_debug("create_direct virq allocation failed\n");
370 return 0; 376 return 0;
@@ -399,6 +405,7 @@ EXPORT_SYMBOL_GPL(irq_create_direct_mapping);
399unsigned int irq_create_mapping(struct irq_domain *domain, 405unsigned int irq_create_mapping(struct irq_domain *domain,
400 irq_hw_number_t hwirq) 406 irq_hw_number_t hwirq)
401{ 407{
408 struct device_node *of_node;
402 int virq; 409 int virq;
403 410
404 pr_debug("irq_create_mapping(0x%p, 0x%lx)\n", domain, hwirq); 411 pr_debug("irq_create_mapping(0x%p, 0x%lx)\n", domain, hwirq);
@@ -412,6 +419,8 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
412 } 419 }
413 pr_debug("-> using domain @%p\n", domain); 420 pr_debug("-> using domain @%p\n", domain);
414 421
422 of_node = irq_domain_get_of_node(domain);
423
415 /* Check if mapping already exists */ 424 /* Check if mapping already exists */
416 virq = irq_find_mapping(domain, hwirq); 425 virq = irq_find_mapping(domain, hwirq);
417 if (virq) { 426 if (virq) {
@@ -420,8 +429,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
420 } 429 }
421 430
422 /* Allocate a virtual interrupt number */ 431 /* Allocate a virtual interrupt number */
423 virq = irq_domain_alloc_descs(-1, 1, hwirq, 432 virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node));
424 of_node_to_nid(domain->of_node));
425 if (virq <= 0) { 433 if (virq <= 0) {
426 pr_debug("-> virq allocation failed\n"); 434 pr_debug("-> virq allocation failed\n");
427 return 0; 435 return 0;
@@ -433,7 +441,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
433 } 441 }
434 442
435 pr_debug("irq %lu on domain %s mapped to virtual irq %u\n", 443 pr_debug("irq %lu on domain %s mapped to virtual irq %u\n",
436 hwirq, of_node_full_name(domain->of_node), virq); 444 hwirq, of_node_full_name(of_node), virq);
437 445
438 return virq; 446 return virq;
439} 447}
@@ -460,10 +468,12 @@ EXPORT_SYMBOL_GPL(irq_create_mapping);
460int irq_create_strict_mappings(struct irq_domain *domain, unsigned int irq_base, 468int irq_create_strict_mappings(struct irq_domain *domain, unsigned int irq_base,
461 irq_hw_number_t hwirq_base, int count) 469 irq_hw_number_t hwirq_base, int count)
462{ 470{
471 struct device_node *of_node;
463 int ret; 472 int ret;
464 473
474 of_node = irq_domain_get_of_node(domain);
465 ret = irq_alloc_descs(irq_base, irq_base, count, 475 ret = irq_alloc_descs(irq_base, irq_base, count,
466 of_node_to_nid(domain->of_node)); 476 of_node_to_nid(of_node));
467 if (unlikely(ret < 0)) 477 if (unlikely(ret < 0))
468 return ret; 478 return ret;
469 479
@@ -590,14 +600,16 @@ static int virq_debug_show(struct seq_file *m, void *private)
590 "name", "mapped", "linear-max", "direct-max", "devtree-node"); 600 "name", "mapped", "linear-max", "direct-max", "devtree-node");
591 mutex_lock(&irq_domain_mutex); 601 mutex_lock(&irq_domain_mutex);
592 list_for_each_entry(domain, &irq_domain_list, link) { 602 list_for_each_entry(domain, &irq_domain_list, link) {
603 struct device_node *of_node;
593 int count = 0; 604 int count = 0;
605 of_node = irq_domain_get_of_node(domain);
594 radix_tree_for_each_slot(slot, &domain->revmap_tree, &iter, 0) 606 radix_tree_for_each_slot(slot, &domain->revmap_tree, &iter, 0)
595 count++; 607 count++;
596 seq_printf(m, "%c%-16s %6u %10u %10u %s\n", 608 seq_printf(m, "%c%-16s %6u %10u %10u %s\n",
597 domain == irq_default_domain ? '*' : ' ', domain->name, 609 domain == irq_default_domain ? '*' : ' ', domain->name,
598 domain->revmap_size + count, domain->revmap_size, 610 domain->revmap_size + count, domain->revmap_size,
599 domain->revmap_direct_max_irq, 611 domain->revmap_direct_max_irq,
600 domain->of_node ? of_node_full_name(domain->of_node) : ""); 612 of_node ? of_node_full_name(of_node) : "");
601 } 613 }
602 mutex_unlock(&irq_domain_mutex); 614 mutex_unlock(&irq_domain_mutex);
603 615