From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753328AbbJMR4Q (ORCPT ); Tue, 13 Oct 2015 13:56:16 -0400 Received: from terminus.zytor.com ([198.137.202.10]:42999 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753191AbbJMR4L (ORCPT ); Tue, 13 Oct 2015 13:56:11 -0400 Date: Tue, 13 Oct 2015 10:55:21 -0700 From: tip-bot for Marc Zyngier Message-ID: Cc: graeme@xora.org.uk, marc.zyngier@arm.com, hpa@zytor.com, jiang.liu@linux.intel.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jakeo@microsoft.com, rjw@rjwysocki.net, tomasz.nowicki@linaro.org, tglx@linutronix.de, hanjun.guo@linaro.org, lorenzo.pieralisi@arm.com, mingo@kernel.org, jason@lakedaemon.net, Suravee.Suthikulpanit@amd.com Reply-To: hpa@zytor.com, graeme@xora.org.uk, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, jiang.liu@linux.intel.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, hanjun.guo@linaro.org, rjw@rjwysocki.net, jakeo@microsoft.com, tomasz.nowicki@linaro.org, jason@lakedaemon.net, mingo@kernel.org, Suravee.Suthikulpanit@amd.com, lorenzo.pieralisi@arm.com In-Reply-To: <1444737105-31573-4-git-send-email-marc.zyngier@arm.com> References: <1444737105-31573-4-git-send-email-marc.zyngier@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/core] irqdomain: Allow irq domain lookup by fwnode Git-Commit-ID: 130b8c6c8d86075304952241bf2365cea6489df1 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 Commit-ID: 130b8c6c8d86075304952241bf2365cea6489df1 Gitweb: http://git.kernel.org/tip/130b8c6c8d86075304952241bf2365cea6489df1 Author: Marc Zyngier AuthorDate: Tue, 13 Oct 2015 12:51:31 +0100 Committer: Thomas Gleixner CommitDate: Tue, 13 Oct 2015 19:01:23 +0200 irqdomain: Allow irq domain lookup by fwnode So far, our irq domains are still looked up by device node. Let's change this and allow a domain to be looked up using a fwnode_handle pointer. The existing interfaces are preserved with a couple of helpers. Signed-off-by: Marc Zyngier Reviewed-and-tested-by: Hanjun Guo Tested-by: Lorenzo Pieralisi Cc: Cc: Tomasz Nowicki Cc: Suravee Suthikulpanit Cc: Graeme Gregory Cc: Jake Oshins Cc: Jiang Liu Cc: Jason Cooper Cc: Rafael J. Wysocki Link: http://lkml.kernel.org/r/1444737105-31573-4-git-send-email-marc.zyngier@arm.com Signed-off-by: Thomas Gleixner --- include/linux/irqdomain.h | 11 +++++++++-- kernel/irq/irqdomain.c | 16 +++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 2f508f4..607c185 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -183,10 +183,17 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node, irq_hw_number_t first_hwirq, const struct irq_domain_ops *ops, void *host_data); -extern struct irq_domain *irq_find_matching_host(struct device_node *node, - enum irq_domain_bus_token bus_token); +extern struct irq_domain *irq_find_matching_fwnode(struct fwnode_handle *fwnode, + enum irq_domain_bus_token bus_token); extern void irq_set_default_host(struct irq_domain *host); +static inline struct irq_domain *irq_find_matching_host(struct device_node *node, + enum irq_domain_bus_token bus_token) +{ + return irq_find_matching_fwnode(node ? &node->fwnode : NULL, + bus_token); +} + static inline struct irq_domain *irq_find_host(struct device_node *node) { return irq_find_matching_host(node, DOMAIN_BUS_ANY); diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 1aee5c1..023ab6d 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -191,12 +191,12 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node, EXPORT_SYMBOL_GPL(irq_domain_add_legacy); /** - * irq_find_matching_host() - Locates a domain for a given device node - * @node: device-tree node of the interrupt controller + * irq_find_matching_fwnode() - Locates a domain for a given fwnode + * @fwnode: FW descriptor of the interrupt controller * @bus_token: domain-specific data */ -struct irq_domain *irq_find_matching_host(struct device_node *node, - enum irq_domain_bus_token bus_token) +struct irq_domain *irq_find_matching_fwnode(struct fwnode_handle *fwnode, + enum irq_domain_bus_token bus_token) { struct irq_domain *h, *found = NULL; int rc; @@ -212,12 +212,10 @@ struct irq_domain *irq_find_matching_host(struct device_node *node, */ mutex_lock(&irq_domain_mutex); list_for_each_entry(h, &irq_domain_list, link) { - struct device_node *of_node; - of_node = irq_domain_get_of_node(h); if (h->ops->match) - rc = h->ops->match(h, node, bus_token); + rc = h->ops->match(h, to_of_node(fwnode), bus_token); else - rc = ((of_node != NULL) && (of_node == node) && + rc = ((fwnode != NULL) && (h->fwnode == fwnode) && ((bus_token == DOMAIN_BUS_ANY) || (h->bus_token == bus_token))); @@ -229,7 +227,7 @@ struct irq_domain *irq_find_matching_host(struct device_node *node, mutex_unlock(&irq_domain_mutex); return found; } -EXPORT_SYMBOL_GPL(irq_find_matching_host); +EXPORT_SYMBOL_GPL(irq_find_matching_fwnode); /** * irq_set_default_host() - Set a "default" irq domain