lkml.org 
[lkml]   [2012]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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/ |
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2012-11-13 18:21    [W:0.120 / U:0.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site