diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2017-07-07 04:39:59 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2017-07-07 06:13:29 -0400 |
commit | c5c601c4295f89368f4a304cb3ae4aebdf80db22 (patch) | |
tree | 886596465ec8bf81ea22b09ae746ece14c8c6440 /kernel/irq/irqdomain.c | |
parent | f610c9d68b1a47f539b7764f4b5ce07d32fb9ae1 (diff) |
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
Diffstat (limited to 'kernel/irq/irqdomain.c')
-rw-r--r-- | kernel/irq/irqdomain.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index ed47688b8e79..f1f251479aa6 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #define pr_fmt(fmt) "irq: " fmt | 1 | #define pr_fmt(fmt) "irq: " fmt |
2 | 2 | ||
3 | #include <linux/acpi.h> | ||
3 | #include <linux/debugfs.h> | 4 | #include <linux/debugfs.h> |
4 | #include <linux/hardirq.h> | 5 | #include <linux/hardirq.h> |
5 | #include <linux/interrupt.h> | 6 | #include <linux/interrupt.h> |
@@ -155,6 +156,21 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, | |||
155 | domain->name = fwid->name; | 156 | domain->name = fwid->name; |
156 | break; | 157 | break; |
157 | } | 158 | } |
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 | ||
158 | } else if (of_node) { | 174 | } else if (of_node) { |
159 | char *name; | 175 | char *name; |
160 | 176 | ||