Commit Graph

480992 Commits

Author SHA1 Message Date
H Hartley Sweeten 9a84a7d2e7 staging: comedi: comedi_parport: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the sample to the async buffer.

The async events COMEDI_CB_BLOCK and COMEDI_CB_EOS will be detected and set
by the core. Remove the unnecessary events 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>
2014-10-29 16:03:13 +08:00
H Hartley Sweeten 48e08de087 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>
2014-10-29 16:03:13 +08:00
H Hartley Sweeten 27913fa08c staging: comedi: amplc_pc236_common: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the sample to the async buffer.

The async events COMEDI_CB_BLOCK and COMEDI_CB_EOS will be detected and set
by the core. Remove the unnecessary events 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>
2014-10-29 16:03:13 +08:00
H Hartley Sweeten a9c3a015c1 staging: comedi: adv_pci1710: use comedi_buf_write_samples()
For aesthetics, use comedi_buf_write_samples() to add the sample to the
async buffer.

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>
2014-10-29 16:03:13 +08:00
H Hartley Sweeten 6aec0f9af4 staging: comedi: addi_apci_3xxx: use comedi_buf_write_samples()
For aesthetics, use comedi_buf_write_samples() to add the sample to the
async buffer.

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>
2014-10-29 16:03:12 +08:00
H Hartley Sweeten c4a58f281a staging: comedi: addi_apci_1564: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the sample to the async buffer.

The async events COMEDI_CB_BLOCK and COMEDI_CB_EOS will be detected and set
by the core. Remove the unnecessary events 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>
2014-10-29 16:03:12 +08:00
H Hartley Sweeten 6bb45f2b0c staging: comedi: addi_apci_1032: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the sample to the async buffer.

The async events COMEDI_CB_BLOCK and COMEDI_CB_EOS will be detected and set
by the core. Remove the unnecessary events 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>
2014-10-29 16:03:12 +08:00
H Hartley Sweeten f4add8df72 staging: comedi: comedi_fc.h: remove cfc_write_array_to_buffer()
The inline function is no longer used. Remove it.

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>
2014-10-29 16:03:12 +08:00
H Hartley Sweeten f81ac41b89 staging: comedi: usbduxfast: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer.
That function will determining the number of bytes to add based on the
bytes_per_sample().

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>
2014-10-29 16:03:12 +08:00
H Hartley Sweeten 504d0239f6 staging: comedi: usbduxsigma: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the sample to the async buffer.
That function will determining the number of bytes to add based on the
bytes_per_sample().

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>
2014-10-29 16:03:12 +08:00
H Hartley Sweeten 60e6644399 staging: comedi: gsc_hpdi: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer.
That function will handle the '* sizeof(foo)' calculation to determine
the number of bytes to add.

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>
2014-10-29 16:03:12 +08:00
H Hartley Sweeten d4c2acd233 staging: comedi: dt282x: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer.
That function will determining the number of bytes to add based on the
bytes_per_sample().

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>
2014-10-29 16:03:12 +08:00
H Hartley Sweeten 2e7b65e4bb staging: comedi: das16: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer.
That function will determining the number of bytes to add based on the
bytes_per_sample().

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>
2014-10-29 16:03:12 +08:00
H Hartley Sweeten b45a7beb3b staging: comedi: das16m1: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer.
The number of bytes to add is determined automatically based on the
number of samples and the bytes_per_sample().

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>
2014-10-29 16:03:12 +08:00
H Hartley Sweeten 5759a14d82 staging: comedi: hwdrv_apci3120: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer.
That function will handle the '* sizeof(foo)' calculation to determine
the number of bytes to add.

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>
2014-10-29 16:03:12 +08:00
H Hartley Sweeten 9fdfe0fd00 staging: comedi: adl_pci9111: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer.
The number of bytes to add is determined automatically based on the
number of samples and the bytes_per_sample().

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>
2014-10-29 16:03:11 +08:00
H Hartley Sweeten be591d5c42 staging: comedi: comedi_fc.h: remove cfc_write_to_buffer()
The inline function is no longer used. Remove it.

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>
2014-10-29 16:03:11 +08:00
H Hartley Sweeten 9caba32961 staging: comedi: ni_mio_common: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer.
That function will handle single and multi sample writes by determining
the number of bytes to add based on the bytes_per_sample().

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>
2014-10-29 16:03:11 +08:00
H Hartley Sweeten 7ba38a0144 staging: comedi: cb_pcidas64: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer.
That function will handle single and multi samples writes by determining
the number of bytes to add based on the bytes_per_sample().

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>
2014-10-29 16:03:11 +08:00
H Hartley Sweeten 28e8c8984c staging: comedi: adl_pci9118: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer.
The number of bytes to add is determined automatically based on the
number of samples and the bytes_per_sample().

Change the return type of move_block_from_dma() to void and remove the
unnecessary check of the return value of comedi_buf_write_samples().
The callers don't check the return and it's really not necessary. If
comedi_buf_write_samples() fails to allocate enough space in the async
buffer to add all the samples it sets the COMEDI_CB_OVERFLOW event.
This will cause the async command to (*cancel) when the events are
handled.

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>
2014-10-29 16:03:11 +08:00
H Hartley Sweeten 8d47c085e8 staging: comedi: cb_pcidas: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer.
That function will handle single and multi samples writes by determining
the number of bytes to add based on the number of samples and the
bytes_per_sample().

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>
2014-10-29 16:03:11 +08:00
H Hartley Sweeten 880f582068 staging: comedi: das1800: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the samples to the async buffer. That
function will handle single and multi samples writes by determining the number
of bytes to add based on the number of samples and the bytes_per_sample().

Also, remove the unnecessary COMEDI_CB_BLOCK event. comedi_buf_write_samples()
will automatically add that event after adding the samples to the async
buffer.

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>
2014-10-29 16:03:11 +08:00
H Hartley Sweeten b9357cba10 staging: comedi: ni_labpc_isadma: use comedi_buf_write_samples()
Use comedi_buf_write_samples() instead of cfc_write_to_buffer() to add all
the samples to the async buffer in one operation.

The core will 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>
2014-10-29 16:03:11 +08:00
H Hartley Sweeten 8d185f52dc staging: comedi: ni_labpc_common: use comedi_buf_write_samples()
Use comedi_buf_write_samples() instead of cfc_write_to_buffer() to add the
single sample to the async buffer.

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>
2014-10-29 16:03:11 +08:00
H Hartley Sweeten 0e017a4bbe staging: comedi: s626: use comedi_buf_write_samples()
Use comedi_buf_write_samples() instead of cfc_write_to_buffer() to add the
single sample to the async buffer.

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>
2014-10-29 16:03:11 +08:00
H Hartley Sweeten 7138e892a6 staging: comedi: ni_at_a2150: use comedi_buf_write_samples()
Use comedi_buf_write_samples() instead of cfc_write_to_buffer() to add the
single sample to the async buffer.

The core will 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>
2014-10-29 16:03:10 +08:00
H Hartley Sweeten ad9eb43c93 staging: comedi: das800: use comedi_buf_write_samples()
Use comedi_buf_write_samples() instead of cfc_write_to_buffer() to add the
single sample to the async buffer.

The core will add the COMEDI_CB_BLOCK event when data is written to the
async buffer. Remove the unnecessary event from 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>
2014-10-29 16:03:10 +08:00
H Hartley Sweeten 88f9662abb staging: comedi: comedi_test: use comedi_buf_write_samples()
Use comedi_buf_write_samples() instead of cfc_write_to_buffer() to add the
single sample to the async buffer.

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>
2014-10-29 16:03:10 +08:00
H Hartley Sweeten ce8bfa275a staging: comedi: comedi_fc.h: remove cfc_write_long_to_buffer()
The inline function is not used. Remove it.

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>
2014-10-29 16:03:10 +08:00
H Hartley Sweeten 5438da85fc staging: comedi: comedi_buf: introduce comedi_buf_write_samples()
Introduce a generic method to write samples to the async buffer.

The number of samples is first checked against the number of samples that
would fill the async buffer. The size of each sample is determined using
the bytes_per_sample() helper. If all the samples will fit in the async
buffer they are written to the buffer using comedi_write_array_to_buffer().

This will allow converting all the comedi drivers to use a common method to
write data to the async buffer.

Since comedi_write_array_to_buffer() sets the COMEDI_CB_BLOCK event after
writing the data, those events can be removed from the drivers.

In addition, comedi_inc_scan_progress() will automatically detect the end of
scan and set the COMEDI_CB_EOS event. Those events can also be removed from
the drivers.

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>
2014-10-29 16:03:10 +08:00
H Hartley Sweeten 0ca7f61cd6 staging: comedi: comedi_buf: comedi_buf_memcpy_from() remove 'offset' param
This parameter is always passed as '0'. Remove the unnecessary parameter.

This allows removing the unnecessary check of the read_ptr overflow.

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>
2014-10-29 16:01:20 +08:00
H Hartley Sweeten 319ad742bd staging: comedi: comedi_buf: comedi_buf_memcpy_to() remove 'offset' param
This parameter is always passed as '0'. Remove the unnecessary parameter.

This allows removing the unnecessary check of the write_ptr overflow.

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>
2014-10-29 16:01:20 +08:00
H Hartley Sweeten aa26e46b0f staging: comedi: comedi_buf: don't export comedi_buf_memcpy_to()
This function is only used internally. Remove the export.

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>
2014-10-29 16:01:20 +08:00
H Hartley Sweeten 9e2093d239 staging: comedi: comedi_buf: dont't export comedi_buf_memcpy_from()
This function is only used internally. Remove the export.

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>
2014-10-29 16:01:20 +08:00
H Hartley Sweeten 04c4166a22 staging: comedi: comedi_buf: remove comedi_buf_get()
This function is no longer used. Remove it.

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>
2014-10-29 16:01:20 +08:00
H Hartley Sweeten e463fbe419 staging: comedi: usbduxsigma: use comedi_buf_read_samples()
Use comedi_buf_read_samples() to read the analog output samples from
the async buffer. That function will set the COMEDI_CB_BLOCK event
when samples are read from the async buffer.

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>
2014-10-29 16:01:20 +08:00
H Hartley Sweeten 664ab5d6db staging: comedi: usbdux: use comedi_buf_read_samples()
Use comedi_buf_read_samples() to read the analog output samples from
the async buffer. That function will set the COMEDI_CB_BLOCK event
when samples are read from the async buffer.

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>
2014-10-29 16:01:20 +08:00
H Hartley Sweeten dec1a26686 staging: comedi: amplc_pci230: use comedi_buf_read_samples()
Use comedi_buf_read_samples() to read the analog output samples from
the async buffer. That function will set the COMEDI_CB_BLOCK event
when samples are read from the async buffer. In addition, the core
will also handle the end-of-scan detection and set the COMEDI_CB_EOS
event.

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>
2014-10-29 16:01:20 +08:00
H Hartley Sweeten e14c6a60b5 staging: comedi: ni_mio_common: use comedi_buf_read_samples()
Use comedi_buf_read_samples() to get the single samples from the async
buffer. The number of samples in the buffer was validated by the callers
so the error checking can be removed. In addition, the core will set the
COMEDI_CB_BLOCK event so it can also be removed.

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>
2014-10-29 16:01:19 +08:00
H Hartley Sweeten 8de27e7010 staging: comedi: comedi_buf: make comedi_buf_read_samples() always return full samples
A number of drivers currently use comedi_buf_get() to read single samples
from the the async buffer. This works but the drivers have to handle the
COMEDI_CB_BLOCK and COMEDI_CB_EOS events. Converting those drivers to use
comedi_buf_read_samples() moves the handling of those events into the core.

Modify comedi_buf_read_samples() so that the async buffer is checked for
the number of full samples available. Use that to clamp the number of
samples that will be read. This makes sure that only full samples are
read from the async buffer making comedi_buf_read_samples() mimic the
action of comedi_buf_get() with the added benifit of handling the events.

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>
2014-10-29 16:01:19 +08:00
H Hartley Sweeten 109bf06e2a staging: comedi: comedi_buf: absorb comedi_read_array_from_buffer()
This function is only called by comedi_buf_read_samples(). Absorb it.

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>
2014-10-29 16:01:19 +08:00
H Hartley Sweeten 2b3e13b860 staging: comedi: comedi_buf: remove export of comedi_read_array_from_buffer()
This function is only used internally. Remove the export.

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>
2014-10-29 16:01:19 +08:00
H Hartley Sweeten 65ad7c89aa staging: comedi: comedi_fc.h: remove cfc_read_array_from_buffer()
This inline function is no longer used. Remove it.

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>
2014-10-29 16:01:19 +08:00
H Hartley Sweeten ecb11d8c28 staging: comedi: dt282x: introduce dt282x_ao_setup_dma()
Introduce a helper function to read the analog output samples from the
async buffer and prep the DMA.

Use comedi_buf_read_samples() to read the analog output samples from
the async buffer.

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>
2014-10-29 16:01:19 +08:00
H Hartley Sweeten 7bd7d90562 staging: comedi: cb_pcidas: introduce cb_pcidas64_ao_fill_buffer()
Introduce a helper function to read the analog output samples from the
async buffer.

This fixes a bug in load_ao_dma_buffer(). That function was decrementing
the 'ao_count' by the number of bytes, not the number of samples, that
were read from the async buffer.

Use comedi_buf_read_samples() to read the analog output samples from
the async buffer.

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>
2014-10-29 16:01:19 +08:00
H Hartley Sweeten 2cc9854caf staging: comedi: cb_pcidas: introduce cb_pcidas_ao_load_fifo()
Introduce a helper function to load the analog output FIFO.

This fixes a bug in cb_pcidas_ao_inttrig(). That function was writing
'num_bytes' data values to the FIFO instead of 'num_points'. This results
in twice the number of data values getting written to the FIFO.

Use comedi_buf_read_samples() read the analog output samples from the async
buffer.

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>
2014-10-29 16:01:19 +08:00
H Hartley Sweeten bcdbe8848e staging: comedi: amplc_pci224: use comedi_buf_read_samples()
Use the new generic method to read the analog output samples from the async
buffer.

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>
2014-10-29 16:01:19 +08:00
H Hartley Sweeten 4455d7c351 staging: comedi: comedi_buf: introduce comedi_buf_read_samples()
Introduce a generic method to read samples from the async buffer.

The number of requested samples is clampled to the number of samples that
would fill the async buffer. The size of each sample is determined using
the bytes_per_sample() helper. The number of bytes need are then read
from the async buffer using comedi_read_array_from_buffer().

This will allow converting all the comedi drivers to use a common method
to read data from the async buffer.

Since comedi_read_array_from_buffer() sets the COMEDI_CB_BLOCK event after
reading the data, those events can be removed from the drivers.

In addition, comedi_inc_scan_progress() will automatically detect the end of
scan and set the COMEDI_CB_EOS event. Those events can also be removed from
the drivers.

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>
2014-10-29 16:01:19 +08:00
H Hartley Sweeten 22be3f8142 staging: comedi: addi_apci_3120: don't reset board when detaching driver
The comedi core calls all the subdevice (*cancel) functions before it does
the driver (*detach). There is no reason to call the board reset function
in the (*detach).

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>
2014-10-29 15:58:37 +08:00
H Hartley Sweeten a2eb0fd71c staging: comedi: addi_apci_3120: don't reset board when canceling ai command
The analog input (*cancel) stops the async command. There is not reason to also
call the board reset function.

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>
2014-10-29 15:58:37 +08:00