Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752251AbdGGKSi (ORCPT ); Fri, 7 Jul 2017 06:18:38 -0400 Received: from terminus.zytor.com ([65.50.211.136]:33495 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbdGGKSg (ORCPT ); Fri, 7 Jul 2017 06:18:36 -0400 Date: Fri, 7 Jul 2017 03:16:15 -0700 From: tip-bot for Marc Zyngier Message-ID: Cc: majun258@huawei.com, john.garry@huawei.com, hpa@zytor.com, hanjun.guo@linaro.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, agustinv@codeaurora.org, mingo@kernel.org, marc.zyngier@arm.com Reply-To: mingo@kernel.org, agustinv@codeaurora.org, marc.zyngier@arm.com, majun258@huawei.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, john.garry@huawei.com, hpa@zytor.com, hanjun.guo@linaro.org In-Reply-To: <20170707083959.10349-1-marc.zyngier@arm.com> References: <20170707083959.10349-1-marc.zyngier@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/urgent] irqdomain: Allow ACPI device nodes to be used as irqdomain identifiers Git-Commit-ID: c5c601c4295f89368f4a304cb3ae4aebdf80db22 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2180 Lines: 63 Commit-ID: c5c601c4295f89368f4a304cb3ae4aebdf80db22 Gitweb: http://git.kernel.org/tip/c5c601c4295f89368f4a304cb3ae4aebdf80db22 Author: Marc Zyngier AuthorDate: Fri, 7 Jul 2017 09:39:59 +0100 Committer: Thomas Gleixner CommitDate: Fri, 7 Jul 2017 12:13:29 +0200 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 Signed-off-by: Marc Zyngier Signed-off-by: Thomas Gleixner Cc: Agustin Vega-Frias Cc: Ma Jun Cc: Hanjun Guo Link: http://lkml.kernel.org/r/20170707083959.10349-1-marc.zyngier@arm.com --- kernel/irq/irqdomain.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index ed47688..f1f2514 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -1,5 +1,6 @@ #define pr_fmt(fmt) "irq: " fmt +#include #include #include #include @@ -155,6 +156,21 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, 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;