staging: comedi: adl_pci9118: DMA requires an interrupt
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 9 Sep 2014 20:05:27 +0000 (13:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Sep 2014 21:34:23 +0000 (14:34 -0700)
In order for DMA to work we also need an interrupt. Refactor the code
so that the DMA allocation is only done if the interrupt is available.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/adl_pci9118.c

index 7a55c9c70c7e4c199da764fa45c66daadf4ff195..f924ad978a159250ca144376def4e4173be2c4f7 100644 (file)
@@ -1775,8 +1775,16 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq,
 
        pci9118_reset(dev);
 
-       if (master)
-               pci9118_alloc_dma(dev);
+       if (!disable_irq && pcidev->irq) {
+               ret = request_irq(pcidev->irq, pci9118_interrupt, IRQF_SHARED,
+                                 dev->board_name, dev);
+               if (ret == 0) {
+                       dev->irq = pcidev->irq;
+
+                       if (master)
+                               pci9118_alloc_dma(dev);
+               }
+       }
 
        if (ext_mux > 0) {
                if (ext_mux > 256)
@@ -1804,13 +1812,6 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq,
        pci_write_config_word(pcidev, PCI_COMMAND, u16w | 64);
                                /* Enable parity check for parity error */
 
-       if (!disable_irq && pcidev->irq) {
-               ret = request_irq(pcidev->irq, pci9118_interrupt, IRQF_SHARED,
-                                 dev->board_name, dev);
-               if (ret == 0)
-                       dev->irq = pcidev->irq;
-       }
-
        ret = comedi_alloc_subdevices(dev, 4);
        if (ret)
                return ret;