of/irq: Rework of_irq_count()

The of_irq_to_resource() helper that is used to implement of_irq_count()
tries to resolve interrupts and in fact creates a mapping for resolved
interrupts. That's pretty heavy lifting for something that claims to
just return the number of interrupts requested by a given device node.

Instead, use the more lightweight of_irq_map_one(), which, despite the
name, doesn't create an actual mapping. Perhaps a better name would be
of_irq_translate_one().

Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
[grant.likely: fixup s/of_irq_map_one/of_irq_parse_one/]
Signed-off-by: Grant Likely <grant.likely@linaro.org>
This commit is contained in:
Thierry Reding 2013-09-18 15:24:43 +02:00 committed by Grant Likely
parent a9f10ca76d
commit 3da5278727
1 changed files with 2 additions and 1 deletions

View File

@ -373,9 +373,10 @@ EXPORT_SYMBOL_GPL(of_irq_to_resource);
*/
int of_irq_count(struct device_node *dev)
{
struct of_phandle_args irq;
int nr = 0;
while (of_irq_to_resource(dev, nr, NULL))
while (of_irq_parse_one(dev, nr, &irq) == 0)
nr++;
return nr;