39fc79488b0d987eb6588782f7b635f24a5551d9
[openwrt/staging/lynxis.git] / target / linux / mvebu / patches-3.10 / 0188-of-irq-Rework-of_irq_count.patch
1 From 3665853921092bb68aa0929efb3a94ecdfc96782 Mon Sep 17 00:00:00 2001
2 From: Thierry Reding <thierry.reding@gmail.com>
3 Date: Thu, 19 Dec 2013 09:30:59 -0300
4 Subject: [PATCH 188/203] of/irq: Rework of_irq_count()
5
6 The of_irq_to_resource() helper that is used to implement of_irq_count()
7 tries to resolve interrupts and in fact creates a mapping for resolved
8 interrupts. That's pretty heavy lifting for something that claims to
9 just return the number of interrupts requested by a given device node.
10
11 Instead, use the more lightweight of_irq_map_one(), which, despite the
12 name, doesn't create an actual mapping. Perhaps a better name would be
13 of_irq_translate_one().
14
15 Signed-off-by: Thierry Reding <treding@nvidia.com>
16 Acked-by: Rob Herring <rob.herring@calxeda.com>
17 [grant.likely: fixup s/of_irq_map_one/of_irq_parse_one/]
18 Signed-off-by: Grant Likely <grant.likely@linaro.org>
19 ---
20 drivers/of/irq.c | 3 ++-
21 1 file changed, 2 insertions(+), 1 deletion(-)
22
23 --- a/drivers/of/irq.c
24 +++ b/drivers/of/irq.c
25 @@ -379,9 +379,10 @@ EXPORT_SYMBOL_GPL(of_irq_to_resource);
26 */
27 int of_irq_count(struct device_node *dev)
28 {
29 + struct of_phandle_args irq;
30 int nr = 0;
31
32 - while (of_irq_to_resource(dev, nr, NULL))
33 + while (of_irq_parse_one(dev, nr, &irq) == 0)
34 nr++;
35
36 return nr;