[RFC] [PATCH 2/3] of: add of_irq_count: Count the number of IRQs a node present
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Thu May 30 20:25:53 EST 2013
On 23:33 Wed 29 May , Grant Likely wrote:
> On Tue, 28 May 2013 17:08:48 +0200, Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com> wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> > Cc: Grant Likely <grant.likely at secretlab.ca>
> > Cc: Rob Herring <rob.herring at calxeda.com>
> > Cc: Arnd Bergmann <arnd at arndb.de>
> > Cc: Linus Walleij <linus.walleij at linaro.org>
> > Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> > Cc: Ralf Baechle <ralf at linux-mips.org>
> > Cc: Nicolas Ferre <nicolas.ferre at atmel.com>
> > ---
> > 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()"?
yeah look much better
so I drop the patch 1/3
>
> > +{
> > + 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.
ok
Best Regards,
J.
More information about the devicetree-discuss
mailing list