ARM: 7554/1: VIC: use irq_domain_add_simple()

Instead of allocating descriptors on-the-fly for the device tree
initialization case, use irq_domain_add_simple() which will take
care of this if you pass negative as the first_irq.

Alter the signature of __vic_init() to pass the first_irq as
signed so this works as expected.

Switching the VIC to use irq_domain_add_simple() also has the
upside of displaying the same WARNING when you boot with
pre-allocated descriptors on systems using SPARSE_IRQ but
yet not using device tree.

Cc: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Linus Walleij 2012-10-16 18:50:00 +01:00 committed by Russell King
parent ddffeb8c4d
commit 07c9249f1f
2 changed files with 7 additions and 13 deletions

View File

@ -218,7 +218,7 @@ static void __init vic_register(void __iomem *base, unsigned int irq,
v->resume_sources = resume_sources; v->resume_sources = resume_sources;
v->irq = irq; v->irq = irq;
vic_id++; vic_id++;
v->domain = irq_domain_add_legacy(node, fls(valid_sources), irq, 0, v->domain = irq_domain_add_simple(node, fls(valid_sources), irq,
&vic_irqdomain_ops, v); &vic_irqdomain_ops, v);
} }
@ -350,7 +350,7 @@ static void __init vic_init_st(void __iomem *base, unsigned int irq_start,
vic_register(base, irq_start, vic_sources, 0, node); vic_register(base, irq_start, vic_sources, 0, node);
} }
void __init __vic_init(void __iomem *base, unsigned int irq_start, void __init __vic_init(void __iomem *base, int irq_start,
u32 vic_sources, u32 resume_sources, u32 vic_sources, u32 resume_sources,
struct device_node *node) struct device_node *node)
{ {
@ -416,18 +416,12 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent)
if (WARN_ON(!regs)) if (WARN_ON(!regs))
return -EIO; return -EIO;
irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id()); /*
if (WARN_ON(irq_base < 0)) * Passing -1 as first IRQ makes the simple domain allocate descriptors
goto out_unmap; */
__vic_init(regs, -1, ~0, ~0, node);
__vic_init(regs, irq_base, ~0, ~0, node);
return 0; return 0;
out_unmap:
iounmap(regs);
return -EIO;
} }
#endif /* CONFIG OF */ #endif /* CONFIG OF */

View File

@ -47,7 +47,7 @@
struct device_node; struct device_node;
struct pt_regs; struct pt_regs;
void __vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, void __vic_init(void __iomem *base, int irq_start, u32 vic_sources,
u32 resume_sources, struct device_node *node); u32 resume_sources, struct device_node *node);
void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources); void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources);
int vic_of_init(struct device_node *node, struct device_node *parent); int vic_of_init(struct device_node *node, struct device_node *parent);