From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Larsson Date: Tue, 23 Oct 2012 10:16:50 +0000 Subject: Re: [PATCH v2] sparc: Add sparc support for platform_get_irq() Message-Id: <50866E92.7040502@gaisler.com> List-Id: References: <1350546164-8017-1-git-send-email-andreas@gaisler.com> In-Reply-To: <1350546164-8017-1-git-send-email-andreas@gaisler.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: sparclinux@vger.kernel.org On 2012-10-18 09:42, Andreas Larsson wrote: > This adds sparc support for platform_get_irq that in the normal case use > platform_get_resource() to get an irq. This standard approach fails for sparc as > there are no resources of type IORESOURCE_IRQ for irqs for sparc. > > Cross platform drivers can then use this standard platform function and work on > sparc instead of having to have a special case for sparc. Any comments? Is this a good idea, or do anyone see any problems with this change? It would make life easier when adapting device drivers to work on a sparc platform. Cheers, Andreas Larsson > Signed-off-by: Andreas Larsson > --- > drivers/base/platform.c | 6 ++++++ > 1 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index ddeca14..a17199a 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -82,9 +82,15 @@ EXPORT_SYMBOL_GPL(platform_get_resource); > */ > int platform_get_irq(struct platform_device *dev, unsigned int num) > { > +#ifdef CONFIG_SPARC > + if (!dev || num >= dev->archdata.num_irqs) > + return -ENXIO; > + return dev->archdata.irqs[num]; > +#else > struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num); > > return r ? r->start : -ENXIO; > +#endif > } > EXPORT_SYMBOL_GPL(platform_get_irq); >