platform/kernel/linux-starfive.git
10 years agostaging: comedi: comedi_fc.h: remove cfc_write_to_buffer()
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>
10 years agostaging: comedi: ni_mio_common: use comedi_buf_write_samples()
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>
10 years agostaging: comedi: cb_pcidas64: use comedi_buf_write_samples()
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>
10 years agostaging: comedi: adl_pci9118: use comedi_buf_write_samples()
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>
10 years agostaging: comedi: cb_pcidas: use comedi_buf_write_samples()
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>
10 years agostaging: comedi: das1800: use comedi_buf_write_samples()
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>
10 years agostaging: comedi: ni_labpc_isadma: use comedi_buf_write_samples()
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>
10 years agostaging: comedi: ni_labpc_common: use comedi_buf_write_samples()
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>
10 years agostaging: comedi: s626: use comedi_buf_write_samples()
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>
10 years agostaging: comedi: ni_at_a2150: use comedi_buf_write_samples()
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>
10 years agostaging: comedi: das800: use comedi_buf_write_samples()
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>
10 years agostaging: comedi: comedi_test: use comedi_buf_write_samples()
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>
10 years agostaging: comedi: comedi_fc.h: remove cfc_write_long_to_buffer()
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>
10 years agostaging: comedi: comedi_buf: introduce comedi_buf_write_samples()
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>
10 years agostaging: comedi: comedi_buf: comedi_buf_memcpy_from() remove 'offset' param
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>
10 years agostaging: comedi: comedi_buf: comedi_buf_memcpy_to() remove 'offset' param
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>
10 years agostaging: comedi: comedi_buf: don't export comedi_buf_memcpy_to()
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>
10 years agostaging: comedi: comedi_buf: dont't export comedi_buf_memcpy_from()
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>
10 years agostaging: comedi: comedi_buf: remove comedi_buf_get()
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>
10 years agostaging: comedi: usbduxsigma: use comedi_buf_read_samples()
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>
10 years agostaging: comedi: usbdux: use comedi_buf_read_samples()
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>
10 years agostaging: comedi: amplc_pci230: use comedi_buf_read_samples()
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>
10 years agostaging: comedi: ni_mio_common: use comedi_buf_read_samples()
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>
10 years agostaging: comedi: comedi_buf: make comedi_buf_read_samples() always return full samples
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>
10 years agostaging: comedi: comedi_buf: absorb comedi_read_array_from_buffer()
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>
10 years agostaging: comedi: comedi_buf: remove export of comedi_read_array_from_buffer()
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>
10 years agostaging: comedi: comedi_fc.h: remove cfc_read_array_from_buffer()
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>
10 years agostaging: comedi: dt282x: introduce dt282x_ao_setup_dma()
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>
10 years agostaging: comedi: cb_pcidas: introduce cb_pcidas64_ao_fill_buffer()
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>
10 years agostaging: comedi: cb_pcidas: introduce cb_pcidas_ao_load_fifo()
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>
10 years agostaging: comedi: amplc_pci224: use comedi_buf_read_samples()
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>
10 years agostaging: comedi: comedi_buf: introduce comedi_buf_read_samples()
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>
10 years agostaging: comedi: addi_apci_3120: don't reset board when detaching driver
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>
10 years agostaging: comedi: addi_apci_3120: don't reset board when canceling ai command
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>
10 years agostaging: comedi: addi_apci_3120: reset the board before hooking up the interrupt
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>
10 years agostaging: comedi: addi_apci_3120: tidy up timer subdevice init
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>
10 years agostaging: comedi: addi_apci_3120: tidy up analog input subdevice init
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>
10 years agostaging: comedi: addi_apci_3120: tidy up digital output subdevice init
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>
10 years agostaging: comedi: addi_apci_3120: tidy up digital input subdevice init
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>
10 years agostaging: comedi: addi_apci_3120: tidy up analog output subdevice init
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>
10 years agostaging: comedi: addi_apci_3120: provide analog output 'readback'
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>
10 years agostaging: comedi: addi_apci_3120: fix apci3120_ao_insn_write()
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:20 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: fix apci3120_ao_insn_write()

The comedi core expects (*insn_write) functions to write insn->n values and
return the number of values written or an errno. This function currently
returns insn->n but it only writes a single data value.

Fix the function to work like the core expects.

There are two registers used to update the analog outputs. Offset 0x08 is
used to update channels 0-3 and offset 0x0a to update channels 4-7. Bits
14 and 15 in each register set the mux to select which channel to update.
The lower 14 bits are the value used to set the DAC.

For aesthetics, tidy up the defines used for the register offsets and bits
in the registers.

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>
10 years agostaging: comedi: addi_apci_3120: remove analog output reset
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:19 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: remove analog output reset

The apci3120_reset() function is called at the end of the (*auto_attach) and
with the (*detach) is called to unload the driver. Part of this function
resets all the analog output channels to 0V.

There are two problems with this.
1) Only the APCI-3120 has analog outputs, the APCI-3001 does not.
2) The DA_READY bit in the status register needs to be checked before each
   write to update the analog outputs. It's unknown what the DA_READY bit
   does on the APCI-3001 board.

Just remove the analog output reset to avoid any problems.

Also, remove the unnecessary udelay() in apci3120_reset().

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>
10 years agostaging: comedi: addi_apci_3120: prevent deadlock in apci3120_ao_insn_write()
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:18 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: prevent deadlock in apci3120_ao_insn_write()

The DA_READY bit (0x0001) in the status register needs to be set before the
analog outputs can be updated.

Use comedi_timeout() to prevent a deadlock condition while waiting for the
DA_READY bit to get set.

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>
10 years agostaging: comedi: addi_apci_3120: remove private data 'iobase'
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:17 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: remove private data 'iobase'

This member of the private data holds the start address of PCI BAR 1 that is
used to access the board registers. The start address is also stored in the
comedi_device 'iobase' member. Use that instead and remove the private data
member.

Remove some unnecessary casts when reading the board registers.

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>
10 years agostaging: comedi: addi_apci_3120: rename private data 'i_IobaseAmcc'
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:16 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: rename private data 'i_IobaseAmcc'

This member of the private data holds the start address of PCI BAR 0 that is
used to access the AMCC registers.

Rename this CamelCase member and fix its type.

Remove an unnecessary local variable, 'ui_Tmp', in apci3120_cyclic_ai() and
tidy up the rest of the local variable declarations.

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>
10 years agostaging: comedi: addi_apci_3120: rename private data 'i_IobaseAddon'
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:15 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: rename private data 'i_IobaseAddon'

This member of the private data holds the start address of PCI BAR 2 that is
used to access the AMCC Add-On registers.

Rename this CamelCase member and fix its type.

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>
10 years agostaging: comedi: addi_apci_3120: use correct iobase to read board register
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:14 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: use correct iobase to read board register

The board registers are accessed using the bse address devpriv->iobase not
devpriv->i_IobaseAmcc. Fix a read in apci3120_interrupt() that is using the
wrong base address.

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>
10 years agostaging: comedi: addi_apci_3120: use correct iobase to write AMCC registers
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:13 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: use correct iobase to write AMCC registers

The AMCC registers are accessed using the base address devpriv->i_IobaseAmcc
not devpriv->i_IobaseAddon. Fix a couple writes in apci3120_interrupt_dma()
that are using the wrong base address.

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>
10 years agostaging: comedi: addi_apci_3120: remove private data 'i_IobaseReserved'
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:12 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: remove private data 'i_IobaseReserved'

This member of the private data is not used by the driver. 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>
10 years agostaging: comedi: addi_apci_3120: remove unipolar range from analog outputs
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:11 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: remove unipolar range from analog outputs

The analog outputs of the APCI-3120 have a 14-bit bipolar range and use straight
binary values (0x0000 = -10V to 0x3fff = +10V) to set the outputs. This driver
tries to fake a unipolar range by munging the comedi data values to only output
0V to +10V signals (0x0000 to 0x1fff values are munged to 0x2000 - 0x3fff).

This causes problems with the comedilib API functions that convert between comedi
values and physical values. It's also possible for the user to pass a data value
that would get munged and actually change the wrong channel.

Fix this by change the subdevice range_table to range_bipolar10 and remove the
munging in apci3120_ao_insn_write().

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>
10 years agostaging: comedi: addi_apci_3120: remove unused struct definition
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:10 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: remove unused struct definition

The struct str_AnalogReadInformation is not used in this driver.
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>
10 years agostaging: comedi: addi_apci_3120: introduce struct apci3120_dmabuf
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:09 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: introduce struct apci3120_dmabuf

For aesthetics, wrap the DMA buffer information in a struct.

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>
10 years agostaging: comedi: addi_apci_3120: DMA requires an interrupt
H Hartley Sweeten [Mon, 20 Oct 2014 18:34:08 +0000 (11:34 -0700)]
staging: comedi: addi_apci_3120: DMA requires an interrupt

An interrupt is required for DMA to work.

Factor out the DMA buffer allocation from the (*auto_attach) and only
allocate the buffers if the interrupt is available.

For aesthetics, also factor the DMA buffer free from 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>
10 years agostaging: comedi: ni_65xx: remove deadcode in ni_65xx_intr_cmdtest()
H Hartley Sweeten [Mon, 20 Oct 2014 22:02:14 +0000 (15:02 -0700)]
staging: comedi: ni_65xx: remove deadcode in ni_65xx_intr_cmdtest()

Reported-by: coverity (CID 142963)
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>
10 years agostaging: comedi: ni_6527: remove deadcode in ni6527_intr_cmdtest()
H Hartley Sweeten [Mon, 20 Oct 2014 22:03:15 +0000 (15:03 -0700)]
staging: comedi: ni_6527: remove deadcode in ni6527_intr_cmdtest()

Reported-by: coverity (CID 142962)
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>
10 years agostaging: comedi: ni_mio_common: remove deadcode in ni_cdio_cmdtest()
H Hartley Sweeten [Mon, 20 Oct 2014 22:04:30 +0000 (15:04 -0700)]
staging: comedi: ni_mio_common: remove deadcode in ni_cdio_cmdtest()

Reported-by: coverity (CID 142967)
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>
10 years agostaging: comedi: addi_apci_035: remove driver
H Hartley Sweeten [Mon, 20 Oct 2014 17:37:43 +0000 (10:37 -0700)]
staging: comedi: addi_apci_035: remove driver

According to ADDI-DATA, this board was discontinued last year and they
feel that no further development is needed for this driver. Remove the
driver from comedi to help with the addi-data cleanup.

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>
10 years agostaging: comedi: usbduxsigma: introduce usbduxsigma_ai_handle_urb()
H Hartley Sweeten [Tue, 14 Oct 2014 19:14:41 +0000 (12:14 -0700)]
staging: comedi: usbduxsigma: introduce usbduxsigma_ai_handle_urb()

Factor the urb handling and resubmit out of the analog input urb
completion handler and tidy it up. This allows a common exit path
to be used in the completion handler to stop the async command and
handle the events.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: Bernd Porr <mail@berndporr.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbduxsigma: introduce usbduxsigma_ao_handle_urb()
H Hartley Sweeten [Tue, 14 Oct 2014 19:14:40 +0000 (12:14 -0700)]
staging: comedi: usbduxsigma: introduce usbduxsigma_ao_handle_urb()

Factor the urb handling and resubmit out of the analog output urb
completion handler and tidy it up. This allows a common exit path
to be used in the completion handler to stop the async command and
handle the events.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: Bernd Porr <mail@berndporr.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbduxfast: introduce usbduxfast_ai_handle_urb()
H Hartley Sweeten [Tue, 14 Oct 2014 19:14:39 +0000 (12:14 -0700)]
staging: comedi: usbduxfast: introduce usbduxfast_ai_handle_urb()

Factor the urb handling and resubmit out of the completion handler and
tidy it up. This allows a common exit path to be used in the completion
handler to stop the async command and handle the events.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: Bernd Porr <mail@berndporr.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: introduce usbduxsub_ai_handle_urb()
H Hartley Sweeten [Tue, 14 Oct 2014 19:14:38 +0000 (12:14 -0700)]
staging: comedi: usbdux: introduce usbduxsub_ai_handle_urb()

Factor the urb handling and resubmit out of the analog input urb
completion handler and tidy it up. This allows a common exit path
to be used in the completion handler to stop the async command and
handle the events.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: Bernd Porr <mail@berndporr.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: introduce usbduxsub_ao_handle_urb()
H Hartley Sweeten [Tue, 14 Oct 2014 19:14:37 +0000 (12:14 -0700)]
staging: comedi: usbdux: introduce usbduxsub_ao_handle_urb()

Factor the urb handling and resubmit out of the analog output urb
completion handler and tidy it up. This allows a common exit path
to be used in the completion handler to stop the async command and
handle the events.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: Bernd Porr <mail@berndporr.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_common.h: remove file
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:50 +0000 (10:44 -0700)]
staging: comedi: addi_common.h: remove file

This header is no longer included by any of the addi-data drivers.
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>
10 years agostaging: comedi: addi_apci_3120: separate from addi_common.h
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:49 +0000 (10:44 -0700)]
staging: comedi: addi_apci_3120: separate from addi_common.h

Remove the need to include addi_common.h by introducing a new private
data definition. Only include the members that are actually used by
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>
10 years agostaging: comedi: addi_apci_1500: separate from addi_common.h
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:48 +0000 (10:44 -0700)]
staging: comedi: addi_apci_1500: separate from addi_common.h

Remove the need to include addi_common.h by introducing a new private
data definition. Only include the members that are actually used by
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>
10 years agostaging: comedi: addi_apci_035: separate from addi_common.h
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:47 +0000 (10:44 -0700)]
staging: comedi: addi_apci_035: separate from addi_common.h

Remove the need to include addi_common.h by introducing a new private
data definition. Only include the members that are actually used by
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>
10 years agostaging: comedi: addi_apci_3120: simplify analog input boardinfo
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:46 +0000 (10:44 -0700)]
staging: comedi: addi_apci_3120: simplify analog input boardinfo

There are two boards supported by this driver. One with 16-bit analog
inputs and the other 12-bit analog inputs.

Add a bit field flag, 'ai_is_16bit', to the boardinfo and remove the
'i_AiMaxdata' member. Use the new flag to initialize tne analog input
subdevice maxdata correctly.

For aesthetics, adjust the whitespace in the boardinfo declaration.

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>
10 years agostaging: comedi: addi_apci_3120: simplify analog output boardinfo
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:45 +0000 (10:44 -0700)]
staging: comedi: addi_apci_3120: simplify analog output boardinfo

There are two boards supported by this driver. One with eight 14-bit analog
outputs and the other without analog outputs.

Add a bit field flag, 'has_ao', to the boardinfo and remove the 'i_NbrAoChannel'
and 'i_AoMaxdata' members. Use the new flag to determine if the analog output
subdevice needs to be initialized and open code the n_chan and maxdata.

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>
10 years agostaging: comedi: addi_apci_3120: remove boardinfo 'i_AiChannelList'
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:44 +0000 (10:44 -0700)]
staging: comedi: addi_apci_3120: remove boardinfo 'i_AiChannelList'

All boardinfo entries have this member set as '16'. This is also the Analog
Input 'n_chan'. For aesthetics, initialize the Analog Input 'len_chanlist'
with s->n_chan and remove the boardinfo 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>
10 years agostaging: comedi: addi_apci_3120: remove boardinfo 'i_NbrAiChannel'
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:43 +0000 (10:44 -0700)]
staging: comedi: addi_apci_3120: remove boardinfo 'i_NbrAiChannel'

All boardinfo entries have this member set as '16'. This will initialize
the Analog Input 'n_chan' and cause the 'i_NbrAiChannelDiff' member to
never get used. Remove both members and initialize the Analog Input 'n_chan'
with 16 directly.

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>
10 years agostaging: comedi: addi_apci_3120: remove boardinfo 'i_NbrDiChannel'
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:42 +0000 (10:44 -0700)]
staging: comedi: addi_apci_3120: remove boardinfo 'i_NbrDiChannel'

All boardinfo entries have this member set as '4'. Remove the member and
initialize the Digial Input 'n_chan' with 4 directly.

Also, remove the initialization of 'len_chanlist'. This member is only
used with 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>
10 years agostaging: comedi: addi_apci_3120: remove boardinfo 'i_NbrDoChannel'
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:41 +0000 (10:44 -0700)]
staging: comedi: addi_apci_3120: remove boardinfo 'i_NbrDoChannel'

All boardinfo entries have this member set as '4'. Remove the member and
initialize the Digial Output 'n_chan' with 4 directly.

Also, remove the initialization of 'len_chanlist'. This member is only
used with 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>
10 years agostaging: comedi: addi_apci_3120: remove boardinfo 'i_DoMaxdata'
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:40 +0000 (10:44 -0700)]
staging: comedi: addi_apci_3120: remove boardinfo 'i_DoMaxdata'

The maxdata for a Digital Output subdevice is always '1'. Remove this
incorrect boardinfo.

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>
10 years agostaging: comedi: addi_common.h: remove unused members from addi_private
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:39 +0000 (10:44 -0700)]
staging: comedi: addi_common.h: remove unused members from addi_private

Remove all the unused members from the addi_private definition.

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>
10 years agostaging: comedi: addi_common.h: remove boardinfo definition
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:38 +0000 (10:44 -0700)]
staging: comedi: addi_common.h: remove boardinfo definition

The addi_board definition is not only used by the addi_apci_3120 driver.

Introduce a private definition in that driver and remove the global definition
from addi_common.h.

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>
10 years agostaging: comedi: hwdrv_apci3120: remove need for boardinfo access
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:37 +0000 (10:44 -0700)]
staging: comedi: hwdrv_apci3120: remove need for boardinfo access

The apci3120_ai_insn_config() function is broken in this driver. It does
not follow the comedi API and will fail to work correctly.

For now just remove the need for the boardinfo access to allow additional
cleanup. The 'i_NbrAiChannel' is actually the subdevice 'n_chan' use that
instead and remove the boardinfo access.

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>
10 years agostaging: comedi: addi_eeprom: remove source file
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:36 +0000 (10:44 -0700)]
staging: comedi: addi_eeprom: remove source file

This source file is no longer included by any of the addi-data drivers.
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>
10 years agostaging: comedi: addi_apci_035: remove boardinfo
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:35 +0000 (10:44 -0700)]
staging: comedi: addi_apci_035: remove boardinfo

The hardware has an eeprom but the boardinfo properly defines the subdevice
support so reading the eeprom and setting the 's_EeParameters' use is not
necessary. Since the boardinfo only has one entry its not really necessary.
Also, providing a subdevice the read the eeprom is not really interesting.

Remove the eeprom support code along with the boardinfo and initialize the
subdevices directly.

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>
10 years agostaging: comedi: addi_apci_1500: remove boardinfo
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:34 +0000 (10:44 -0700)]
staging: comedi: addi_apci_1500: remove boardinfo

The hardware does not have an eeprom so the 's_EeParameters' use is not
necessary. Remove it.

Since the boardinfo only has one entry its not really necessary. Remove
it and initialize the subdevices directly.

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>
10 years agostaging: comedi: addi_common.h: remove boardinfo member 'i_PCIEeprom'
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:33 +0000 (10:44 -0700)]
staging: comedi: addi_common.h: remove boardinfo member 'i_PCIEeprom'

This member of the boardinfo is not used by any of the drivers. 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>
10 years agostaging: comedi: addi_apci_035: board has eeprom
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:32 +0000 (10:44 -0700)]
staging: comedi: addi_apci_035: board has eeprom

As indicated in the boardinfo, the hardware has an eeprom. Simplify
the board attach code and remove the boardinfo.

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>
10 years agostaging: comedi: addi_apci_1500: remove eeprom support
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:31 +0000 (10:44 -0700)]
staging: comedi: addi_apci_1500: remove eeprom support

As indicated in the boardinfo, the hardware does not have an eeprom. Remove
the subdevice and support code for 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>
10 years agostaging: comedi: addi_common.h: remove boardinfo 'i_IorangeBase1'
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:30 +0000 (10:44 -0700)]
staging: comedi: addi_common.h: remove boardinfo 'i_IorangeBase1'

This member of the boardinfo is used as a flag to determine what PCI BAR
to use for the main 'iobase' used by the driver.

Remove the boardinfo member and refactor the (*auto_attach) of the drivers
to use the correct PCI BAR.

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>
10 years agostaging: comedi: addi_common.h: rename boardinfo 'pc_DriverName'
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:29 +0000 (10:44 -0700)]
staging: comedi: addi_common.h: rename boardinfo 'pc_DriverName'

Rename this CamelCase member of the boardinfo.

The comedi_device 'board_name' is set to this member during the (*auto_attach)
of the addi-data that still use this boardinfo drivers. For aesthetics, use
the dev->board_name instead of the boardinfo in 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>
10 years agostaging: comedi: addi_apci_1500: remove unused subdevices
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:28 +0000 (10:44 -0700)]
staging: comedi: addi_apci_1500: remove unused subdevices

Only allocate space for the subdevicess used by the driver. Remove all
the COMEDI_SUBD_UNUSED 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>
10 years agostaging: comedi: addi_apci_1500: remove unnecessary subdevice initialization
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:27 +0000 (10:44 -0700)]
staging: comedi: addi_apci_1500: remove unnecessary subdevice initialization

The subdevices that don't initialize any of the callbacks don't really
exist. Remove the unnecessary initialzation and just set the type to
COMEDI_SUBD_UNUSED.

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>
10 years agostaging: comedi: addi_apci_035: remove unused subdevices
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:26 +0000 (10:44 -0700)]
staging: comedi: addi_apci_035: remove unused subdevices

Only allocate space for the subdevicess used by the driver. Remove all
the COMEDI_SUBD_UNUSED 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>
10 years agostaging: comedi: addi_apci_035: remove unnecessary subdevice initialization
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:25 +0000 (10:44 -0700)]
staging: comedi: addi_apci_035: remove unnecessary subdevice initialization

The subdevices that don't initialize any of the callbacks don't really
exist. Remove the unnecessary initialzation and just set the type to
COMEDI_SUBD_UNUSED.

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>
10 years agostaging: comedi: addi_common.h: remove subdevice callbacks from struct addi_board
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:24 +0000 (10:44 -0700)]
staging: comedi: addi_common.h: remove subdevice callbacks from struct addi_board

None of the drivers that still include this header use the subdevice callbacks.
Remove all of them to reduce the bloat.

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>
10 years agostaging: comedi: addi_apci_1500: remove subdevice callbacks from boardinfo
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:23 +0000 (10:44 -0700)]
staging: comedi: addi_apci_1500: remove subdevice callbacks from boardinfo

This driver only has one boardinfo entry so the subdevice callbacks are
always the same. Remvoe the callbacks from the boardinfo and use them
directly when initializing the subdevices.

Remove all the subdevice callback initialization that would be set to
NULL.

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>
10 years agostaging: comedi: addi_apci_035: remove subdevice callbacks from boardinfo
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:22 +0000 (10:44 -0700)]
staging: comedi: addi_apci_035: remove subdevice callbacks from boardinfo

This driver only has one boardinfo entry so the subdevice callbacks are
always the same. Remvoe the callbacks from the boardinfo and use them
directly when initializing the subdevices.

Remove all the subdevice callback initialization that would be set to
NULL.

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>
10 years agostaging: comedi: addi_common.c: remove included source file
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:21 +0000 (10:44 -0700)]
staging: comedi: addi_common.c: remove included source file

The addi_apci_035 and addi_apci_1500 are the only drivers left that
include this source file. Copy the i_ADDIDATA_InsnReadEeprom() function
from that file to those drivers and remove the addi_common.c file.

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>
10 years agostaging: comedi: addi_common.c: remove v_ADDI_Interrupt()
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:20 +0000 (10:44 -0700)]
staging: comedi: addi_common.c: remove v_ADDI_Interrupt()

The addi_apci_035 and addi_apci_1500 are the only drivers left that use
this function in addi_common.c. The function simply calls the 'interrupt'
function that is in the boardinfo of the driver. Both drivers use the
same 'interrupt' function for all boardnfo entries.

Remove the i_ADDI_Reset() function as well as the 'interrupt' boardinfo
and use the 'interrupt' function directly when doing the request_irq().

In addition, the addi_apci_3120 driver has a private v_ADDI_Interrupt()
function that is doing the same thing. Remove that one as well.

Fix the return type of 'interrupt' functions in the drivers and add the
return vaules.

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>
10 years agostaging: comedi: addi_common.c: remove addi_auto_attach()
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:19 +0000 (10:44 -0700)]
staging: comedi: addi_common.c: remove addi_auto_attach()

The addi_apci_035 and addi_apci_1500 are the only drivers left that use
this function in addi_common.c. The addi_common code adds a lot of bloat
to the drivers.

Copy the addi_auto_attach() code to the (*auto_attach) functions of the
drivers and remove the function. This will help with removing the bloat.

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>
10 years agostaging: comedi: addi_common.c: remove i_ADDI_Reset()
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:18 +0000 (10:44 -0700)]
staging: comedi: addi_common.c: remove i_ADDI_Reset()

The addi_apci_035 and addi_apci_1500 are the only drivers left that use
this function in addi_common.c. The function simply calls the 'reset'
function that is in the boardinfo of the driver. Both drivers use the
same 'reset' function for all boardnfo entries.

Remove the i_ADDI_Reset() function as well as the 'reset' boardinfo and
just call the 'reset' function directly.

The i_ADDI_Reset() is called by addi_auto_attach() in addi_common.c after
a sucessful attach. Modify the (*auto_attach) in the drivers to call the
'reset' function directly and remove it from addi_auto_attach().

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>
10 years agostaging: comedi: addi_common.c: remove i_ADDI_Detach()
H Hartley Sweeten [Tue, 14 Oct 2014 17:44:17 +0000 (10:44 -0700)]
staging: comedi: addi_common.c: remove i_ADDI_Detach()

The addi_apci_035 and addi_apci_1500 are the only drivers left that use
this function in addi_common.c. Remove the function an add a private
comedi_driver (*detach) function to those 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>
10 years agostaging: comedi: addi_apci_3200: remove driver
H Hartley Sweeten [Tue, 14 Oct 2014 17:11:26 +0000 (10:11 -0700)]
staging: comedi: addi_apci_3200: remove driver

This driver has some serious bitrot. In addition, it's not in the Kconfig
or Makefile so it can't even be built.

Just remove it. It would be easier to rewrite the driver than fix 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>
10 years agostaging: comedi: comedidev.h: clarify async->event error/cancel detection
H Hartley Sweeten [Mon, 13 Oct 2014 16:56:08 +0000 (09:56 -0700)]
staging: comedi: comedidev.h: clarify async->event error/cancel detection

Introduce COMEDI_CB_ERROR_MASK and COMEDI_CB_CANCEL_MASK to clarify the
async->events that indicate errors and cancel an async command.

Use the new defines to tidy up and clarify the code.

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>
10 years agostaging: comedi: comedidev.h: don't expose COMEDI_CB_* defines to userspace
H Hartley Sweeten [Mon, 13 Oct 2014 16:56:07 +0000 (09:56 -0700)]
staging: comedi: comedidev.h: don't expose COMEDI_CB_* defines to userspace

The COMEDI_CB_* defines are the comedi_async "events" that the drivers set
to let the core detect the state of running async commands. These "events"
are only relevant to the kernel modules and should not be exposed to
userspace in the comedi.h user API header.

Move the defines to comedidev.h to avoid exposing them. For aesthetics,
convert the defines to bit shifts to better indicate that they are bitmask
values. Cleanup the documentation.

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>