diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-02-10 19:49:03 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-14 18:28:43 +0100 |
commit | fe45e153d424a009a22c0dfd86b0034926fd2342 (patch) | |
tree | ceaba5446d049c43e52c305f79c55c343b7eb307 /drivers | |
parent | staging: comedi: adl_pci6208x: use comedi_timeout() (diff) | |
download | linux-fe45e153d424a009a22c0dfd86b0034926fd2342.tar.xz linux-fe45e153d424a009a22c0dfd86b0034926fd2342.zip |
staging: comedi: das16: use comedi_timeout()
Use comedi_timeout() to wait for the analog input end-of-conversion.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/comedi/drivers/das16.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index a8446ca04110..6a7d652ff564 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -856,18 +856,17 @@ static void das16_ai_munge(struct comedi_device *dev, } } -static int das16_ai_wait_for_conv(struct comedi_device *dev, - unsigned int timeout) +static int das16_ai_eoc(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned long context) { unsigned int status; - int i; - for (i = 0; i < timeout; i++) { - status = inb(dev->iobase + DAS16_STATUS_REG); - if (!(status & DAS16_STATUS_BUSY)) - return 0; - } - return -ETIME; + status = inb(dev->iobase + DAS16_STATUS_REG); + if ((status & DAS16_STATUS_BUSY) == 0) + return 0; + return -EBUSY; } static int das16_ai_insn_read(struct comedi_device *dev, @@ -897,7 +896,7 @@ static int das16_ai_insn_read(struct comedi_device *dev, /* trigger conversion */ outb_p(0, dev->iobase + DAS16_TRIG_REG); - ret = das16_ai_wait_for_conv(dev, 1000); + ret = comedi_timeout(dev, s, insn, das16_ai_eoc, 0); if (ret) return ret; |