irqdomain: Use irq_domain_get_of_node() instead of direct field access
authorMarc Zyngier <marc.zyngier@arm.com>
Tue, 13 Oct 2015 11:51:29 +0000 (12:51 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 13 Oct 2015 17:01:23 +0000 (19:01 +0200)
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>
32 files changed:
arch/arm/mach-exynos/suspend.c
arch/arm/mach-imx/gpc.c
arch/arm/mach-omap2/omap-wakeupgen.c
arch/c6x/platforms/megamod-pic.c
arch/mips/cavium-octeon/octeon-irq.c
arch/powerpc/platforms/cell/axon_msi.c
arch/powerpc/platforms/cell/spider-pic.c
arch/powerpc/platforms/pasemi/msi.c
arch/powerpc/platforms/powernv/opal-irqchip.c
arch/powerpc/sysdev/ehv_pic.c
arch/powerpc/sysdev/fsl_msi.c
arch/powerpc/sysdev/i8259.c
arch/powerpc/sysdev/ipic.c
arch/powerpc/sysdev/mpic.c
arch/powerpc/sysdev/mpic_msi.c
arch/powerpc/sysdev/qe_lib/qe_ic.c
drivers/gpio/gpio-sodaville.c
drivers/irqchip/exynos-combiner.c
drivers/irqchip/irq-atmel-aic-common.c
drivers/irqchip/irq-crossbar.c
drivers/irqchip/irq-gic-v2m.c
drivers/irqchip/irq-gic-v3-its.c
drivers/irqchip/irq-gic-v3.c
drivers/irqchip/irq-gic.c
drivers/irqchip/irq-hip04.c
drivers/irqchip/irq-imx-gpcv2.c
drivers/irqchip/irq-mtk-sysirq.c
drivers/irqchip/irq-s3c24xx.c
drivers/irqchip/irq-tegra.c
drivers/irqchip/irq-vf610-mscm-ir.c
drivers/spmi/spmi-pmic-arb.c
kernel/irq/irqdomain.c

index e00eb39453a41ff3cf0090a6db53ee80a2afc7dc..af97afc6127ad272c32b70c025a9be2b5891e374 100644 (file)
@@ -184,7 +184,7 @@ static int exynos_pmu_domain_xlate(struct irq_domain *domain,
                                   unsigned long *out_hwirq,
                                   unsigned int *out_type)
 {
-       if (domain->of_node != controller)
+       if (irq_domain_get_of_node(domain) != controller)
                return -EINVAL; /* Shouldn't happen, really... */
        if (intsize != 3)
                return -EINVAL; /* Not GIC compliant */
@@ -217,7 +217,7 @@ static int exynos_pmu_domain_alloc(struct irq_domain *domain,
                                              &exynos_pmu_chip, NULL);
 
        parent_args = *args;
-       parent_args.np = domain->parent->of_node;
+       parent_args.np = irq_domain_get_of_node(domain->parent);
        return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &parent_args);
 }
 
index 8c4467fad8370c73374ff104209b779e580852e1..7b32255028fe379ebba3bf873cb4ece893cf42a1 100644 (file)
@@ -188,7 +188,7 @@ static int imx_gpc_domain_xlate(struct irq_domain *domain,
                                unsigned long *out_hwirq,
                                unsigned int *out_type)
 {
-       if (domain->of_node != controller)
+       if (irq_domain_get_of_node(domain) != controller)
                return -EINVAL; /* Shouldn't happen, really... */
        if (intsize != 3)
                return -EINVAL; /* Not GIC compliant */
@@ -223,7 +223,7 @@ static int imx_gpc_domain_alloc(struct irq_domain *domain,
                                              &imx_gpc_chip, NULL);
 
        parent_args = *args;
-       parent_args.np = domain->parent->of_node;
+       parent_args.np = irq_domain_get_of_node(domain->parent);
        return irq_domain_alloc_irqs_parent(domain, irq, nr_irqs, &parent_args);
 }
 
index e1d2e991d17a31fc15f1c44616c9b4b7f9de3a84..f0f7ffd64b1a898fe83bd08dc4fe784c8047f996 100644 (file)
@@ -406,7 +406,7 @@ static int wakeupgen_domain_xlate(struct irq_domain *domain,
                                  unsigned long *out_hwirq,
                                  unsigned int *out_type)
 {
-       if (domain->of_node != controller)
+       if (irq_domain_get_of_node(domain) != controller)
                return -EINVAL; /* Shouldn't happen, really... */
        if (intsize != 3)
                return -EINVAL; /* Not GIC compliant */
@@ -441,7 +441,7 @@ static int wakeupgen_domain_alloc(struct irq_domain *domain,
                                              &wakeupgen_chip, NULL);
 
        parent_args = *args;
-       parent_args.np = domain->parent->of_node;
+       parent_args.np = irq_domain_get_of_node(domain->parent);
        return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &parent_args);
 }
 
index ddcb45d7dfa7dcb4f16408ec8eaca6eeae03566d..43afc03e41251d45c2ccd0f0a00656ad5e368fe9 100644 (file)
@@ -178,7 +178,7 @@ static void __init set_megamod_mux(struct megamod_pic *pic, int src, int output)
 static void __init parse_priority_map(struct megamod_pic *pic,
                                      int *mapping, int size)
 {
-       struct device_node *np = pic->irqhost->of_node;
+       struct device_node *np = irq_domain_get_of_node(pic->irqhost);
        const __be32 *map;
        int i, maplen;
        u32 val;
index 0352bc8d56b316588dbca209462700c4ffa03aa3..4f9eb05768840f93006384959f0a7dfffdb7caf2 100644 (file)
@@ -1094,7 +1094,7 @@ static int octeon_irq_gpio_xlat(struct irq_domain *d,
        unsigned int pin;
        unsigned int trigger;
 
-       if (d->of_node != node)
+       if (irq_domain_get_of_node(d) != node)
                return -EINVAL;
 
        if (intsize < 2)
@@ -2163,7 +2163,7 @@ static int octeon_irq_cib_map(struct irq_domain *d,
 
        if (hw >= host_data->max_bits) {
                pr_err("ERROR: %s mapping %u is to big!\n",
-                      d->of_node->name, (unsigned)hw);
+                      irq_domain_get_of_node(d)->name, (unsigned)hw);
                return -EINVAL;
        }
 
index e0e68a1c0d3c20dd5d618e62cdccba2e429af475..aed7714495c10fd7fa319675f12f4c7baacdd7ed 100644 (file)
@@ -327,7 +327,7 @@ static void axon_msi_shutdown(struct platform_device *device)
        u32 tmp;
 
        pr_devel("axon_msi: disabling %s\n",
-                 msic->irq_domain->of_node->full_name);
+                irq_domain_get_of_node(msic->irq_domain)->full_name);
        tmp  = dcr_read(msic->dcr_host, MSIC_CTRL_REG);
        tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE;
        msic_dcr_write(msic, MSIC_CTRL_REG, tmp);
index 9d27de62dc62755c4800d46bcc8b4409a81a5115..54ee5743cb724c9b2a28e77607d095da38065d05 100644 (file)
@@ -231,20 +231,23 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
        const u32 *imap, *tmp;
        int imaplen, intsize, unit;
        struct device_node *iic;
+       struct device_node *of_node;
+
+       of_node = irq_domain_get_of_node(pic->host);
 
        /* First, we check whether we have a real "interrupts" in the device
         * tree in case the device-tree is ever fixed
         */
-       virq = irq_of_parse_and_map(pic->host->of_node, 0);
+       virq = irq_of_parse_and_map(of_node, 0);
        if (virq)
                return virq;
 
        /* Now do the horrible hacks */
-       tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL);
+       tmp = of_get_property(of_node, "#interrupt-cells", NULL);
        if (tmp == NULL)
                return NO_IRQ;
        intsize = *tmp;
-       imap = of_get_property(pic->host->of_node, "interrupt-map", &imaplen);
+       imap = of_get_property(of_node, "interrupt-map", &imaplen);
        if (imap == NULL || imaplen < (intsize + 1))
                return NO_IRQ;
        iic = of_find_node_by_phandle(imap[intsize]);
index b304a9fe55cc410e2bcbd9693a84bce1d2bf5365..d9af76342d9980791a6dce16db4c2ce394d9c386 100644 (file)
@@ -144,9 +144,11 @@ int mpic_pasemi_msi_init(struct mpic *mpic)
 {
        int rc;
        struct pci_controller *phb;
+       struct device_node *of_node;
 
-       if (!mpic->irqhost->of_node ||
-           !of_device_is_compatible(mpic->irqhost->of_node,
+       of_node = irq_domain_get_of_node(mpic->irqhost);
+       if (!of_node ||
+           !of_device_is_compatible(of_node,
                                     "pasemi,pwrficient-openpic"))
                return -ENODEV;
 
index 2c91ee7800b90e09edb93a35aa162da74071ba8c..6ccfb6c1c707b40e9fd6ba4cb202d70c1faf57cb 100644 (file)
@@ -137,7 +137,7 @@ static void opal_handle_irq_work(struct irq_work *work)
 static int opal_event_match(struct irq_domain *h, struct device_node *node,
                            enum irq_domain_bus_token bus_token)
 {
-       return h->of_node == node;
+       return irq_domain_get_of_node(h) == node;
 }
 
 static int opal_event_xlate(struct irq_domain *h, struct device_node *np,
index eca0b00794fa567edb3edc2d12650328b4dec486..bffcc7a486a11c9821ded7f18178c336aa58b9b7 100644 (file)
@@ -181,7 +181,8 @@ static int ehv_pic_host_match(struct irq_domain *h, struct device_node *node,
                              enum irq_domain_bus_token bus_token)
 {
        /* Exact match, unless ehv_pic node is NULL */
-       return h->of_node == NULL || h->of_node == node;
+       struct device_node *of_node = irq_domain_get_of_node(h);
+       return of_node == NULL || of_node == node;
 }
 
 static int ehv_pic_host_map(struct irq_domain *h, unsigned int virq,
index 48a576aa47b92455e97a3f437b5cc18b6007f91a..3a2be3676f4353eb6b4e3b237334cd0b3903d37f 100644 (file)
@@ -110,7 +110,7 @@ static int fsl_msi_init_allocator(struct fsl_msi *msi_data)
        int rc, hwirq;
 
        rc = msi_bitmap_alloc(&msi_data->bitmap, NR_MSI_IRQS_MAX,
-                             msi_data->irqhost->of_node);
+                             irq_domain_get_of_node(msi_data->irqhost));
        if (rc)
                return rc;
 
index e1a9c2c2d5d357c7e88083d60a6f89c0d04219c2..6f99ed3967fdef3ad382a03758d361e1ee3223db 100644 (file)
@@ -165,7 +165,8 @@ static struct resource pic_edgectrl_iores = {
 static int i8259_host_match(struct irq_domain *h, struct device_node *node,
                            enum irq_domain_bus_token bus_token)
 {
-       return h->of_node == NULL || h->of_node == node;
+       struct device_node *of_node = irq_domain_get_of_node(h);
+       return of_node == NULL || of_node == node;
 }
 
 static int i8259_host_map(struct irq_domain *h, unsigned int virq,
index b1297ab1599b46ef24457ec890b28b69ba4dc0bf..f76ee39cb3377a0a6788ad4fcd31fe3c4614743f 100644 (file)
@@ -675,7 +675,8 @@ static int ipic_host_match(struct irq_domain *h, struct device_node *node,
                           enum irq_domain_bus_token bus_token)
 {
        /* Exact match, unless ipic node is NULL */
-       return h->of_node == NULL || h->of_node == node;
+       struct device_node *of_node = irq_domain_get_of_node(h);
+       return of_node == NULL || of_node == node;
 }
 
 static int ipic_host_map(struct irq_domain *h, unsigned int virq,
index 537e5db85a060518928ee812cdab8dd00a311b06..cecd1156c1852a71b6f0432c77fd1410eda767d1 100644 (file)
@@ -1011,7 +1011,8 @@ static int mpic_host_match(struct irq_domain *h, struct device_node *node,
                           enum irq_domain_bus_token bus_token)
 {
        /* Exact match, unless mpic node is NULL */
-       return h->of_node == NULL || h->of_node == node;
+       struct device_node *of_node = irq_domain_get_of_node(h);
+       return of_node == NULL || of_node == node;
 }
 
 static int mpic_host_map(struct irq_domain *h, unsigned int virq,
index 7dc39f35a4ccdb0d9f213515ccb5b850de3e1b4e..1d48a5385905a8ce96290f10064546a39efed403 100644 (file)
@@ -84,7 +84,7 @@ int mpic_msi_init_allocator(struct mpic *mpic)
        int rc;
 
        rc = msi_bitmap_alloc(&mpic->msi_bitmap, mpic->num_sources,
-                             mpic->irqhost->of_node);
+                             irq_domain_get_of_node(mpic->irqhost));
        if (rc)
                return rc;
 
index fbcc1f855a7f2ea15937d02f0b0cb4305af5034a..ef36f16f9f6fbc9bdfd0c02e6df29e77fc83817c 100644 (file)
@@ -248,7 +248,8 @@ static int qe_ic_host_match(struct irq_domain *h, struct device_node *node,
                            enum irq_domain_bus_token bus_token)
 {
        /* Exact match, unless qe_ic node is NULL */
-       return h->of_node == NULL || h->of_node == node;
+       struct device_node *of_node = irq_domain_get_of_node(h);
+       return of_node == NULL || of_node == node;
 }
 
 static int qe_ic_host_map(struct irq_domain *h, unsigned int virq,
index 65bc9f47a68ed98c89889431a5ece6cf1f8a01b7..34b02b42ab9e5bbfd2bc2f7bd16ba31c704718ec 100644 (file)
@@ -102,7 +102,7 @@ static int sdv_xlate(struct irq_domain *h, struct device_node *node,
 {
        u32 line, type;
 
-       if (node != h->of_node)
+       if (node != irq_domain_get_of_node(h))
                return -EINVAL;
 
        if (intsize < 2)
index cd7d3bc78e345c49b733b9120c5a5bed2540583b..ead15be2d20ab12c476157fd75be87d0064c8c41 100644 (file)
@@ -144,7 +144,7 @@ static int combiner_irq_domain_xlate(struct irq_domain *d,
                                     unsigned long *out_hwirq,
                                     unsigned int *out_type)
 {
-       if (d->of_node != controller)
+       if (irq_domain_get_of_node(d) != controller)
                return -EINVAL;
 
        if (intsize < 2)
index 63cd031b2c28d40c9c1296ae466005a5d48843d3..b12a5d58546f922b460d6aac34c073ff363ef1b8 100644 (file)
@@ -114,7 +114,7 @@ int aic_common_irq_domain_xlate(struct irq_domain *d,
 
 static void __init aic_common_ext_irq_of_init(struct irq_domain *domain)
 {
-       struct device_node *node = domain->of_node;
+       struct device_node *node = irq_domain_get_of_node(domain);
        struct irq_chip_generic *gc;
        struct aic_chip_data *aic;
        struct property *prop;
index a7f5626930f506289c6eaea34529c20b2051c750..f1d666a835a8efb1495864e29a47c0d228f1fea4 100644 (file)
@@ -94,7 +94,7 @@ static int allocate_gic_irq(struct irq_domain *domain, unsigned virq,
        if (i < 0)
                return -ENODEV;
 
-       args.np = domain->parent->of_node;
+       args.np = irq_domain_get_of_node(domain->parent);
        args.args_count = 3;
        args.args[0] = 0;       /* SPI */
        args.args[1] = i;
@@ -172,7 +172,7 @@ static int crossbar_domain_xlate(struct irq_domain *d,
                                 unsigned long *out_hwirq,
                                 unsigned int *out_type)
 {
-       if (d->of_node != controller)
+       if (irq_domain_get_of_node(d) != controller)
                return -EINVAL; /* Shouldn't happen, really... */
        if (intsize != 3)
                return -EINVAL; /* Not GIC compliant */
index 9a36ab0b544ca1a4fbd157802c852e3c975c18d2..7c268eed402a47acb465ae619fae16f565c6b404 100644 (file)
@@ -128,7 +128,7 @@ static int gicv2m_irq_gic_domain_alloc(struct irq_domain *domain,
        struct irq_data *d;
        int err;
 
-       args.np = domain->parent->of_node;
+       args.np = irq_domain_get_of_node(domain->parent);
        args.args_count = 3;
        args.args[0] = 0;
        args.args[1] = hwirq - 32;
index 5f11898b8e39f546682339713ca297cb1af7b518..3cfafaba53005fee1636fcbe5871e44caa477457 100644 (file)
@@ -1267,7 +1267,7 @@ static int its_irq_gic_domain_alloc(struct irq_domain *domain,
 {
        struct of_phandle_args args;
 
-       args.np = domain->parent->of_node;
+       args.np = irq_domain_get_of_node(domain->parent);
        args.args_count = 3;
        args.args[0] = GIC_IRQ_TYPE_LPI;
        args.args[1] = hwirq;
index 222f9cc0deae970d03e4a34c52f630a037cccc72..5793880c91c6cc882f7af6e1ca6b99fafa8d61f3 100644 (file)
@@ -742,7 +742,7 @@ static int gic_irq_domain_xlate(struct irq_domain *d,
                                const u32 *intspec, unsigned int intsize,
                                unsigned long *out_hwirq, unsigned int *out_type)
 {
-       if (d->of_node != controller)
+       if (irq_domain_get_of_node(d) != controller)
                return -EINVAL;
        if (intsize < 3)
                return -EINVAL;
index a9f23cfa9c96800c9a9cb419615bfac9e218cee5..abdccfb9ad22afbb8180c31f6d7337b2b15f138f 100644 (file)
@@ -923,7 +923,7 @@ static int gic_irq_domain_xlate(struct irq_domain *d,
 {
        unsigned long ret = 0;
 
-       if (d->of_node != controller)
+       if (irq_domain_get_of_node(d) != controller)
                return -EINVAL;
        if (intsize < 3)
                return -EINVAL;
index 8f3ca8f3a62b615b2d670851dd8afe1d75904bee..9688d2e2a6364d2accbe77f323dd3b9f1d735dfa 100644 (file)
@@ -325,7 +325,7 @@ static int hip04_irq_domain_xlate(struct irq_domain *d,
 {
        unsigned long ret = 0;
 
-       if (d->of_node != controller)
+       if (irq_domain_get_of_node(d) != controller)
                return -EINVAL;
        if (intsize < 3)
                return -EINVAL;
index e48d3305456fe859e890413144066ff1fbb43875..05302cef76dda4f04947185479c4e71f7e0b42b9 100644 (file)
@@ -158,7 +158,7 @@ static int imx_gpcv2_domain_xlate(struct irq_domain *domain,
                                unsigned int *out_type)
 {
        /* Shouldn't happen, really... */
-       if (domain->of_node != controller)
+       if (irq_domain_get_of_node(domain) != controller)
                return -EINVAL;
 
        /* Not GIC compliant */
@@ -202,7 +202,7 @@ static int imx_gpcv2_domain_alloc(struct irq_domain *domain,
        }
 
        parent_args = *args;
-       parent_args.np = domain->parent->of_node;
+       parent_args.np = irq_domain_get_of_node(domain->parent);
        return irq_domain_alloc_irqs_parent(domain, irq, nr_irqs, &parent_args);
 }
 
index c8753da4c156ee9e2fa1b3b5ddfde63561733d30..b07216688cd92fefda0b3453dbbd05925c269f51 100644 (file)
@@ -106,7 +106,7 @@ static int mtk_sysirq_domain_alloc(struct irq_domain *domain, unsigned int virq,
                                              &mtk_sysirq_chip,
                                              domain->host_data);
 
-       gic_data.np = domain->parent->of_node;
+       gic_data.np = irq_domain_get_of_node(domain->parent);
        return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &gic_data);
 }
 
index 7154b011ddd2f65a65f7079bfe88783c50d0d373..c71914e8f596c3700d8c5a4da2448b32acf8c41f 100644 (file)
@@ -311,7 +311,7 @@ static void s3c_irq_demux(struct irq_desc *desc)
         * and one big domain for the dt case where the subintc
         * starts at hwirq number 32.
         */
-       offset = (intc->domain->of_node) ? 32 : 0;
+       offset = irq_domain_get_of_node(intc->domain) ? 32 : 0;
 
        chained_irq_enter(chip, desc);
 
@@ -342,7 +342,7 @@ static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc,
                return false;
 
        /* non-dt machines use individual domains */
-       if (!intc->domain->of_node)
+       if (!irq_domain_get_of_node(intc->domain))
                intc_offset = 0;
 
        /* We have a problem that the INTOFFSET register does not always
index 2fd89eb88f3a29bc716ec1daf76ad4085e6a743d..7bbf22658c318ae350a10d5747000827ef105cef 100644 (file)
@@ -227,7 +227,7 @@ static int tegra_ictlr_domain_xlate(struct irq_domain *domain,
                                    unsigned long *out_hwirq,
                                    unsigned int *out_type)
 {
-       if (domain->of_node != controller)
+       if (irq_domain_get_of_node(domain) != controller)
                return -EINVAL; /* Shouldn't happen, really... */
        if (intsize != 3)
                return -EINVAL; /* Not GIC compliant */
@@ -267,7 +267,7 @@ static int tegra_ictlr_domain_alloc(struct irq_domain *domain,
        }
 
        parent_args = *args;
-       parent_args.np = domain->parent->of_node;
+       parent_args.np = irq_domain_get_of_node(domain->parent);
        return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &parent_args);
 }
 
index 2c22558864012efe6425ab1f058ea0e07a9f0728..ae82d7e15c63d42042dc9e63e3d102ba7c4c91bd 100644 (file)
@@ -142,7 +142,7 @@ static int vf610_mscm_ir_domain_alloc(struct irq_domain *domain, unsigned int vi
                                              &vf610_mscm_ir_irq_chip,
                                              domain->host_data);
 
-       gic_data.np = domain->parent->of_node;
+       gic_data.np = irq_domain_get_of_node(domain->parent);
 
        if (mscm_ir_data->is_nvic) {
                gic_data.args_count = 1;
@@ -205,7 +205,8 @@ static int __init vf610_mscm_ir_of_init(struct device_node *node,
                goto out_unmap;
        }
 
-       if (of_device_is_compatible(domain->parent->of_node, "arm,armv7m-nvic"))
+       if (of_device_is_compatible(irq_domain_get_of_node(domain->parent),
+                                   "arm,armv7m-nvic"))
                mscm_ir_data->is_nvic = true;
 
        cpu_pm_register_notifier(&mscm_ir_notifier_block);
index 4a3cf9ba152f6b8060e3c7709550dfdc7ec9fe17..fb36810ae89a40a1aae2729e5767191c82840c50 100644 (file)
@@ -657,7 +657,7 @@ static int qpnpint_irq_domain_dt_translate(struct irq_domain *d,
                "intspec[0] 0x%1x intspec[1] 0x%02x intspec[2] 0x%02x\n",
                intspec[0], intspec[1], intspec[2]);
 
-       if (d->of_node != controller)
+       if (irq_domain_get_of_node(d) != controller)
                return -EINVAL;
        if (intsize != 4)
                return -EINVAL;
index dc9d27c0c1589e58bb14a15e3442ed2ff0d091a4..8f8b538b067d027ac58e9c82d772d32486e95c4d 100644 (file)
@@ -102,7 +102,7 @@ void irq_domain_remove(struct irq_domain *domain)
 
        pr_debug("Removed domain %s\n", domain->name);
 
-       of_node_put(domain->of_node);
+       of_node_put(irq_domain_get_of_node(domain));
        kfree(domain);
 }
 EXPORT_SYMBOL_GPL(irq_domain_remove);
@@ -208,10 +208,12 @@ struct irq_domain *irq_find_matching_host(struct device_node *node,
         */
        mutex_lock(&irq_domain_mutex);
        list_for_each_entry(h, &irq_domain_list, link) {
+               struct device_node *of_node;
+               of_node = irq_domain_get_of_node(h);
                if (h->ops->match)
                        rc = h->ops->match(h, node, bus_token);
                else
-                       rc = ((h->of_node != NULL) && (h->of_node == node) &&
+                       rc = ((of_node != NULL) && (of_node == node) &&
                              ((bus_token == DOMAIN_BUS_ANY) ||
                               (h->bus_token == bus_token)));
 
@@ -336,10 +338,12 @@ EXPORT_SYMBOL_GPL(irq_domain_associate);
 void irq_domain_associate_many(struct irq_domain *domain, unsigned int irq_base,
                               irq_hw_number_t hwirq_base, int count)
 {
+       struct device_node *of_node;
        int i;
 
+       of_node = irq_domain_get_of_node(domain);
        pr_debug("%s(%s, irqbase=%i, hwbase=%i, count=%i)\n", __func__,
-               of_node_full_name(domain->of_node), irq_base, (int)hwirq_base, count);
+               of_node_full_name(of_node), irq_base, (int)hwirq_base, count);
 
        for (i = 0; i < count; i++) {
                irq_domain_associate(domain, irq_base + i, hwirq_base + i);
@@ -359,12 +363,14 @@ EXPORT_SYMBOL_GPL(irq_domain_associate_many);
  */
 unsigned int irq_create_direct_mapping(struct irq_domain *domain)
 {
+       struct device_node *of_node;
        unsigned int virq;
 
        if (domain == NULL)
                domain = irq_default_domain;
 
-       virq = irq_alloc_desc_from(1, of_node_to_nid(domain->of_node));
+       of_node = irq_domain_get_of_node(domain);
+       virq = irq_alloc_desc_from(1, of_node_to_nid(of_node));
        if (!virq) {
                pr_debug("create_direct virq allocation failed\n");
                return 0;
@@ -399,6 +405,7 @@ EXPORT_SYMBOL_GPL(irq_create_direct_mapping);
 unsigned int irq_create_mapping(struct irq_domain *domain,
                                irq_hw_number_t hwirq)
 {
+       struct device_node *of_node;
        int virq;
 
        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,
        }
        pr_debug("-> using domain @%p\n", domain);
 
+       of_node = irq_domain_get_of_node(domain);
+
        /* Check if mapping already exists */
        virq = irq_find_mapping(domain, hwirq);
        if (virq) {
@@ -420,8 +429,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
        }
 
        /* Allocate a virtual interrupt number */
-       virq = irq_domain_alloc_descs(-1, 1, hwirq,
-                                     of_node_to_nid(domain->of_node));
+       virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node));
        if (virq <= 0) {
                pr_debug("-> virq allocation failed\n");
                return 0;
@@ -433,7 +441,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
        }
 
        pr_debug("irq %lu on domain %s mapped to virtual irq %u\n",
-               hwirq, of_node_full_name(domain->of_node), virq);
+               hwirq, of_node_full_name(of_node), virq);
 
        return virq;
 }
@@ -460,10 +468,12 @@ EXPORT_SYMBOL_GPL(irq_create_mapping);
 int irq_create_strict_mappings(struct irq_domain *domain, unsigned int irq_base,
                               irq_hw_number_t hwirq_base, int count)
 {
+       struct device_node *of_node;
        int ret;
 
+       of_node = irq_domain_get_of_node(domain);
        ret = irq_alloc_descs(irq_base, irq_base, count,
-                             of_node_to_nid(domain->of_node));
+                             of_node_to_nid(of_node));
        if (unlikely(ret < 0))
                return ret;
 
@@ -590,14 +600,16 @@ static int virq_debug_show(struct seq_file *m, void *private)
                   "name", "mapped", "linear-max", "direct-max", "devtree-node");
        mutex_lock(&irq_domain_mutex);
        list_for_each_entry(domain, &irq_domain_list, link) {
+               struct device_node *of_node;
                int count = 0;
+               of_node = irq_domain_get_of_node(domain);
                radix_tree_for_each_slot(slot, &domain->revmap_tree, &iter, 0)
                        count++;
                seq_printf(m, "%c%-16s  %6u  %10u  %10u  %s\n",
                           domain == irq_default_domain ? '*' : ' ', domain->name,
                           domain->revmap_size + count, domain->revmap_size,
                           domain->revmap_direct_max_irq,
-                          domain->of_node ? of_node_full_name(domain->of_node) : "");
+                          of_node ? of_node_full_name(of_node) : "");
        }
        mutex_unlock(&irq_domain_mutex);