Commit 1f804706 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: adl_pci6208x: use comedi_timeout()

Use comedi_timeout() to wait for the analog output end-of-conversion.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f2426e4f
......@@ -73,19 +73,17 @@ struct pci6208_private {
unsigned int ao_readback[PCI6208_MAX_AO_CHANNELS];
};
static int pci6208_ao_wait_for_data_send(struct comedi_device *dev,
unsigned int timeout)
static int pci6208_ao_eoc(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned long context)
{
unsigned int status;
while (timeout--) {
status = inw(dev->iobase + PCI6208_AO_STATUS);
if ((status & PCI6208_AO_STATUS_DATA_SEND) == 0)
return 0;
udelay(1);
}
return -ETIME;
status = inw(dev->iobase + PCI6208_AO_STATUS);
if ((status & PCI6208_AO_STATUS_DATA_SEND) == 0)
return 0;
return -EBUSY;
}
static int pci6208_ao_insn_write(struct comedi_device *dev,
......@@ -102,8 +100,8 @@ static int pci6208_ao_insn_write(struct comedi_device *dev,
for (i = 0; i < insn->n; i++) {
val = data[i];
/* D/A transfer rate is 2.2us, wait up to 10us */
ret = pci6208_ao_wait_for_data_send(dev, 10);
/* D/A transfer rate is 2.2us */
ret = comedi_timeout(dev, s, insn, pci6208_ao_eoc, 0);
if (ret)
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment