Skip to content

Commit c417596

Browse files
robherringmpe
authored andcommitted
powerpc/pseries: Use of_irq_get helper() in request_event_sources_irqs()
Instead of calling both of_irq_parse_one() and irq_create_of_mapping(), call of_irq_get() instead which does essentially the same thing. of_irq_get() also calls irq_find_host() for deferred probe support, but this should be fine as irq_create_of_mapping() also calls that internally. This gets us closer to making the former 2 functions static. In the process of simplifying request_event_sources_irqs(), combine the the pr_err() and WARN_ON() calls to just a WARN(). Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 8c8933e commit c417596

File tree

1 file changed

+13
-27
lines changed

1 file changed

+13
-27
lines changed

arch/powerpc/platforms/pseries/event_sources.c

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,28 @@
1616
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1717
*/
1818

19-
#include <asm/prom.h>
19+
#include <linux/interrupt.h>
20+
#include <linux/of_irq.h>
2021

2122
#include "pseries.h"
2223

2324
void request_event_sources_irqs(struct device_node *np,
2425
irq_handler_t handler,
2526
const char *name)
2627
{
27-
int i, index, count = 0;
28-
struct of_phandle_args oirq;
29-
unsigned int virqs[16];
28+
int i, virq, rc;
3029

31-
/* First try to do a proper OF tree parsing */
32-
for (index = 0; of_irq_parse_one(np, index, &oirq) == 0;
33-
index++) {
34-
if (count > 15)
35-
break;
36-
virqs[count] = irq_create_of_mapping(&oirq);
37-
if (!virqs[count]) {
38-
pr_err("event-sources: Unable to allocate "
39-
"interrupt number for %pOF\n",
40-
np);
41-
WARN_ON(1);
42-
} else {
43-
count++;
44-
}
45-
}
30+
for (i = 0; i < 16; i++) {
31+
virq = of_irq_get(np, i);
32+
if (virq < 0)
33+
return;
34+
if (WARN(!virq, "event-sources: Unable to allocate "
35+
"interrupt number for %pOF\n", np))
36+
continue;
4637

47-
/* Now request them */
48-
for (i = 0; i < count; i++) {
49-
if (request_irq(virqs[i], handler, 0, name, NULL)) {
50-
pr_err("event-sources: Unable to request interrupt "
51-
"%d for %pOF\n", virqs[i], np);
52-
WARN_ON(1);
38+
rc = request_irq(virq, handler, 0, name, NULL);
39+
if (WARN(rc, "event-sources: Unable to request interrupt %d for %pOF\n",
40+
virq, np))
5341
return;
54-
}
5542
}
5643
}
57-

0 commit comments

Comments
 (0)