Commit f19810d2 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

staging: comedi: das1800: reduce indent level of das1800_init_dma()



An IRQ and at least one DMA channel are required to use DMA with this driver.
Move the check to the caller to reduce the indent level of this function.

Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ffcc4b59
Loading
Loading
Loading
Loading
+65 −64
Original line number Diff line number Diff line
@@ -1240,8 +1240,6 @@ static int das1800_init_dma(struct comedi_device *dev, unsigned int dma0,
	struct das1800_private *devpriv = dev->private;
	unsigned long flags;

	/*  need an irq to do dma */
	if (dev->irq && dma0) {
	/* encode dma0 and dma1 into 2 digit hexadecimal for switch */
	switch ((dma0 & 0x7) | (dma1 << 4)) {
	case 0x5:	/*  dma0 == 5 */
@@ -1305,7 +1303,7 @@ static int das1800_init_dma(struct comedi_device *dev, unsigned int dma0,
		set_dma_mode(devpriv->dma1, DMA_MODE_READ);
	}
	release_dma_lock(flags);
	}

	return 0;
}

@@ -1437,9 +1435,12 @@ static int das1800_attach(struct comedi_device *dev,
		}
	}

	/* an irq and one dma channel is required to use dma */
	if (dev->irq & dma0) {
		ret = das1800_init_dma(dev, dma0, dma1);
		if (ret < 0)
			return ret;
	}

	if (devpriv->ai_buf0 == NULL) {
		devpriv->ai_buf0 =