diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-10-22 15:36:52 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-10-29 16:03:13 +0800 |
commit | 48e08de087ad53b9893cbc44d5ce88e0b8d9f025 (patch) | |
tree | aa6e89c2452241f8917a09a402c7f427a6ff74b9 /drivers/staging/comedi/drivers/amplc_pci230.c | |
parent | 27913fa08cf56df2c925e2dad7827be87d7644c1 (diff) |
staging: comedi: amplc_pci230: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the sample to the async buffer.
The async events will set properly by the core. A dev_warn() message will
also be output by the core if the buffer overflows. Remove the unnecessary
events and dev_err() message in the driver.
The core will also add the COMEDI_CB_BLOCK event when data is written to
the async buffer. Remove the unnecessary event in the driver.
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>
Diffstat (limited to 'drivers/staging/comedi/drivers/amplc_pci230.c')
-rw-r--r-- | drivers/staging/comedi/drivers/amplc_pci230.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index f9b952f7173e..44c967f43d9a 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -2053,6 +2053,7 @@ static void pci230_handle_ai(struct comedi_device *dev, unsigned int i; unsigned int todo; unsigned int fifoamount; + unsigned short val; /* Determine number of samples to read. */ if (cmd->stop_src != TRIG_COUNT) { @@ -2099,12 +2100,10 @@ static void pci230_handle_ai(struct comedi_device *dev, fifoamount = 1; } } - /* Read sample and store in Comedi's circular buffer. */ - if (comedi_buf_put(s, pci230_ai_read(dev)) == 0) { - events |= COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW; - dev_err(dev->class_dev, "AI buffer overflow\n"); - break; - } + + val = pci230_ai_read(dev); + comedi_buf_write_samples(s, &val, 1); + fifoamount--; devpriv->ai_scan_pos++; if (devpriv->ai_scan_pos == scanlen) { @@ -2117,9 +2116,6 @@ static void pci230_handle_ai(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT && devpriv->ai_scan_count == 0) { /* End of acquisition. */ events |= COMEDI_CB_EOA; - } else { - /* More samples required, tell Comedi to block. */ - events |= COMEDI_CB_BLOCK; } async->events |= events; if (!(async->events & COMEDI_CB_CANCEL_MASK)) { |