[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20121113163112.GA20739@pengutronix.de>
Date: Tue, 13 Nov 2012 17:31:12 +0100
From: Wolfram Sang <w.sang@...gutronix.de>
To: Rob Herring <robherring2@...il.com>
Cc: Andreas Larsson <andreas@...sler.com>,
Ben Dooks <ben-linux@...ff.org>,
Peter Korsgaard <jacmet@...site.dk>, linux-i2c@...r.kernel.org,
Grant Likely <grant.likely@...retlab.ca>,
devicetree-discuss@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
software@...sler.com
Subject: Re: [PATCH v2 1/2] i2c: i2c-ocores: Add irq support for sparc
Hi,
> >> @@ -275,8 +276,8 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
> >> if (!res)
> >> return -ENODEV;
> >>
> >> - res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> >> - if (!res2)
> >> + irq = platform_get_irq(pdev, 0);
> >> + if (irq < 0)
> >> return -ENODEV;
> >
> > Why not pass the error code you got?
>
> I believe that should actually be a check for 'irq <= 0' as it returns
> NO_IRQ on error.
I wish it did, but (from 3.7-rc5):
79 /**
80 * platform_get_irq - get an IRQ for a device
81 * @dev: platform device
82 * @num: IRQ number index
83 */
84 int platform_get_irq(struct platform_device *dev, unsigned int num)
85 {
86 #ifdef CONFIG_SPARC
87 /* sparc does not have irqs represented as IORESOURCE_IRQ resources */
88 if (!dev || num >= dev->archdata.num_irqs)
89 return -ENXIO;
90 return dev->archdata.irqs[num];
91 #else
92 struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
93
94 return r ? r->start : -ENXIO;
95 #endif
96 }
97 EXPORT_SYMBOL_GPL(platform_get_irq);
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)
Powered by blists - more mailing lists