Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1240802

[PATCH 03/16] irqdomain: Allow irq domain lookup by fwnode

From Marc Zyngier <marc.zyngier@arm.com>
Newsgroups linux.kernel
Subject [PATCH 03/16] irqdomain: Allow irq domain lookup by fwnode
Date 2015-10-06 19:50 +0200
Message-ID <qgExb-4Ib-5@gated-at.bofh.it> (permalink)
References <qgEnv-4wt-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <marc.zyngier@arm.com>
---
 include/linux/irqdomain.h | 11 +++++++++--
 kernel/irq/irqdomain.c    | 14 ++++++--------
 2 files changed, 15 insertions(+), 10 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..10b6105 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)));
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/16] Divorcing irqdomain and device_node Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:40 +0200
  [PATCH 12/16] irqchip/gic: Switch ACPI support to stacked domains Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:40 +0200
  [PATCH 13/16] irqchip/gic: Kill the xlate method Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:40 +0200
  [PATCH 08/16] irqdomain: Add a fwnode_handle allocator Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:40 +0200
    Re: [PATCH 08/16] irqdomain: Add a fwnode_handle allocator "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-10-12 22:10 +0200
  [PATCH 07/16] irqdomain: Introduce irq_domain_create_{linear,tree} Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:40 +0200
  [PATCH 03/16] irqdomain: Allow irq domain lookup by fwnode Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:50 +0200
    Re: [PATCH 03/16] irqdomain: Allow irq domain lookup by fwnode Marc Zyngier <marc.zyngier@arm.com> - 2015-10-13 09:40 +0200
  [PATCH 05/16] irqchip: Convert all alloc/xlate users from of_node to fwnode Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:50 +0200
    Re: [PATCH 05/16] irqchip: Convert all alloc/xlate users from of_node  to fwnode Hanjun Guo <hanjun.guo@linaro.org> - 2015-10-12 08:50 +0200
  [PATCH 06/16] irqdomain: Introduce irq_create_fwspec_mapping Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:50 +0200
  [PATCH 01/16] irqdomain: Use an accessor for the of_node field Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:50 +0200
    Re: [PATCH 01/16] irqdomain: Use an accessor for the of_node field Thomas Gleixner <tglx@linutronix.de> - 2015-10-09 16:30 +0200
      Re: [PATCH 01/16] irqdomain: Use an accessor for the of_node field Marc Zyngier <marc.zyngier@arm.com> - 2015-10-09 16:40 +0200
    Re: [PATCH 01/16] irqdomain: Use an accessor for the of_node field Hanjun Guo <hanjun.guo@linaro.org> - 2015-10-12 08:10 +0200
      Re: [PATCH 01/16] irqdomain: Use an accessor for the of_node field Marc Zyngier <marc.zyngier@arm.com> - 2015-10-12 11:40 +0200
  [PATCH 04/16] irqdomain: Introduce a firmware-specific IRQ specifier structure Marc Zyngier <marc.zyngier@arm.com> - 2015-10-06 19:50 +0200
  Re: [PATCH 00/16] Divorcing irqdomain and device_node Thomas Gleixner <tglx@linutronix.de> - 2015-10-11 23:10 +0200
    Re: [PATCH 00/16] Divorcing irqdomain and device_node Hanjun Guo <hanjun.guo@linaro.org> - 2015-10-12 04:50 +0200
      Re: [PATCH 00/16] Divorcing irqdomain and device_node Hanjun Guo <hanjun.guo@linaro.org> - 2015-10-12 09:20 +0200
    Re: [PATCH 00/16] Divorcing irqdomain and device_node Marc Zyngier <marc.zyngier@arm.com> - 2015-10-12 12:40 +0200
    Re: [PATCH 00/16] Divorcing irqdomain and device_node "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-10-12 22:20 +0200
      Re: [PATCH 00/16] Divorcing irqdomain and device_node Marc Zyngier <marc.zyngier@arm.com> - 2015-10-13 10:30 +0200

csiph-web