Skip to contentSkip to conversation

: sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping().

PATCH In review David Miller 1 participant 1 message Aug 22, 2008 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 1/3 : sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping().

sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping().

This allows more OF layer code to be shared between powerpc and sparc.

With feedback and suggestions from Anton Vorontsov.

---
 arch/sparc/include/asm/prom.h   |   10 ++++++++++
 arch/sparc/kernel/of_device.c   |   11 +++++++++++
 arch/sparc64/kernel/of_device.c |   11 +++++++++++
 3 files changed, 32 insertions(+), 0 deletions(-)
arch/sparc/include/asm/prom.h +10 -0
index fd55522..b44e0c7 100644
@@ -94,6 +94,16 @@ static inline void of_node_put(struct device_node *node)
 {
 }
 
+/* These routines are here to provide compatibility with how powerpc
+ * handles IRQ mapping for OF device nodes.  We precompute and permanently
+ * register them in the of_device objects, whereas powerpc computes them
+ * on request.
+ */
+extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
+static inline void irq_dispose_mapping(unsigned int virq)
+{
+}
+
 /*
  * NB:  This is here while we transition from using asm/prom.h
  * to linux/of.h
arch/sparc/kernel/of_device.c +11 -0
index cc4c235..aace71f 100644
@@ -29,6 +29,17 @@ struct of_device *of_find_device_by_node(struct device_node *dp)
 }
 EXPORT_SYMBOL(of_find_device_by_node);
 
+unsigned int irq_of_parse_and_map(struct device_node *node, int index)
+{
+	struct of_device *op = of_find_device_by_node(node);
+
+	if (!op || index >= op->num_irqs)
+		return 0;
+
+	return op->irqs[index];
+}
+EXPORT_SYMBOL(irq_of_parse_and_map);
+
 #ifdef CONFIG_PCI
 struct bus_type ebus_bus_type;
 EXPORT_SYMBOL(ebus_bus_type);
arch/sparc64/kernel/of_device.c +11 -0
index f8b50cb..a30f2af 100644
@@ -55,6 +55,17 @@ struct of_device *of_find_device_by_node(struct device_node *dp)
 }
 EXPORT_SYMBOL(of_find_device_by_node);
 
+unsigned int irq_of_parse_and_map(struct device_node *node, int index)
+{
+	struct of_device *op = of_find_device_by_node(node);
+
+	if (!op || index >= op->num_irqs)
+		return 0;
+
+	return op->irqs[index];
+}
+EXPORT_SYMBOL(irq_of_parse_and_map);
+
 #ifdef CONFIG_PCI
 struct bus_type ebus_bus_type;
 EXPORT_SYMBOL(ebus_bus_type);
Signature · 1 line
1.5.6.5.GIT