[PATCH v2 1/2] i2c: i2c-ocores: Add irq support for sparc
Wolfram Sang
w.sang at pengutronix.de
Wed Nov 14 03:31:12 EST 2012
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/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20121113/05d244d6/attachment-0001.sig>
More information about the devicetree-discuss
mailing list