staging: comedi: pcl812: use comedi_buf_write_samples()

For aesthetics, use comedi_buf_write_samples() to add the sample to the
async buffer.

The core will add the COMEDI_CB_BLOCK event when data is written to the
async buffer. Remove the nnecessary 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>
staging: comedi: pcl816: use comedi_buf_write_samples()

For aesthetics, use comedi_buf_write_samples() to add the 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>
staging: comedi: pcl818: use comedi_buf_write_samples()

For aesthetics, use comedi_buf_write_samples() to add the 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>
staging: comedi: quatech_daqp_cs: use comedi_buf_write_samples()

For aesthetics, use comedi_buf_write_samples() to add the 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>
staging: comedi: rtd520: 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>
staging: comedi: usbdux: 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>
staging: comedi: hwdrv_apci3120: use comedi_buf_write_samples()

Use comedi_buf_write_samples() to add the samples to the async buffer.

The COMEDI_CB_EOS and COMEDI_CB_OVERFLOW events will be automatically
handled by the core. Remove the unecessary handling 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>
staging: comedi: addi_apci_2032: use comedi_buf_write_samples()

The dev->read_subdev used in this driver for async commands returns the
full scan with each sample so it should have the SDF_PACKED subdev_flag
set.

Add the missing subdev_flags and use comedi_buf_write_samples() to add
the sample to the async buffer.

The core sets the async events appropriately. Remove the unnecessary
event handling 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>
staging: comedi: amplc_dio200_common: use comedi_buf_write_samples()

The dev->read_subdev used in this driver for async commands returns the
full scan with each sample so it should have the SDF_PACKED subdev_flag
set.

Add the missing subdev_flags and 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.

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>
staging: comedi: ni_pcidio: use comedi_buf_write_samples()

Use comedi_buf_write_samples() to add the sample to the async buffer. The 32-bit
sample size is automatically determined due to the subddev_flag SDF_LSAMPL.

The async event COMEDI_CB_BLOCK will be automatically set by the core. Remove the
unnecessary event in the driver.

This driver also has the SDF_PACKED subdev_flag set so the core will automatically
set the COMEDI_CB_EOS event after adding the 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>
staging: comedi: pcmmio: use comedi_buf_write_samples()

The dev->read_subdev used in this driver for async commands returns 32-bit samples
and should have the SDF_LSAMPL subdev_flag set. It also returns the full scan with
each sample so it should have the SDF_PACKED subdev_flag set.

Add the missing subdev_flags and use comedi_buf_write_samples() to add the sample
to the async buffer.

The COMEDI_CB_BLOCK and COMEDI_CB_EOS events will be automatically handled 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>
staging: comedi: pcmuio: use comedi_buf_write_samples()

The dev->read_subdev used in this driver for async commands returns 32-bit samples
and should have the SDF_LSAMPL subdev_flag set. It also returns the full scan with
each sample so it should have the SDF_PACKED subdev_flag set.

Add the missing subdev_flags and use comedi_buf_write_samples() to add the sample
to the async buffer.

The COMEDI_CB_BLOCK and COMEDI_CB_EOS events will be automatically handled 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>
staging: comedi: comedi_buf: remove comedi_buf_put()

All comedi drivers now use comedi_buf_write_samples() to add the samples to
the async buffer. Remove this unused 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>
staging: comedi: comedi_buf: don't export comedi_write_array_to_buffer()

All the comedi drivers have been converted to use comedi_buf_write_samples().
This function is now only used internally by comedi_buf. Remvoe 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>
staging: comedi: comedi_buf: absorb comedi_write_array_to_buffer()

This function is only called by comedi_buf_write_samples(). Absorb it.

The buffer overflow was already checked so the overflow check of
comedi_buf_write_alloc() can 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>
staging: comedi: comedi_buf: absorb __comedi_buf_write_alloc()

This function is only called by comedi_buf_write_alloc(). Absorb it and remove
the unused 'strict' parameter.

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>
staging: comedi: me4000: fix firmware downloading

Convert this driver to use comedi_load_firmware() to download the firmware
to the board.

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>
staging: comedi: addi_apci_1564: remove APCI1564_COUNTER[1234] defines

These defines don't add any significant clarity to the driver. Remove them.

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>
staging: comedi: addi_apci_1564: board has 3 timers

According to ADDI-DATA, the APCI-1564 only has 3 timers. There are some
customer specific boards with 4 timers but they use out of tree drivers.

Now that the timer 'channels' are handled correctly in the subdevice
functions, fix the number of timer channels for the subdevice and remove
the code that would access a 4th timer.

Also, remove the unnecessary initialzation of the subdevice 'len_chanlist'.
That member is only used by subdevices that support async commands.

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>
staging: comedi: addi_apci_1564: remove private data 'mode_select_register'

This driver currently passes the timer channel as the data[5] element to the
timer (*insn_config) function. This is stored in the private data and use in
the timer (*insn_read) and (*insn_write) functions to read/write the timer.

This is just wrong, comedi passes the channel number in the insn->chanspec.
Use that instead and remove the private data member.

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>