platform/kernel/linux-starfive.git
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>
10 years agostaging: comedi: drivers: comedi_bond.c: Changed from using strncat to strlcat
Rickard Strandqvist [Sun, 12 Oct 2014 12:23:24 +0000 (14:23 +0200)]
staging: comedi: drivers: comedi_bond.c: Changed from using strncat to strlcat

Changed from using strncat to strlcat to simplify the code

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Reviewed-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: usbduxfast: updated address details
Bernd Porr [Fri, 10 Oct 2014 19:35:11 +0000 (20:35 +0100)]
staging: comedi: usbduxfast: updated address details

Updated the range of years, e-mail and added driver desription as
usually done in comedi.

Signed-off-by: Bernd Porr <mail@berndporr.me.uk>
Reviewed-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_pcimdas: add support for PCIe-DAS1602/16
Ian Abbott [Mon, 13 Oct 2014 12:41:22 +0000 (13:41 +0100)]
staging: comedi: cb_pcimdas: add support for PCIe-DAS1602/16

The Measurement Computing PCIe-DAS1602/16 is a PCI-Express version of
the PCIM-DAS1602/16, but has a different PCI device ID.  Add support
for this device and update the driver description, Kconfig description
and MODULE_DESCRIPTION.

Thanks to Christoph Langbein for supplying the PCI device ID.

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>
10 years agostaging: comedi: usbdux: updated contact details / comments
Bernd Porr [Fri, 10 Oct 2014 19:34:04 +0000 (20:34 +0100)]
staging: comedi: usbdux: updated contact details / comments

I've updated my contact details and removed obsolete comments.

Signed-off-by: Bernd Porr <mail@berndporr.me.uk>
Reviewed-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_pcimdas: update driver comment
Ian Abbott [Mon, 13 Oct 2014 12:41:21 +0000 (13:41 +0100)]
staging: comedi: cb_pcimdas: update driver comment

The Comedi driver comment mentions a couple of manual configuration
options, but manual configuration via the COMEDI_DEVCONFIG ioctl and
comedi "attach" handler is no longer supported by this driver.  Update
the comment appropriately.

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>
10 years agostaging: comedi: usbduxsigma: updated contact details and status
Bernd Porr [Fri, 10 Oct 2014 19:32:42 +0000 (20:32 +0100)]
staging: comedi: usbduxsigma: updated contact details and status

I've updated my contact details of the driver. I've also tested it
thoroughly and it works perfectly. I've changed the status to stable.

Signed-off-by: Bernd Porr <mail@berndporr.me.uk>
Reviewed-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_pcimdas: use preferred block comment style
Ian Abbott [Mon, 13 Oct 2014 12:41:20 +0000 (13:41 +0100)]
staging: comedi: cb_pcimdas: use preferred block comment style

Use the preferred block comment style for the copyright and Comedi
driver description header comments.

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>
10 years agoStaging: media: dm365_isif: Add blank line after variable declarations
anuvazhayil [Tue, 28 Oct 2014 21:04:56 +0000 (02:34 +0530)]
Staging: media: dm365_isif: Add blank line after variable declarations

WARNING: Missing a blank line after declarations

Signed-off-by: anuvazhayil <anuv.1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: lustre: libcfs_cpu: Fix ERROR: do not initialise globals to 0 or NULL
anuvazhayil [Tue, 28 Oct 2014 21:43:54 +0000 (03:13 +0530)]
Staging: lustre: libcfs_cpu: Fix ERROR: do not initialise globals to 0 or NULL

Fixed the ERROR: do not initialise globals to 0 or NULL

Signed-off-by: anuvazhayil <anuv.1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8723au: rtw_cmd: Fix space prohibited between function name and open...
anuvazhayil [Tue, 28 Oct 2014 22:13:26 +0000 (03:43 +0530)]
Staging: rtl8723au: rtw_cmd: Fix space prohibited between function name and open parenthesis

Fixed the checkpatch.pl  WARNING: space prohibited between function name and open parenthesis '('

Signed-off-by: anuvazhayil <anuv.1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: media: lirc: lirc_bt829.c: replace dprintk by dev_dbg
Aya Mahfouz [Sun, 26 Oct 2014 17:35:20 +0000 (19:35 +0200)]
staging: media: lirc: lirc_bt829.c: replace dprintk by dev_dbg

This patch removes the custom printk macro dprintk and replaces all
the calls made to it by dev_dbg.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: media: lirc: lirc_imon.c: replace printk by dev_dbg
Aya Mahfouz [Sun, 26 Oct 2014 17:39:27 +0000 (19:39 +0200)]
staging: media: lirc: lirc_imon.c: replace printk by dev_dbg

This patch replaces the calls to printk by dev_dbg.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: media: lirc: lirc_sir.c: use pr_debug and dev_dbg instead of dprintk
Aya Mahfouz [Sun, 26 Oct 2014 17:46:00 +0000 (19:46 +0200)]
staging: media: lirc: lirc_sir.c: use pr_debug and dev_dbg instead of dprintk

This patch removes the custom printk macro dprintk and replaces most of
the calls made to it by dev_dbg. pr_debug was used when the calling
function did not provide the appropiate device variable.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: media: lirc: lirc_zilog.c: replace custom print macros with dev_* and pr_*
Aya Mahfouz [Sun, 26 Oct 2014 17:59:43 +0000 (19:59 +0200)]
staging: media: lirc: lirc_zilog.c: replace custom print macros with dev_* and pr_*

This patch removes the custom printk macros dprintk, zilog_notify,
zilog_error, and zilog_info. All the calls to these macros were
replaced by dev_dbg, dev_notice, dev_err, and dev_info respectively
whenever possible. There were cases in which pr_debug, pr_notice,
pr_err and pr_info were used. It was when the calling function did
not provide an appropiate dev variable.

Applying this patch will trigger the out of memory checkpatch warning
for two lines. It will be fixed in a separate patch.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ft1000: Remove curly braces for single statement blocks
Ebru Akagunduz [Tue, 28 Oct 2014 08:46:35 +0000 (10:46 +0200)]
staging: ft1000: Remove curly braces for single statement blocks

This patch removes curly braces for single statement
blocks using following coccinelle script:

@@
expression e1;
@@

- if (e1) {
+ if (e1)
        return ...;
- }

Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: nio_tiocmd: fixed a brace coding style issue.
Surya Seetharaman [Mon, 27 Oct 2014 14:28:20 +0000 (19:58 +0530)]
Staging: comedi: nio_tiocmd: fixed a brace coding style issue.

Removed unnecessary braces using checkpatch.pl tool

Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Use unsigned for loop index
Tapasweni Pathak [Sun, 26 Oct 2014 15:08:32 +0000 (20:38 +0530)]
staging: dgap: Use unsigned for loop index

The following semantic patch is used to do this

@r exists@ // find anything that might decrement the variable
identifier i;
expression E;
position p;
@@

  int i@p;
  ...
(
  &i
|
  i--
|
  --i
|
  i-=E
|
  i+=E
)

@x disable decl_init@
identifier r.i;
expression E;
position p1 != r.p;
@@

(
  volatile int i = 0;
|
  volatile int i;
|
+ unsigned
  int i@p1 = 0;
|
+ unsigned
  int i@p1;
)
  <... when != i = E
(
  i = 0
|
  i = 1
)
  ...>

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ozwpan: Fix incorrect type in assignments
Melike Yurtoglu [Sun, 26 Oct 2014 21:55:22 +0000 (23:55 +0200)]
staging: ozwpan: Fix incorrect type in assignments

This patch fixes following sparse warnings:
drivers/staging/ozwpan/ozhcd.c:1917:35: warning: incorrect type in
assignment (different base types)
drivers/staging/ozwpan/ozhcd.c:1917:35:    expected restricted __le16
[usertype] wHubCharacteristics
drivers/staging/ozwpan/ozhcd.c:1917:35:    got unsigned short [unsigned]
[usertype] <noident>

Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: android: Replace timeval with timespec64
Tapasweni Pathak [Sun, 26 Oct 2014 13:50:16 +0000 (19:20 +0530)]
staging: android: Replace timeval with timespec64

'timeval' is used to print timestamps in seconds and millisecond.

32-bit systems using 'struct timeval' will break in the year 2038,
So we have to replace that code with more appropriate types.

This patch changes the android driver to use timespec64.
Since this is a staging driver and the output is only used for a
debugfs file, it is fine to slightly change the output and
use nanoseconds instead. ktime_to_timespec64, is used which will return
seconds and nanoseconds.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgnc: dgnc_kcompat.h: remove unused macro
Aya Mahfouz [Sat, 25 Oct 2014 21:47:57 +0000 (23:47 +0200)]
staging: dgnc: dgnc_kcompat.h: remove unused macro

This patch removes the macro PARM_INT after removing all the variables
that depended on it.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgnc: remove debug symbols
Aya Mahfouz [Sat, 25 Oct 2014 21:46:03 +0000 (23:46 +0200)]
staging: dgnc: remove debug symbols

This patch removes all of the debug symbols and the variable dgnc_debug
since they are not used anywhere in the code.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgnc: remove unused variable named rawreadok
Aya Mahfouz [Sat, 25 Oct 2014 21:43:33 +0000 (23:43 +0200)]
staging: dgnc: remove unused variable named rawreadok

This patch removes the variable rawreadok since it is only intialized
but not used in any of the driver functions.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgnc: dgnc_driver: remove all occurences of trcbuf_size
Aya Mahfouz [Sat, 25 Oct 2014 21:40:15 +0000 (23:40 +0200)]
staging: dgnc: dgnc_driver: remove all occurences of trcbuf_size

This patch removes the variable trcbuf_size given there is no real
use for it anymore. All of the debug variables in this driver is
basically dead code.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgnc: dgnc_kcompat.h: remove unused macros
Aya Mahfouz [Sat, 25 Oct 2014 21:33:06 +0000 (23:33 +0200)]
staging: dgnc: dgnc_kcompat.h: remove unused macros

This patch removes the macros PARM_STR and PARM_ULONG given that they
are not used anywhere in the driver files.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>