[PATCH 03/67 v2] staging: comedi: pcl818: fix board resource region request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some of the PCL-818 compatible boards have a FIFO that can be used
when running analog input async commands. This FIFO increased the
resource range used by the driver.

Request the correct resources used by the board even if the FIFO is
not used. This prevents another driver from trying to use the I/O
space.

Modify the attach so that the 'usefifo' flag is only set if we have
and IRQ, the board has a FIFO, and the user wahts to use it.

Fix pcl818_reset() so that the FIFO is always flushed and disabled
if it exists.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/pcl818.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c
index c9f1412..226bee1 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -1085,10 +1085,10 @@ end:
 static void pcl818_reset(struct comedi_device *dev)
 {
 	const struct pcl818_board *board = comedi_board(dev);
-	struct pcl818_private *devpriv = dev->private;
 	unsigned long timer_base = dev->iobase + PCL818_TIMER_BASE;
 
-	if (devpriv->usefifo) {	/*  FIFO shutdown */
+	/* flush and disable the FIFO */
+	if (board->has_fifo) {
 		outb(0, dev->iobase + PCL818_FI_INTCLR);
 		outb(0, dev->iobase + PCL818_FI_FLUSH);
 		outb(0, dev->iobase + PCL818_FI_ENABLE);
@@ -1180,12 +1180,8 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	if (!devpriv)
 		return -ENOMEM;
 
-	/* should we use the FIFO? */
-	if (board->has_fifo && it->options[2] == -1)
-		devpriv->usefifo = 1;
-
 	ret = comedi_request_region(dev, it->options[0],
-				    devpriv->usefifo ? 0x20 : 0x10);
+				    board->has_fifo ? 0x20 : 0x10);
 	if (ret)
 		return ret;
 
@@ -1197,6 +1193,10 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 			dev->irq = it->options[1];
 	}
 
+	/* should we use the FIFO? */
+	if (dev->irq && board->has_fifo && it->options[2] == -1)
+		devpriv->usefifo = 1;
+
 	/* we need an IRQ to do DMA on channel 3 or 1 */
 	if (dev->irq && board->has_dma &&
 	    (it->options[2] == 3 || it->options[2] == 1)) {
-- 
1.8.5.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux