On Tue, 28 May 2013 17:08:48 +0200, Jean-Christophe PLAGNIOL-VILLARD
<[email protected]> wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
> Cc: Grant Likely <[email protected]>
> Cc: Rob Herring <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Linus Walleij <[email protected]>
> Cc: Benjamin Herrenschmidt <[email protected]>
> Cc: Ralf Baechle <[email protected]>
> Cc: Nicolas Ferre <[email protected]>
> ---
> drivers/of/irq.c | 15 +++++++++++++++
> include/linux/of_irq.h | 1 +
> 2 files changed, 16 insertions(+)
>
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> index d1c5825..4426223 100644
> --- a/drivers/of/irq.c
> +++ b/drivers/of/irq.c
> @@ -362,6 +362,21 @@ int of_irq_to_resource(struct device_node *dev, int
> index, struct resource *r)
> EXPORT_SYMBOL_GPL(of_irq_to_resource);
>
> /**
> + * of_irq_count - Count the number of IRQs a node uses
> + * @dev: pointer to device tree node
> + */
> +int of_irq_count(struct device_node *dev)
Following on from my comment on patch 1/3, How about "of_irq_count_entries()"?
> +{
> + struct of_irq oirq;
> + int nr = 0;
> +
> + while (!of_irq_map_one(dev, nr, &oirq))
> + nr++;
The concept is good, but this ends up being very inefficient. It would
be better to take the relevant parts out of of_irq_map_one() to retrieve
the value of #interrupt-cells and compare it to the size of the
interrupts property.
g.
_______________________________________________
devicetree-discuss mailing list
[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss