Thread (7 messages) 7 messages, 3 authors, 2012-11-13

Re: [PATCH v2 1/2] i2c: i2c-ocores: Add irq support for sparc

From: Wolfram Sang <hidden>
Date: 2012-11-13 16:31:31
Also in: linux-i2c, lkml

Hi,
quoted
quoted
@@ -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/  |

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help