Commit 90bc68ec authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: das800: use comedi_timeout()

Use comedi_timeout() to wait for the analog input 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 fe45e153
...@@ -556,15 +556,17 @@ static irqreturn_t das800_interrupt(int irq, void *d) ...@@ -556,15 +556,17 @@ static irqreturn_t das800_interrupt(int irq, void *d)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int das800_wait_for_conv(struct comedi_device *dev, int timeout) static int das800_ai_eoc(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned long context)
{ {
int i; unsigned int status;
for (i = 0; i < timeout; i++) { status = inb(dev->iobase + DAS800_STATUS);
if (!(inb(dev->iobase + DAS800_STATUS) & BUSY)) if ((status & BUSY) == 0)
return 0; return 0;
} return -EBUSY;
return -ETIME;
} }
static int das800_ai_insn_read(struct comedi_device *dev, static int das800_ai_insn_read(struct comedi_device *dev,
...@@ -599,7 +601,7 @@ static int das800_ai_insn_read(struct comedi_device *dev, ...@@ -599,7 +601,7 @@ static int das800_ai_insn_read(struct comedi_device *dev,
/* trigger conversion */ /* trigger conversion */
outb_p(0, dev->iobase + DAS800_MSB); outb_p(0, dev->iobase + DAS800_MSB);
ret = das800_wait_for_conv(dev, 1000); ret = comedi_timeout(dev, s, insn, das800_ai_eoc, 0);
if (ret) if (ret)
return 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