1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2001 Dave Engebretsen IBM Corporation
4  */
5 
6 #include <linux/interrupt.h>
7 #include <linux/of_irq.h>
8 
9 #include "pseries.h"
10 
request_event_sources_irqs(struct device_node * np,irq_handler_t handler,const char * name)11 void __init request_event_sources_irqs(struct device_node *np,
12 				irq_handler_t handler,
13 				const char *name)
14 {
15 	int i, virq, rc;
16 
17 	for (i = 0; i < 16; i++) {
18 		virq = of_irq_get(np, i);
19 		if (virq < 0)
20 			return;
21 		if (WARN(!virq, "event-sources: Unable to allocate "
22 			        "interrupt number for %pOF\n", np))
23 			continue;
24 
25 		rc = request_irq(virq, handler, 0, name, NULL);
26 		if (WARN(rc, "event-sources: Unable to request interrupt %d for %pOF\n",
27 		    virq, np))
28 			return;
29 	}
30 }
31