Эх сурвалжийг харах

irqdomain: Convert irqdomain-%3Eof_node to fwnode

Now that we have everyone accessing the of_node field via the
irq_domain_get_of_node accessor, it is pretty easy to swap it
for a pointer to a fwnode_handle.

This translates into a few limited changes in __irq_domain_add,
and an updated irq_domain_get_of_node.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-and-tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: <linux-arm-kernel@lists.infradead.org>
Cc: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Cc: Graeme Gregory <graeme@xora.org.uk>
Cc: Jake Oshins <jakeo@microsoft.com>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Link: http://lkml.kernel.org/r/1444737105-31573-3-git-send-email-marc.zyngier@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Marc Zyngier 10 жил өмнө
parent
commit
f110711a60

+ 3 - 2
include/linux/irqdomain.h

@@ -34,6 +34,7 @@
 
 
 #include <linux/types.h>
 #include <linux/types.h>
 #include <linux/irqhandler.h>
 #include <linux/irqhandler.h>
+#include <linux/of.h>
 #include <linux/radix-tree.h>
 #include <linux/radix-tree.h>
 
 
 struct device_node;
 struct device_node;
@@ -130,7 +131,7 @@ struct irq_domain {
 	unsigned int flags;
 	unsigned int flags;
 
 
 	/* Optional data */
 	/* Optional data */
-	struct device_node *of_node;
+	struct fwnode_handle *fwnode;
 	enum irq_domain_bus_token bus_token;
 	enum irq_domain_bus_token bus_token;
 	struct irq_domain_chip_generic *gc;
 	struct irq_domain_chip_generic *gc;
 #ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
 #ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
@@ -163,7 +164,7 @@ enum {
 
 
 static inline struct device_node *irq_domain_get_of_node(struct irq_domain *d)
 static inline struct device_node *irq_domain_get_of_node(struct irq_domain *d)
 {
 {
-	return d->of_node;
+	return to_of_node(d->fwnode);
 }
 }
 
 
 #ifdef CONFIG_IRQ_DOMAIN
 #ifdef CONFIG_IRQ_DOMAIN

+ 5 - 1
kernel/irq/irqdomain.c

@@ -46,17 +46,21 @@ struct irq_domain *__irq_domain_add(struct device_node *of_node, int size,
 				    void *host_data)
 				    void *host_data)
 {
 {
 	struct irq_domain *domain;
 	struct irq_domain *domain;
+	struct fwnode_handle *fwnode;
 
 
 	domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
 	domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
 			      GFP_KERNEL, of_node_to_nid(of_node));
 			      GFP_KERNEL, of_node_to_nid(of_node));
 	if (WARN_ON(!domain))
 	if (WARN_ON(!domain))
 		return NULL;
 		return NULL;
 
 
+	of_node_get(of_node);
+	fwnode = of_node ? &of_node->fwnode : NULL;
+
 	/* Fill structure */
 	/* Fill structure */
 	INIT_RADIX_TREE(&domain->revmap_tree, GFP_KERNEL);
 	INIT_RADIX_TREE(&domain->revmap_tree, GFP_KERNEL);
 	domain->ops = ops;
 	domain->ops = ops;
 	domain->host_data = host_data;
 	domain->host_data = host_data;
-	domain->of_node = of_node_get(of_node);
+	domain->fwnode = fwnode;
 	domain->hwirq_max = hwirq_max;
 	domain->hwirq_max = hwirq_max;
 	domain->revmap_size = size;
 	domain->revmap_size = size;
 	domain->revmap_direct_max_irq = direct_max;
 	domain->revmap_direct_max_irq = direct_max;