Skip to content

Commit

Permalink
irqdomain: Use irq_domain_get_of_node() instead of direct field access
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-and-tested-by: Hanjun Guo <[email protected]>
Tested-by: Lorenzo Pieralisi <[email protected]>
Cc: <[email protected]>
Cc: Tomasz Nowicki <[email protected]>
Cc: Suravee Suthikulpanit <[email protected]>
Cc: Graeme Gregory <[email protected]>
Cc: Jake Oshins <[email protected]>
Cc: Jiang Liu <[email protected]>
Cc: Jason Cooper <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
  • Loading branch information
Marc Zyngier authored and KAGA-KOKO committed Oct 13, 2015
1 parent e50226b commit 5d4c9bc
Show file tree
Hide file tree
Showing 32 changed files with 75 additions and 52 deletions.
4 changes: 2 additions & 2 deletions arch/arm/mach-exynos/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-imx/gpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-omap2/omap-wakeupgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion arch/c6x/platforms/megamod-pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions arch/mips/cavium-octeon/octeon-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/cell/axon_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 6 additions & 3 deletions arch/powerpc/platforms/cell/spider-pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
6 changes: 4 additions & 2 deletions arch/powerpc/platforms/pasemi/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/powernv/opal-irqchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion arch/powerpc/sysdev/ehv_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/fsl_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion arch/powerpc/sysdev/i8259.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion arch/powerpc/sysdev/ipic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion arch/powerpc/sysdev/mpic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/mpic_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion arch/powerpc/sysdev/qe_lib/qe_ic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-sodaville.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/irqchip/exynos-combiner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-atmel-aic-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions drivers/irqchip/irq-crossbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-gic-v2m.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-gic-v3-its.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-gic-v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-gic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-hip04.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions drivers/irqchip/irq-imx-gpcv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/irqchip/irq-mtk-sysirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/irqchip/irq-s3c24xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions drivers/irqchip/irq-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
}

Expand Down
5 changes: 3 additions & 2 deletions drivers/irqchip/irq-vf610-mscm-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/spmi/spmi-pmic-arb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 5d4c9bc

Please sign in to comment.