[PATCH v2 4/9] drivers/of: Allow IRQ code to work properly on architectures without NO_IRQ
Grant Likely
grant.likely at secretlab.ca
Wed Aug 11 03:54:32 EST 2010
On Fri, Jul 23, 2010 at 4:15 PM, Stephen Neuendorffer
<stephen.neuendorffer at xilinx.com> wrote:
> Sane architectures don't rely on NO_IRQ. The device tree code shouldn't
> require it either.
I'm going to sit and think on this for a bit. I've got the same
problem in MIPS, and I want to use the same solution in both cases.
g.
> ---
> drivers/of/irq.c | 4 ++--
> drivers/of/platform.c | 4 ++--
> include/linux/of_irq.h | 6 ++++++
> 3 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> index 6cfb307..438b761 100644
> --- a/drivers/of/irq.c
> +++ b/drivers/of/irq.c
> @@ -37,7 +37,7 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
> struct of_irq oirq;
>
> if (of_irq_map_one(dev, index, &oirq))
> - return NO_IRQ;
> + return OF_NO_IRQ;
>
> return irq_create_of_mapping(oirq.controller, oirq.specifier,
> oirq.size);
> @@ -337,7 +337,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
>
> /* Only dereference the resource if both the
> * resource and the irq are valid. */
> - if (r && irq != NO_IRQ) {
> + if (r && irq != OF_NO_IRQ) {
> r->start = r->end = irq;
> r->flags = IORESOURCE_IRQ;
> r->name = dev->full_name;
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 9d3d932..cb305ae 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -488,7 +488,7 @@ struct of_device *of_device_alloc(struct device_node *np,
> /* First count how many resources are needed */
> while (of_address_to_resource(np, num_reg, &temp_res) == 0)
> num_reg++;
> - while (of_irq_to_resource(np, num_irq, &temp_res) != NO_IRQ)
> + while (of_irq_to_resource(np, num_irq, &temp_res) != OF_NO_IRQ)
> num_irq++;
>
> /* Allocate memory for both the struct device and the resource table */
> @@ -508,7 +508,7 @@ struct of_device *of_device_alloc(struct device_node *np,
> }
> for (i = 0; i < num_irq; i++, res++) {
> rc = of_irq_to_resource(np, i, res);
> - WARN_ON(rc == NO_IRQ);
> + WARN_ON(rc == OF_NO_IRQ);
> }
> }
>
> diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
> index 5929781..69e8a71 100644
> --- a/include/linux/of_irq.h
> +++ b/include/linux/of_irq.h
> @@ -8,6 +8,12 @@ struct of_irq;
> #include <linux/ioport.h>
> #include <linux/of.h>
>
> +#ifdef NO_IRQ
> +#define OF_NO_IRQ NO_IRQ
> +#else
> +#define OF_NO_IRQ 0
> +#endif
> +
> /*
> * irq_of_parse_and_map() is used ba all OF enabled platforms; but SPARC
> * implements it differently. However, the prototype is the same for all,
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
More information about the devicetree-discuss
mailing list