Commit 83b4d991 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ii_pci20kc: 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 90bc68ec
...@@ -190,20 +190,18 @@ static int ii20k_ao_insn_write(struct comedi_device *dev, ...@@ -190,20 +190,18 @@ static int ii20k_ao_insn_write(struct comedi_device *dev,
return insn->n; return insn->n;
} }
static int ii20k_ai_wait_eoc(struct comedi_device *dev, static int ii20k_ai_eoc(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
int timeout) struct comedi_insn *insn,
unsigned long context)
{ {
void __iomem *iobase = ii20k_module_iobase(dev, s); void __iomem *iobase = ii20k_module_iobase(dev, s);
unsigned char status; unsigned char status;
do {
status = readb(iobase + II20K_AI_STATUS_REG); status = readb(iobase + II20K_AI_STATUS_REG);
if ((status & II20K_AI_STATUS_INT) == 0) if ((status & II20K_AI_STATUS_INT) == 0)
return 0; return 0;
} while (timeout--); return -EBUSY;
return -ETIME;
} }
static void ii20k_ai_setup(struct comedi_device *dev, static void ii20k_ai_setup(struct comedi_device *dev,
...@@ -263,7 +261,7 @@ static int ii20k_ai_insn_read(struct comedi_device *dev, ...@@ -263,7 +261,7 @@ static int ii20k_ai_insn_read(struct comedi_device *dev,
/* generate a software start convert signal */ /* generate a software start convert signal */
readb(iobase + II20K_AI_PACER_RESET_REG); readb(iobase + II20K_AI_PACER_RESET_REG);
ret = ii20k_ai_wait_eoc(dev, s, 100); ret = comedi_timeout(dev, s, insn, ii20k_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