Dan Carpenter [Wed, 22 Oct 2014 14:23:07 +0000 (17:23 +0300)]
staging: lustre: validate size in ll_setxattr()
If size is smaller than the lov_user_md struct then we are reading
beyond the end of the buffer. I guess this is an information leak or it
could cause an Oops if the memory is not mapped.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Wed, 22 Oct 2014 08:11:39 +0000 (11:11 +0300)]
staging: lustre: validate size in lustre_posix_acl_xattr_filter()
This is mostly to silence static checker complaints.
In theory the problem here is that if size is in the 1-3 range then we
don't allocate enough memory for the posix_acl_xattr_header struct and
it results in memory corruption. But in reality kmalloc() return values
are aligned at sizeof(long) so corrupting this small amount of data is
not harmful.
The "size" variable should be type size_t. The value of size is checked
in setxattr() so we know it is a number between "0 - XATTR_SIZE_MAX".
There is no need to check for negative sizes.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Donald [Mon, 20 Oct 2014 16:42:36 +0000 (11:42 -0500)]
drivers: staging: lustre: Fix "spaces required around that '='" errors
Fix checkpatch.pl "spaces required around that '='" errors
Signed-off-by: Greg Donald <gdonald@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Donald [Mon, 20 Oct 2014 16:18:12 +0000 (11:18 -0500)]
drivers: staging: lustre: Fix "'foo * bar' should be 'foo *bar'" errors
Fix checkpatch.pl "'foo * bar' should be 'foo *bar'" errors
Signed-off-by: Greg Donald <gdonald@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Donald [Mon, 20 Oct 2014 15:58:13 +0000 (10:58 -0500)]
drivers: staging: lustre: Fix 'that open brace { should be on the previous line' errors
Fix checkpatch.pl 'that open brace { should be on the previous line' errors
Signed-off-by: Greg Donald <gdonald@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Donald [Mon, 20 Oct 2014 15:27:40 +0000 (10:27 -0500)]
drivers: staging: lustre: Fix "space prohibited before that close parenthesis ')'" errors
Fix checkpatch.pl "space prohibited before that close parenthesis ')'" errors
Signed-off-by: Greg Donald <gdonald@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Thu, 16 Oct 2014 07:56:25 +0000 (10:56 +0300)]
staging: lustre: silence a static checker warning
Static checkers warn that if cfs_cpt_table_print() returns an error
other than -EFBIG, then it would lead to a double free. This is true
but cfs_cpt_table_print() only returns -EFBIG on error so it also won't
happen in real life.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rickard Strandqvist [Sun, 12 Oct 2014 15:55:33 +0000 (17:55 +0200)]
staging: lustre: lustre: ptlrpc: sec.c: Replacing strncat with strlcat to avoid overwrite size
Changed from using strncat with strlcat to avoid overwrite the max size.
Take the opportunity to change a snprint to strlcpy.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Acked-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Anh Le [Sun, 12 Oct 2014 09:07:10 +0000 (16:07 +0700)]
Staging: lustre: llite: fix some sparse warnings about userspace pointer
Add __user macro to the function declarations that accept userspace pointers as
arguments.
Signed-off-by: Anh Le <anhlq2110@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Oleg Drokin [Sun, 12 Oct 2014 02:46:54 +0000 (22:46 -0400)]
staging/lustre/quota: Get rid of compat quota code
Nobody should be using any fo the old lustre 1.8 era tools
anymore, so drop compatibility with those.
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Oleg Drokin [Sun, 12 Oct 2014 02:46:53 +0000 (22:46 -0400)]
staging/lustre: get rid of deprecaed acl mount option code
This is long since unused code, so get rid of it.
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Oleg Drokin [Sun, 12 Oct 2014 02:46:52 +0000 (22:46 -0400)]
staging/lustre/ptlrpc: get rid of lustre 1.8 compatible checksums
Old version of lustre (1.8) calculated RPC checksums differently,
but the compat code is no longer important since in-kernel
version of lustre is nto compatible with 1.8 lustre servers
(that are long deprecated too).
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Filipe Gonçalves [Sat, 11 Oct 2014 21:33:39 +0000 (22:33 +0100)]
drivers/staging: Removed unnecessary check for LUSTRE_VERSION_CODE
Given that this code is now part of the kernel tree, the #ifdef directive comparing LUSTRE_VERSION_CODE to the kernel version is no longer needed.
As a side effect, this will also remove the sparse error "directive in argument list".
Signed-off-by: Filipe Gonçalves <filipe@codinghighway.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 28 Oct 2014 13:07:22 +0000 (13:07 +0000)]
staging: comedi: comedi_test: fix timer lock-up
Commit
240512474424 ("staging: comedi: comedi_test: use
comedi_handle_events()") resulted in the timer routine
`waveform_ai_interrupt()` calling `comedi_handle_events()` instead of
`comedi_events()`. That had the advantage of automatically stopping the
acquisition on overflow/error/end-of-acquisition conditions (by calling
the comedi subdevice's "cancel" handler), but currently results in the
timer routine locking when one of those conditions occur. This is
because the "cancel" handler `waveform_ai_cancel()` calls
`del_timer_sync()`.
Fix it by adding a bit to the device private data that indicates whether
the acquisition is active or not, and changing the "cancel" handler to
use `del_timer()` instead of `del_timer_sync()`. The bit is set when
starting the acquisition, cleared when ending the acquisition (in the
"cancel" handler), and tested in the timer routine, which will do
nothing if the acquisition is inactive. Also, make sure any scheduled
timeout event gets cancelled when the low-level device gets "detached"
from the comedi core by calling `del_timer_sync()` in the "detach"
handler `waveform_detach()`.
Fixes: 240512474424 ("staging: comedi: comedi_test: use comedi_handle_events()")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Thu, 23 Oct 2014 12:47:51 +0000 (13:47 +0100)]
staging: comedi: introduce some sample size manipulation functions
Introduce a few static inline helper functions:
`comedi_bytes_per_sample(s)` is the same as the existing
`bytes_per_sample(s)` and determines the size of a comedi sample in
bytes. (`bytes_per_sample(s)` will be removed.)
`comedi_sample_shift(s)` determines the log2 of the comedi sample size,
so it can be used in bit-shift operations to multiply or divide by the
sample size.
`comedi_bytes_to_samples(s, nbytes)` converts a number of bytes to a
number of samples (rounding down).
`comedi_samples_to_bytes(s, nsamples)` converts a number of samples to a
number of bytes.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Fri, 24 Oct 2014 17:26:05 +0000 (10:26 -0700)]
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>
H Hartley Sweeten [Fri, 24 Oct 2014 17:26:06 +0000 (10:26 -0700)]
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>
H Hartley Sweeten [Fri, 24 Oct 2014 17:26:04 +0000 (10:26 -0700)]
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>
H Hartley Sweeten [Thu, 23 Oct 2014 19:19:34 +0000 (12:19 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:18 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:17 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:16 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:15 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:14 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:13 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:12 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:11 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:10 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:08 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:07 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:06 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:05 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:04 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:03 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:02 +0000 (15:37 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:01 +0000 (15:37 -0700)]
staging: comedi: pcl726: 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. 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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:37:00 +0000 (15:37 -0700)]
staging: comedi: pcl711: 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. 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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:59 +0000 (15:36 -0700)]
staging: comedi: ni_atmio16d: 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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:58 +0000 (15:36 -0700)]
staging: comedi: ni_65xx: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the sample to the async buffer.
The async events COMEDI_CB_EOS will automatically be set by the core
with the end-of-scan is detected. 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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:57 +0000 (15:36 -0700)]
staging: comedi: ni_6527: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the sample to the async buffer.
The async events COMEDI_CB_EOS will automatically be set by the core
with the end-of-scan is detected. 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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:56 +0000 (15:36 -0700)]
staging: comedi: me4000: use comedi_buf_write_samples()
Use comedi_buf_write_samples() to add the sample to the async buffer.
The async events COMEDI_CB_OVERFLOW will be set by the core if the async
buffer overflows. A dev_warn() message will also be output by the core
if the buffer overflows. Remove the unnecessary event and the dev_err()
messages in the driver.
The core will also add the COMEDI_CB_BLOCK event when data is written
to the async buffer. Remove these unnecessary events 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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:55 +0000 (15:36 -0700)]
staging: comedi: dt3000: use comedi_buf_write_samples()
For aesthetics, use comedi_buf_write_samples() to add the sample to the
async buffer.
The core will set 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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:54 +0000 (15:36 -0700)]
staging: comedi: dmm32at: 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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:53 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:52 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:51 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:50 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:49 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:48 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:47 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:46 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:45 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:44 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:43 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:42 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:41 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:40 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:39 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:38 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:37 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:36 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:35 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:34 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:33 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:32 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:31 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:30 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:29 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:28 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:27 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:26 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:25 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 22:36:24 +0000 (15:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:51 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:50 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:49 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:48 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:47 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:46 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:45 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:44 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:43 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:42 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:41 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:40 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:39 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:38 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:37 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:36 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:35 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Wed, 22 Oct 2014 21:36:34 +0000 (14:36 -0700)]
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>
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:29 +0000 (11:34 -0700)]
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>
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:28 +0000 (11:34 -0700)]
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>
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:27 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: reset the board before hooking up the interrupt
Move the apci3120_reset() call in the (*auto_attach) to ensure that the board
is reset before hooking up the interrupt.
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>
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:26 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: tidy up timer subdevice init
It appears that this subdevice is actually broken. The subdevice functions
all violate the comedi API and, it they did work, it appears they would
break the analog input async commands.
For now just tidy up the subdevice init.
Add the SDF_READABLE subdev_flag, this subdevice provides an (*insn_read).
Fix the subdevice 'maxdata' initialization. The timer is 24-bits.
Remove the 'len_chanlist' initialization. This member is only used by
subdevices that support async commands.
Also remove the 'range_table' initialization. The core will set it to
range_unknown which is appropriate.
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>
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:25 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: tidy up analog input subdevice init
For aesthetics, add some white space to the analog input subdevice
initialization.
The async command support in this driver is pretty messed up. I'm not
really sure if it actually works yet. Luckly this driver was not
setting the SDF_CMD_READ subdev_flag so the command support was not
actually getting enabled.
The command support only works if an interrupt is available. Refactor
the subdevice init so that the command support is only hooked up if
we have an interrupt. For now always disable the command support. Once
the driver has been cleaned up the command will be enabled.
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>
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:24 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: tidy up digital output subdevice init
For aesthetics, add some white space to the digital output subdevice
initialization.
Remove the subdev_flags SDF_GROUND and SDF_COMMON. These only apply to
analog subdevices. Also remove the unnecessary SDF_READABLE subdev_flag.
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>
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:23 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: tidy up digital input subdevice init
For aesthetics, add some white space to the digital input subdevice
initialization.
Remove the subdev_flags SDF_GROUND and SDF_COMMON. These only apply to
analog subdevices.
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>
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:22 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: tidy up analog output subdevice init
For aesthetics, add some white space to the analog output subdevice
initialization.
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>
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:21 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: provide analog output 'readback'
Use the comedi_subdevice 'readback' member and the core provided (*insn_read)
function to provide radback of the analog output channels.
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>