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/ |
signature.asc
Description: Digital signature
_______________________________________________ devicetree-discuss mailing list [email protected] https://lists.ozlabs.org/listinfo/devicetree-discuss
