staging: comedi: pcl812: introduce pcl812_ai_soft_trig()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 4 Mar 2014 18:30:08 +0000 (11:30 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2014 01:06:16 +0000 (17:06 -0800)
Introduce a helper function to start a software triggered analog input
conversion.

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/pcl812.c

index b41dbbc5e38edb42e80e1a11d2a8cd3860f246cd..9fb3e848ac7ea66c20c62a8f30fe18439389b918 100644 (file)
@@ -643,6 +643,12 @@ static void pcl812_ai_clear_eoc(struct comedi_device *dev)
        outb(0, dev->iobase + PCL812_CLRINT);
 }
 
+static void pcl812_ai_soft_trig(struct comedi_device *dev)
+{
+       /* writing any value triggers a software conversion */
+       outb(255, dev->iobase + PCL812_SOFTTRIG);
+}
+
 static unsigned int pcl812_ai_get_sample(struct comedi_device *dev,
                                         struct comedi_subdevice *s)
 {
@@ -1028,8 +1034,7 @@ static int pcl812_ai_insn_read(struct comedi_device *dev,
 
        for (i = 0; i < insn->n; i++) {
                pcl812_ai_clear_eoc(dev);
-               /* start conversion */
-               outb(255, dev->iobase + PCL812_SOFTTRIG);
+               pcl812_ai_soft_trig(dev);
 
                ret = comedi_timeout(dev, s, insn, pcl812_ai_eoc, 0);
                if (ret)