irqdomain: Allow ACPI device nodes to be used as irqdomain identifiers
[muen/linux.git] / kernel / irq / irqdomain.c
index ed47688b8e7981b24323153ec763a19505e2451a..f1f251479aa6009eddb81041f69e825ebb8d28b7 100644 (file)
@@ -1,5 +1,6 @@
 #define pr_fmt(fmt)  "irq: " fmt
 
 #define pr_fmt(fmt)  "irq: " fmt
 
+#include <linux/acpi.h>
 #include <linux/debugfs.h>
 #include <linux/hardirq.h>
 #include <linux/interrupt.h>
 #include <linux/debugfs.h>
 #include <linux/hardirq.h>
 #include <linux/interrupt.h>
@@ -155,6 +156,21 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
                        domain->name = fwid->name;
                        break;
                }
                        domain->name = fwid->name;
                        break;
                }
+#ifdef CONFIG_ACPI
+       } else if (is_acpi_device_node(fwnode)) {
+               struct acpi_buffer buf = {
+                       .length = ACPI_ALLOCATE_BUFFER,
+               };
+               acpi_handle handle;
+
+               handle = acpi_device_handle(to_acpi_device_node(fwnode));
+               if (acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf) == AE_OK) {
+                       domain->name = buf.pointer;
+                       domain->flags |= IRQ_DOMAIN_NAME_ALLOCATED;
+               }
+
+               domain->fwnode = fwnode;
+#endif
        } else if (of_node) {
                char *name;
 
        } else if (of_node) {
                char *name;