dmaengine: nbpfaxi: Use platform_get_irq_optional() to get the interrupt
[linux-2.6-microblaze.git] / drivers / dma / nbpfaxi.c
index 9c52c57..a7063e9 100644 (file)
@@ -1294,7 +1294,7 @@ static int nbpf_probe(struct platform_device *pdev)
        struct device_node *np = dev->of_node;
        struct nbpf_device *nbpf;
        struct dma_device *dma_dev;
-       struct resource *iomem, *irq_res;
+       struct resource *iomem;
        const struct nbpf_config *cfg;
        int num_channels;
        int ret, irq, eirq, i;
@@ -1335,13 +1335,11 @@ static int nbpf_probe(struct platform_device *pdev)
        nbpf->config = cfg;
 
        for (i = 0; irqs < ARRAY_SIZE(irqbuf); i++) {
-               irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
-               if (!irq_res)
-                       break;
-
-               for (irq = irq_res->start; irq <= irq_res->end;
-                    irq++, irqs++)
-                       irqbuf[irqs] = irq;
+               irq = platform_get_irq_optional(pdev, i);
+               if (irq < 0 && irq != -ENXIO)
+                       return irq;
+               if (irq > 0)
+                       irqbuf[irqs++] = irq;
        }
 
        /*