public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel•crashing.org>
To: Andy Fleming <afleming@freescale•com>
Cc: linuxppc-dev@ozlabs•org
Subject: Re: [PATCH] of_irq_to_resource now returns the virq
Date: Tue, 07 Nov 2006 11:04:22 +1100	[thread overview]
Message-ID: <1162857862.28571.376.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.61.0611061711510.10818@ld0175-tx32.am.freescale.net>

On Mon, 2006-11-06 at 17:13 -0600, Andy Fleming wrote:
> Mostly this is to allow for error checking (check the return for NO_IRQ)
> 
> Signed-off-by: Andrew Fleming <afleming@freescale•com>
> ---
> For 2.6.20
> 
>  include/asm-powerpc/prom.h |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
> index 933ba27..e9226e3 100644
> --- a/include/asm-powerpc/prom.h
> +++ b/include/asm-powerpc/prom.h
> @@ -334,10 +334,17 @@ extern int of_irq_map_one(struct device_
>  struct pci_dev;
>  extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
>  
> -static inline void of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
> +static inline int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
>  {
> -	r->start = r->end = irq_of_parse_and_map(dev, index);
> -	r->flags = IORESOURCE_IRQ;
> +	int irq = irq_of_parse_and_map(dev, index);
> +
> +	/* Only dereference the resource if the irq is valid. */
> +	if (irq != NO_IRQ) {

What about if (irq != NO_IRQ && r) ?
 
> +		r->start = r->end = irq;
> +		r->flags = IORESOURCE_IRQ;
> +	}
> +
> +	return irq;
>  }

That way, if somebody doesn't care about the resource, just pass NULL,
though I suppose we should then also change the name of the function to
something like of_map_one_irq() ..

Ben.

  reply	other threads:[~2006-11-07  0:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-06 23:13 [PATCH] of_irq_to_resource now returns the virq Andy Fleming
2006-11-07  0:04 ` Benjamin Herrenschmidt [this message]
2006-11-07 20:56   ` Andy Fleming
  -- strict thread matches above, loose matches on Subject: below --
2006-11-07 22:57 Andy Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1162857862.28571.376.camel@localhost.localdomain \
    --to=benh@kernel$(echo .)crashing.org \
    --cc=afleming@freescale$(echo .)com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox