* [PATCH 1/3]: sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping().
@ 2008-08-21 7:10 David Miller
2008-08-21 21:56 ` Anton Vorontsov
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2008-08-21 7:10 UTC (permalink / raw)
To: linuxppc-dev; +Cc: sparclinux, paulus
sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping().
This allows more OF layer code to be shared between powerpc and
sparc.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
arch/sparc/include/asm/prom.h | 8 ++++++++
arch/sparc/kernel/of_device.c | 11 +++++++++++
arch/sparc64/kernel/of_device.c | 11 +++++++++++
3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index b5efc4d..58b85fa 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -96,6 +96,14 @@ 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 int irq_of_parse_and_map(struct device_node *node, int index);
+#define irq_dispose_mapping(irq) do { } while (0)
+
/*
* NB: This is here while we transition from using asm/prom.h
* to linux/of.h
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index cc4c235..56e9a71 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -29,6 +29,17 @@ struct of_device *of_find_device_by_node(struct device_node *dp)
}
EXPORT_SYMBOL(of_find_device_by_node);
+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 0xffffffff;
+
+ 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);
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index f8b50cb..8a0d823 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -55,6 +55,17 @@ struct of_device *of_find_device_by_node(struct device_node *dp)
}
EXPORT_SYMBOL(of_find_device_by_node);
+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 0xffffffff;
+
+ 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);
--
1.5.6.5.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3]: sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping().
2008-08-21 7:10 David Miller
@ 2008-08-21 21:56 ` Anton Vorontsov
2008-08-21 21:59 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Anton Vorontsov @ 2008-08-21 21:56 UTC (permalink / raw)
To: David Miller; +Cc: sparclinux, linuxppc-dev, paulus
On Thu, Aug 21, 2008 at 12:10:17AM -0700, David Miller wrote:
>
> sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping().
>
> This allows more OF layer code to be shared between powerpc and
> sparc.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> arch/sparc/include/asm/prom.h | 8 ++++++++
> arch/sparc/kernel/of_device.c | 11 +++++++++++
> arch/sparc64/kernel/of_device.c | 11 +++++++++++
> 3 files changed, 30 insertions(+), 0 deletions(-)
>
> diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
> index b5efc4d..58b85fa 100644
> --- a/arch/sparc/include/asm/prom.h
> +++ b/arch/sparc/include/asm/prom.h
> @@ -96,6 +96,14 @@ 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 int irq_of_parse_and_map(struct device_node *node, int index);
On powerpc irq_of_parse_and_map() returns unsigned type.
> +#define irq_dispose_mapping(irq) do { } while (0)
I'd rather write it as a static inline function, for type checking,
plus, I think with this macros gcc may generate warnings about
defined but unused variables.
> +
> /*
> * NB: This is here while we transition from using asm/prom.h
> * to linux/of.h
> diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
> index cc4c235..56e9a71 100644
> --- a/arch/sparc/kernel/of_device.c
> +++ b/arch/sparc/kernel/of_device.c
> @@ -29,6 +29,17 @@ struct of_device *of_find_device_by_node(struct device_node *dp)
> }
> EXPORT_SYMBOL(of_find_device_by_node);
>
> +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 0xffffffff;
This is valid virq, unfortunately. There is only one invalid virq: 0.
With this most drivers will fail to identify 'there is no irq' case.
Does virq0 has special meaning on sparc?
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3]: sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping().
2008-08-21 21:56 ` Anton Vorontsov
@ 2008-08-21 21:59 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2008-08-21 21:59 UTC (permalink / raw)
To: avorontsov; +Cc: sparclinux, linuxppc-dev, paulus
From: Anton Vorontsov <avorontsov@ru.mvista.com>
Date: Fri, 22 Aug 2008 01:56:11 +0400
> On Thu, Aug 21, 2008 at 12:10:17AM -0700, David Miller wrote:
> > @@ -96,6 +96,14 @@ 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 int irq_of_parse_and_map(struct device_node *node, int index);
>
> On powerpc irq_of_parse_and_map() returns unsigned type.
>
> > +#define irq_dispose_mapping(irq) do { } while (0)
>
> I'd rather write it as a static inline function, for type checking,
> plus, I think with this macros gcc may generate warnings about
> defined but unused variables.
Thanks, I'll fix that.
> > +
> > /*
> > * NB: This is here while we transition from using asm/prom.h
> > * to linux/of.h
> > diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
> > index cc4c235..56e9a71 100644
> > --- a/arch/sparc/kernel/of_device.c
> > +++ b/arch/sparc/kernel/of_device.c
> > @@ -29,6 +29,17 @@ struct of_device *of_find_device_by_node(struct device_node *dp)
> > }
> > EXPORT_SYMBOL(of_find_device_by_node);
> >
> > +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 0xffffffff;
>
> This is valid virq, unfortunately. There is only one invalid virq: 0.
> With this most drivers will fail to identify 'there is no irq' case.
> Does virq0 has special meaning on sparc?
No, I'll fix this up, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3]: sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping().
@ 2008-08-22 4:21 David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2008-08-22 4:21 UTC (permalink / raw)
To: linuxppc-dev; +Cc: scottwood, paulus, sparclinux
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.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
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(-)
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index fd55522..b44e0c7 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -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
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index cc4c235..aace71f 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -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);
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index f8b50cb..a30f2af 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -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);
--
1.5.6.5.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-08-22 4:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-22 4:21 [PATCH 1/3]: sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping() David Miller
-- strict thread matches above, loose matches on Subject: below --
2008-08-21 7:10 David Miller
2008-08-21 21:56 ` Anton Vorontsov
2008-08-21 21:59 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).