Skip to content

Commit c5c601c

Browse files
Marc ZyngierKAGA-KOKO
authored andcommitted
irqdomain: Allow ACPI device nodes to be used as irqdomain identifiers
A number of irqchip implementations are (ab)using the irqdomain allocator by passing a fwnode that is neither a FWNODE_OF or a FWNODE_IRQCHIP. This is pretty bad, but it also feels pretty crap to force these drivers to allocate their own irqchip_fwid when they already have a proper fwnode. Instead, let's teach the irqdomain allocator about ACPI device nodes, and add some lovely name generation code... Tested on an arm64 D05 system. Reported-and-tested-by: John Garry <john.garry@huawei.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Agustin Vega-Frias <agustinv@codeaurora.org> Cc: Ma Jun <majun258@huawei.com> Cc: Hanjun Guo <hanjun.guo@linaro.org> Link: http://lkml.kernel.org/r/20170707083959.10349-1-marc.zyngier@arm.com
1 parent f610c9d commit c5c601c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

kernel/irq/irqdomain.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#define pr_fmt(fmt) "irq: " fmt
22

3+
#include <linux/acpi.h>
34
#include <linux/debugfs.h>
45
#include <linux/hardirq.h>
56
#include <linux/interrupt.h>
@@ -155,6 +156,21 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
155156
domain->name = fwid->name;
156157
break;
157158
}
159+
#ifdef CONFIG_ACPI
160+
} else if (is_acpi_device_node(fwnode)) {
161+
struct acpi_buffer buf = {
162+
.length = ACPI_ALLOCATE_BUFFER,
163+
};
164+
acpi_handle handle;
165+
166+
handle = acpi_device_handle(to_acpi_device_node(fwnode));
167+
if (acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf) == AE_OK) {
168+
domain->name = buf.pointer;
169+
domain->flags |= IRQ_DOMAIN_NAME_ALLOCATED;
170+
}
171+
172+
domain->fwnode = fwnode;
173+
#endif
158174
} else if (of_node) {
159175
char *name;
160176

0 commit comments

Comments
 (0)