uio_pdrv_genirq: get irq through platform resource if not set otherwise
authorBenedikt Spranger <b.spranger@linutronix.de>
Mon, 14 May 2012 16:48:17 +0000 (18:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 15 May 2012 15:44:58 +0000 (08:44 -0700)
Platform devices are configured through platform resources. The interrupt
in the driver uio_pdrv_genirq is instead configured through a side channel
i.e. the platform data structure. Make it possible to use the generic
configuration scheme via platform resource.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: "Hans J. Koch" <hjk@hansjkoch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/uio/uio_pdrv_genirq.c

index b98371d93a9278a525fa70b6e2265994bacb1ec2..42202cd831586940bdf87b2cc04bc8e89c40808b 100644 (file)
@@ -146,6 +146,14 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
        priv->flags = 0; /* interrupt is enabled to begin with */
        priv->pdev = pdev;
 
+       if (!uioinfo->irq) {
+               ret = platform_get_irq(pdev, 0);
+               if (ret < 0) {
+                       dev_err(&pdev->dev, "failed to get IRQ\n");
+                       goto bad0;
+               }
+               uioinfo->irq = ret;
+       }
        uiomem = &uioinfo->mem[0];
 
        for (i = 0; i < pdev->num_resources; ++i) {