platform/kernel/linux-rpi.git
10 years agostaging: comedi: gsc_hpdi: remove 'volatile' from the private data members
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:26 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: remove 'volatile' from the private data members

As reported by checkpatch.pl, the private data members do not need
the volatile tag. Remove them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: gsc_hpdi: remove hpdi_writel()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:25 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: remove hpdi_writel()

This helper function is used to OR bits with a software copy of a
register value then writel() the new value to the register. The
software copies are never updated in the driver so they are always
0 due to the kzalloc.

Remove the unnecessary 'bits' from the private data and replace
the hpdi_writel() calls with writel().

Signed-off-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: gsc_hpdi: remove disable_plx_interrupts()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:24 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: remove disable_plx_interrupts()

This helper function is just a simple writel(). 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: gsc_hpdi: rename init_hpdi()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:23 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: rename init_hpdi()

For aesthetics, rename this function so it has namespace associated
with 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: gsc_hpdi: rename init_plx9080()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:22 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: rename init_plx9080()

For aesthetics, rename this function so it has namespace associated
with 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: gsc_hpdi: rename hpdi_find_board()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:21 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: rename hpdi_find_board()

For aesthetics, rename this function so it has namespace associated
with 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: gsc_hpdi: rename the (*auto_attach) and (*detach) functions
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:20 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: rename the (*auto_attach) and (*detach) functions

For aesthetics, rename these functions so they have namespace associated
with 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: gsc_hpdi: rename drain_dma_buffers()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:19 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: rename drain_dma_buffers()

For aesthetics, rename this function so it has namespace associated
with 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: gsc_hpdi: rename handle_interrupt()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:18 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: rename handle_interrupt()

For aesthetics, rename this function so it has namespace associated
with 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: gsc_hpdi: rename abort_dma()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:17 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: rename abort_dma()

For aesthetics, rename this function so it has namespace associated
with the driver.

Also, remove the unnecessary forward 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: gsc_hpdi: rename hpdi_cancel()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:16 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: rename hpdi_cancel()

For aesthetics, rename this function so it has namespace associated
with 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: gsc_hpdi: tidy up hpdi_cmd_test()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:15 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: tidy up hpdi_cmd_test()

For aesthetics, rename this function so it has namespace associated
with the driver and move it so that it is not in the middle of the
interrupt support code.

Absorb the di_cmd_test() helper and tidy up the function a bit.

Signed-off-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: gsc_hpdi: tidy up hpdi_cmd()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:14 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: tidy up hpdi_cmd()

For aesthetics, rename this function so it has namespace associated
with the driver and move it so that it is not in the middle of the
interrupt support code.

Absorb the di_cmd() helper and tidy up the function a bit.

Signed-off-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: gsc_hpdi: tidy up setup_dma_descriptors()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:13 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: tidy up setup_dma_descriptors()

For aesthetics, rename this function so it has namespace associated
with the driver and move it so that it is not in the middle of the
async command support code.

Tidy up the function a bit.

Signed-off-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: gsc_hpdi: tidy up dio_config_insn()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:12 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: tidy up dio_config_insn()

For aesthetics, rename this function so it has namespace associated
with the driver and move it so that it is not in the middle of the
async command support code.

Absorb the dio_config_block_size() helper function and remove the
forward 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: gsc_hpdi: move the (*auto_attach) helper functions
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:11 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: move the (*auto_attach) helper functions

For aesthetics, move a couple helper functions that are only called
by the (*auto_attach) closer to that 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: gsc_hpdi: absorb setup_subdevices()
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:10 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: absorb setup_subdevices()

This function is only called by the (*auto_attach). Absorb it into that
function to clarify the attach and remove the need for some of the forward
declarations.

For aesthetics, add some whitespace to the subdevice init.

Signed-off-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: gsc_hpdi: move the (*auto_attach) and (*detach) functions
H Hartley Sweeten [Thu, 13 Mar 2014 21:16:09 +0000 (14:16 -0700)]
staging: comedi: gsc_hpdi: move the (*auto_attach) and (*detach) functions

Move these functions closer to the comedi_driver declaration. This removes
the need for one of the forward 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: fl512: tidy up the multi-line comments
H Hartley Sweeten [Thu, 13 Mar 2014 17:10:01 +0000 (10:10 -0700)]
staging: comedi: fl512: tidy up the multi-line comments

Tidy up the multi-line comments to follow the CodingStyle.

Add the GPL boilerplate comment found in other comedi 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: fl512: tidy up fl512_ao_insn_read()
H Hartley Sweeten [Thu, 13 Mar 2014 17:10:00 +0000 (10:10 -0700)]
staging: comedi: fl512: tidy up fl512_ao_insn_read()

Tidy up this 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: fl512: tidy up fl512_ao_insn_write()
H Hartley Sweeten [Thu, 13 Mar 2014 17:09:59 +0000 (10:09 -0700)]
staging: comedi: fl512: tidy up fl512_ao_insn_write()

Tidy up this function. Only save the last value written for readback.

Signed-off-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: fl512: define the register map
H Hartley Sweeten [Thu, 13 Mar 2014 17:09:58 +0000 (10:09 -0700)]
staging: comedi: fl512: define the register map

Define the register map and remove the magic values and some unnecessary
comments.

For aesthetics, remove the 'iobase' local variable and use dev->iobase
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: fl512: tidy up fl512_ao_insn_read()
H Hartley Sweeten [Thu, 13 Mar 2014 17:09:57 +0000 (10:09 -0700)]
staging: comedi: fl512: tidy up fl512_ao_insn_read()

For aesthetics, tidy up this function to match the style used in most
of the comedi drivers for analog output (*insn_read) functions.

Signed-off-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: fl512: remove Fl512_SIZE define
H Hartley Sweeten [Thu, 13 Mar 2014 17:09:56 +0000 (10:09 -0700)]
staging: comedi: fl512: remove Fl512_SIZE define

This define is only used in the comedi_request_region() call to specify
the size of the I/O region to request. Remove the define and just open
code the value.

Signed-off-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: fl512: rename the subdevice (*insn_{read, write}) functions
H Hartley Sweeten [Thu, 13 Mar 2014 17:09:55 +0000 (10:09 -0700)]
staging: comedi: fl512: rename the subdevice (*insn_{read, write}) functions

For aesthetics, rename these functions and remove the unnecessary comments.

Signed-off-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: fl512: tidy up subdevice init
H Hartley Sweeten [Thu, 13 Mar 2014 17:09:54 +0000 (10:09 -0700)]
staging: comedi: fl512: tidy up subdevice init

Remove the obvious comments and add some whitespace to the subdevice
init.

Signed-off-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: 8255_pci: initialize MITE data window
Ian Abbott [Thu, 13 Mar 2014 15:30:39 +0000 (15:30 +0000)]
staging: comedi: 8255_pci: initialize MITE data window

According to National Instruments' PCI-DIO-96/PXI-6508/PCI-6503 User
Manual, the physical address in PCI BAR1 needs to be OR'ed with 0x80 and
written to register offset 0xC0 in the "MITE" registers (BAR0).  Do so
during initialization of the National Instruments boards handled by the
"8255_pci" driver.  The boards were previously handled by the
"ni_pcidio" driver, where the initialization was done by `mite_setup()`
in the "mite" module.  The "mite" module comes with too much extra
baggage for the "8255_pci" driver to deal with so use a local, simpler
initialization function.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.10.y, 3.11.y, 3.12.y, 3.13.y, 3.14.y
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: dac02: introduce comedi driver for DAC02 boards
H Hartley Sweeten [Tue, 11 Mar 2014 19:04:17 +0000 (12:04 -0700)]
staging: comedi: dac02: introduce comedi driver for DAC02 boards

This board is currently supported by the poc driver. That driver used
to support a number of simple boards but now only provides support for
the DAC02 board.

Introduce a new comedi driver specifically for the DAC02 board. This
allows cleaning up all the cruft.

Signed-off-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_daq_dio24: fix a line over 80 characters
Matei Oprea [Tue, 11 Mar 2014 12:39:12 +0000 (14:39 +0200)]
Staging: comedi: ni_daq_dio24: fix a line over 80 characters

Fix a coding style issue.

Signed-off-by: Matei Oprea <eu@opreamatei.ro>
Cc: ROSEdu Kernel Commmunity <firefly@lists.rosedu.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: c6xdigio: update the MODULE_DESCRIPTION
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:42 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: update the MODULE_DESCRIPTION

Change the generic MODULE_DESCRIPTION text to something more
specific for this 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: c6xdigio: tidy up the multi-line comments
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:41 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: tidy up the multi-line comments

Reformat the multi-line comments at the beginning of the code to
follow the CodingStyle.

Signed-off-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: c6xdigio: add readback of last pwm channel values
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:40 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: add readback of last pwm channel values

Add and (*insn_read) for the PWM subdevice to allow reading back the
last value written to the channels.

There are only 2 PWM channels and they have a maxdata of 500. Pack
the last values in the subdevice 'state' instead of adding a private
data struct to this 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: c6xdigio: use comedi_offset_munge()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:39 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: use comedi_offset_munge()

The value read from the encoders is in two's complement format. Use
the comedi_offset_munge() helper to convert the value to offset binary.

Signed-off-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: c6xdigio: consolidate the board_init()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:38 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: consolidate the board_init()

For aesthetics, rename this function so it has namespace associated
with the driver.

Absorb the c6xdigio_pwm_init() and c6xdigio_encoder_reset() helpers.

Signed-off-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: c6xdigio: tidy up subdevice 1 init
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:37 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: tidy up subdevice 1 init

Remove the commented out init of the 'trig'.

For aesthetics, add some whitespace to the init and rename the 'insn_read'
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: c6xdigio: tidy up subdevice 0 init
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:36 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: tidy up subdevice 0 init

This subdevice is a PWM output not and analog output, fix the 'type'.

Fix the subdevice 'range', range_bipolar does not make sense for a PWM
output. The range_unknown is a better choice.

Remove the commented out init of the 'trig'.

For aesthetics, add some whitespace to the init and rename the 'insn_write'
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: c6xdigio: define the data register bits
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:35 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: define the data register bits

To clarify the code, define the bits in the data register and remove the
magic numbers.

Signed-off-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: c6xdigio: tidy up c6xdigio_pwm_write()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:34 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: tidy up c6xdigio_pwm_write()

The 10-bit pwm value (2-498) is written by banging 2-bits in the data register.

Refactor this function to remove the need for the union pcmcmdtype and struct
pwmbitstype.

Signed-off-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: c6xdigio: introduce c6xdigio_get_encoder_bits()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:33 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: introduce c6xdigio_get_encoder_bits()

The 24-bit encoder value is read using 3-bits in the status register. The
data register is banged between each read of the status register to advance
the bits.

Introduce a helper function to handle this and remove the union encvaluetype
and struct encbitsbyte.

Signed-off-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: c6xdigio: define the register map
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:32 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: define the register map

The register map was already defined but it was not being used. Rename
to defines and use them in 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: c6xdigio: introduce c6xdigio_write_data()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:31 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: introduce c6xdigio_write_data()

All writes to the hardware involve writing the the data register then
checking the status register. Introduce a helper function to handle this.

Signed-off-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: c6xdigio: change first param to c6xdigio_chk_status()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:30 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: change first param to c6xdigio_chk_status()

For aesthetics, pass the comedi_device pointer instead of the dev->iobase
as the first parameter.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: c6xdigio: tidy up C6X_encInput()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:29 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: tidy up C6X_encInput()

Rename the CamelCase function.

For aesthetics, pass the comedi_device pointer instead of the dev->iobase
as the first parameter.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: c6xdigio: tidy up C6X_pwmOutput()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:28 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: tidy up C6X_pwmOutput()

Rename the CamelCase function.

For aesthetics, pass the comedi_device pointer instead of the dev->iobase
as the first parameter.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: c6xdigio: tidy up C6X_encResetAll()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:27 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: tidy up C6X_encResetAll()

Rename the CamelCase function.

For aesthetics, pass the comedi_device pointer instead of the dev->iobase.

Signed-off-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: c6xdigio: tidy up C6X_pwmInit()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:26 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: tidy up C6X_pwmInit()

Rename the CamelCase function.

For aesthetics, pass the comedi_device pointer instead of the dev->iobase.

Signed-off-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: c6xdigio: factor out status check busywait
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:25 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: factor out status check busywait

Factor out the common code that busywaits for the status to change.

Signed-off-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: c6xdigio: remove C6XDIGIO_SIZE
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:24 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: remove C6XDIGIO_SIZE

This define is only used in the comedi_request_region() call and does
not add any additional clarity to the code. 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: c6xdigio: remove WriteByteToHwPort()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:23 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: remove WriteByteToHwPort()

This CamelCase function is just a wrapper around outb_p(). 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: c6xdigio: remove ReadByteFromHwPort()
H Hartley Sweeten [Mon, 10 Mar 2014 21:07:22 +0000 (14:07 -0700)]
staging: comedi: c6xdigio: remove ReadByteFromHwPort()

This CamelCase function is just a wrapper around inb(). 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-data: Clean up function comments
Fred Akers [Tue, 11 Mar 2014 22:19:13 +0000 (18:19 -0400)]
Staging: Comedi: addi-data: Clean up function comments

These comments look terrible and are full of redundant information.
Also reformat the license at the head of the file to wrap at 80 char.

Signed-off-by: Fred Akers <knivey@botops.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: addi-data: Fix long CamelCase function names
Fred Akers [Tue, 11 Mar 2014 22:19:12 +0000 (18:19 -0400)]
Staging: comedi: addi-data: Fix long CamelCase function names

This patch fixes a few function names that are very long and are
not in the correct naming style

Signed-off-by: Fred Akers <knivey@botops.net>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: addi-data: style cleanups in hwdrv_apci1564.c
Chase Southwood [Sun, 9 Mar 2014 06:42:47 +0000 (00:42 -0600)]
Staging: comedi: addi-data: style cleanups in hwdrv_apci1564.c

This patch cleans up a few trivial style issues, including fixing crazy
indentation problems in the defines near the top of the file, removing a
couple of unneeded braces, and wrapping a couple of long comments onto new
lines to fix lines which were in excess of 80 characters.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: propagate timeout errors in s626.c
Chase Southwood [Sat, 8 Mar 2014 01:43:17 +0000 (19:43 -0600)]
Staging: comedi: propagate timeout errors in s626.c

This patch for s626.c propagates the errors from the newly introduced
calls to comedi_timeout() as far as possible.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: comedi: convert while loops to timeouts in s626.c
Chase Southwood [Sun, 9 Mar 2014 04:00:54 +0000 (22:00 -0600)]
Staging: comedi: convert while loops to timeouts in s626.c

This patch changes a handful of while loops to timeouts to prevent
infinite looping on hardware failure. A couple such loops are in a
function (s626_debi_transfer()) which is called from critical sections,
so comedi_timeout() is unusable for them, and an iterative timeout is
used instead. For the while loops in a context where comedi_timeout() is
allowed, a new callback function, s626_send_dac_eoc(), has been defined
to evaluate the conditions that the while loops are testing.  The new
callback employs a switch statement based on a simple new enum so that
it is usable for all of the different conditions tested in while loops
in s626_send_dac().  The proper comedi_timeout() calls are then used.

Signed-off-by: Chase Southwood <chase.southwood@yahoo.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: drivers should not clear the async->events
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:46 +0000 (17:31 -0700)]
staging: comedi: drivers should not clear the async->events

The comedi core resets the async->events in comedi_buf_reset() which is
called when the subdevice is restored to an idle state and at the start
of an async command. The async->events are also cleared after handling
the events in comedi_event().

Drivers should not clear the events manually.

Signed-off-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: quatech_daqp_cs: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:45 +0000 (17:31 -0700)]
staging: comedi: quatech_daqp_cs: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Update the Kconfig so that COMEDI_QUATECH_DAQP_CS selects COMEDI_FC.

Signed-off-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_pcidio: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:44 +0000 (17:31 -0700)]
staging: comedi: ni_pcidio: use cfc_handle_events()

Use the comedi_fc helper function instead of duplicating the code.

In the Kconfig, COMEDI_NI_PCIDIO selects COMEDI_FC indirectly by
selecting COMEDI_MITE which selects COMEDI_FC.

Signed-off-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: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:43 +0000 (17:31 -0700)]
staging: comedi: ni_labpc: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Also, remove the clearing of the events, comedi_event() does that.

In the Kconfig, COMEDI_NI_LABPC already selects COMEDI_FC.

Signed-off-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: dt3000: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:42 +0000 (17:31 -0700)]
staging: comedi: dt3000: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Update the Kconfig so that COMEDI_DT3000 selects COMEDI_FC.

Signed-off-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_660x: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:41 +0000 (17:31 -0700)]
staging: comedi: ni_660x: use cfc_handle_events()

Use the comedi_fc helper function instead of duplicating the code.

In the Kconfig, COMEDI_NI_660X selects COMEDI_FC indirectly by selecting
COMEDI_NI_TIOCMD which selects COMEDI_MITE which selects COMEDI_FC.

Signed-off-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: pcl818: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:40 +0000 (17:31 -0700)]
staging: comedi: pcl818: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Update the Kconfig so that COMEDI_PCL818 selects COMEDI_FC.

Signed-off-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: pcl816: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:39 +0000 (17:31 -0700)]
staging: comedi: pcl816: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Update the Kconfig so that COMEDI_PCL816 selects COMEDI_FC.

Signed-off-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: pcl812: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:38 +0000 (17:31 -0700)]
staging: comedi: pcl812: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Update the Kconfig so that COMEDI_PCL812 selects COMEDI_FC.

Signed-off-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 cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:37 +0000 (17:31 -0700)]
staging: comedi: cb_pcidas: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Also, remove the clearing of the events, comedi_event() does that.

In the Kconfig, COMEDI_CB_PCIDAS already selects COMEDI_FC.

Signed-off-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 cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:36 +0000 (17:31 -0700)]
staging: comedi: amplc_pci224: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

In the Kconfig, COMEDI_AMPLC_PCI224 already selects COMEDI_FC.

Signed-off-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 cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:35 +0000 (17:31 -0700)]
staging: comedi: ni_mio_common: use cfc_handle_events()

The ni_event() function in this file is an open coded version of
cfc_handle_events() where instead of calling the subdevice (*cancel)
function a switch is used to call the function based on the subdevice
'index'.

Use the comedi_fc helper function to simplify the code.

This also allows removing a couple of the forward declarations.

Fix the #ifdef/#endif for the ni_gpct_cancel() foward declaration and
around the function. This function is now only referenced by code that
is blocked with #ifdef PCIDMA.

This source file is included by the ni_atmio, ni_mio_cs, and ni_pcimio
drivers. In the Kconfig, the config options for these drivers already
select COMEDI_FC.

Signed-off-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 cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:34 +0000 (17:31 -0700)]
staging: comedi: ni_at_a2150: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Also, remove the clearing of the events, comedi_event() does that.

In the Kconfig, COMEDI_NI_AT_A2150 already selects COMEDI_FC.

Signed-off-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: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:33 +0000 (17:31 -0700)]
staging: comedi: dt282x: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

This also fixes two bugs.
  1) the analog input command is canceled due to a buffer overflow
     without sending an event (@@ -341,7 +340,7 @@).
  2) an analog output error causes the command to cancel but the event
     is reported to the analog input subdevice (@@ -449,15 +447,13 @@).

In the Kconfig, COMEDI_DT282X already selects COMEDI_FC.

Signed-off-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 cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:32 +0000 (17:31 -0700)]
staging: comedi: das1800: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

In the Kconfig, COMEDI_DAS1800 already selects COMEDI_FC.

Signed-off-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 cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:31 +0000 (17:31 -0700)]
staging: comedi: das800: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Also, remove the clearing of the event, comedi_event() does that.

In the Kconfig, COMEDI_DAS800 already selects COMEDI_FC.

Signed-off-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: das16m1: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:30 +0000 (17:31 -0700)]
staging: comedi: das16m1: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

In the Kconfig, COMEDI_DAS16M1 already selects COMEDI_FC.

Signed-off-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: adv_pci1710: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:29 +0000 (17:31 -0700)]
staging: comedi: adv_pci1710: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Update the Kconfig to select COMEDI_FC when COMEDI_ADL_PCI9111 is 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: adl_pci9111: use cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:28 +0000 (17:31 -0700)]
staging: comedi: adl_pci9111: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

In the Kconfig, COMEDI_ADL_PCI9111 already selects COMEDI_FC.

Signed-off-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 cfc_handle_events()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:27 +0000 (17:31 -0700)]
staging: comedi: adl_pci9118: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

In the Kconfig, COMEDI_ADL_PCI9118 already selects COMEDI_FC.

Signed-off-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: mite: use cfc_inc_scan_progress()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:26 +0000 (17:31 -0700)]
staging: comedi: mite: use cfc_inc_scan_progress()

Use the comedi_fc helper function instead of duplicating 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: comedi_fc: export increment_scan_progress()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:25 +0000 (17:31 -0700)]
staging: comedi: comedi_fc: export increment_scan_progress()

Rename this function to cfc_inc_scan_progress() and export it for
use by the comedi 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_fc: export cfc_bytes_per_scan()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:24 +0000 (17:31 -0700)]
staging: comedi: comedi_fc: export cfc_bytes_per_scan()

This helper function is a bit long to be inlined. Move it to the
source file and export it.

The mite driver is the only external user right now. Update the
Kconfig to select COMEDI_FC when COMEDI_MITE is 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: comedi_fc: tidy up cfc_bytes_per_scan()
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:23 +0000 (17:31 -0700)]
staging: comedi: comedi_fc: tidy up cfc_bytes_per_scan()

This function returns the total number of bytes for a full scan of
an async command chanlist. The returned value is an unsigned int.

Change all the local variables to unsigned int and use a local
variable for the s->async->cmd.chanlist_len.

Signed-off-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: rename comedi_subdevice variables in header
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:22 +0000 (17:31 -0700)]
staging: comedi: comedi_fc: rename comedi_subdevice variables in header

Typically the comedi_subdevice variable is simply named 's'. Rename
the variables in comedi_fc.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: comedi_fc: remove 'extern' from function prototypes
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:21 +0000 (17:31 -0700)]
staging: comedi: comedi_fc: remove 'extern' from function prototypes

The 'extern' is not needed in the prototypes for the exported functions
in the header. 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_fc: tidy up multi-line comment in header
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:20 +0000 (17:31 -0700)]
staging: comedi: comedi_fc: tidy up multi-line comment in header

Tidy up the multi-line comment to follow the CodingStyle.

Signed-off-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: remove unnecessary prefix in dev_warn() message
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:19 +0000 (17:31 -0700)]
staging: comedi: comedi_fc: remove unnecessary prefix in dev_warn() message

The dev_warn() will automatically have the "comedi" prefix.

Signed-off-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: rename comedi_subdevice variables
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:18 +0000 (17:31 -0700)]
staging: comedi: comedi_fc: rename comedi_subdevice variables

Typically the comedi_subdevice variable is simply named 's'. Rename
the variables in this 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: comedi_fc: tidy up multi-line comment
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:17 +0000 (17:31 -0700)]
staging: comedi: comedi_fc: tidy up multi-line comment

Tidy up the multi-line comment to follow the CodingStyle.

Signed-off-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: tidy up module init
H Hartley Sweeten [Sat, 8 Mar 2014 00:31:16 +0000 (17:31 -0700)]
staging: comedi: comedi_fc: tidy up module init

For aesthetics, move the MODULE_* information to the end of the file
and move the module_{init,exit}() after the functions.

Signed-off-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: jr3_pci: remove 'channel_no' from subdevice private data
H Hartley Sweeten [Fri, 7 Mar 2014 20:41:08 +0000 (13:41 -0700)]
staging: comedi: jr3_pci: remove 'channel_no' from subdevice private data

This member of the subdevice private data is just the subdevice 'index'. Use
that instead and remove the member.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: rename struct poll_delay_t
H Hartley Sweeten [Fri, 7 Mar 2014 20:41:07 +0000 (13:41 -0700)]
staging: comedi: jr3_pci: rename struct poll_delay_t

Rename this private struct so it has namespace associated with the
driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: rename struct transform_t
H Hartley Sweeten [Fri, 7 Mar 2014 20:41:06 +0000 (13:41 -0700)]
staging: comedi: jr3_pci: rename struct transform_t

Rename this private struct so it has namespace associated with the
driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: remove 'n_channels' from private data
H Hartley Sweeten [Fri, 7 Mar 2014 20:41:05 +0000 (13:41 -0700)]
staging: comedi: jr3_pci: remove 'n_channels' from private data

This member of the private data is actually the number of subdevices. We
can get that information directly from the comedi_device. Do that instead
and remove the unnecessary member from the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: introduce boardinfo for the supported boards
H Hartley Sweeten [Tue, 11 Mar 2014 17:03:31 +0000 (10:03 -0700)]
staging: comedi: jr3_pci: introduce boardinfo for the supported boards

Create an enum for the boards supported by this driver and pass that enum in
the pci_driver id_table as the driver_data.

Introduce a boardinfo struct to hold the board specific data for the boards
supported by this driver. Use the boardinfo when attaching to the driver
instead of using the pcidev->device and the switch.

Since the PCI device ids are now only used in the id_table, remove the
defines and open code the device ids.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: tidy up jr3_pci_ai_insn_read()
H Hartley Sweeten [Fri, 7 Mar 2014 20:41:03 +0000 (13:41 -0700)]
staging: comedi: jr3_pci: tidy up jr3_pci_ai_insn_read()

Refactor this function to make it clearer.

The channel does not need to be validated. The comedi core does that for us.

Exit early if the subdevice private data is invalid.

Exit early if the subdevice 'state' is not done or there is an error.

Factor out the code that actually reads the channel data to reduce the
indent level.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: tidy up jr3_pci_open()
H Hartley Sweeten [Fri, 7 Mar 2014 20:41:02 +0000 (13:41 -0700)]
staging: comedi: jr3_pci: tidy up jr3_pci_open()

For aesthetics, rename the subdevice private data pointer from 'p' to
'spriv' and add a local variable for the comedi_subdevice pointer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: tidy up jr3_download_firmware()
H Hartley Sweeten [Fri, 7 Mar 2014 20:41:01 +0000 (13:41 -0700)]
staging: comedi: jr3_pci: tidy up jr3_download_firmware()

This callback function for comedi_load_firmware() first validates that
the firmware data is the correct format then it writes the data to each
subdevice.

Split the two operations out as separate functions to clarify the code.
Tidy up the new functions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: tidy up jr3_pci_poll_subdevice()
H Hartley Sweeten [Fri, 7 Mar 2014 20:41:00 +0000 (13:41 -0700)]
staging: comedi: jr3_pci: tidy up jr3_pci_poll_subdevice()

Refactor the function to reduce the indent level.

For aesthetics, rename the subdevice private data pointer from 'p'
to 'spriv'.

Rename the lacal variable used for the channel->full_scale to 'fs'
to reduce the line lengths.

Remove the setting of range[8]. The min,max values are the same as
the ones used when the subdevice private data was allocated and
initialized.

Remove the poll_delay_min_max() that are the same as the default.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: tidy up jr3_pci_poll_dev()
H Hartley Sweeten [Fri, 7 Mar 2014 20:40:59 +0000 (13:40 -0700)]
staging: comedi: jr3_pci: tidy up jr3_pci_poll_dev()

For aesthetics, rename the subdevice private data pointer from 'subdevpriv'
to 'spriv' and add a local variable for the comedi_subdevice pointer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: rename some local vars in the (*attach)
H Hartley Sweeten [Fri, 7 Mar 2014 20:40:58 +0000 (13:40 -0700)]
staging: comedi: jr3_pci: rename some local vars in the (*attach)

For aesthetics, rename the subdevice private data pointer from 'p'
to 'spriv' and the variable used to check the errno from 'result'
to 'ret'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: factor subdevice private data init out of (*attach)
H Hartley Sweeten [Fri, 7 Mar 2014 20:40:57 +0000 (13:40 -0700)]
staging: comedi: jr3_pci: factor subdevice private data init out of (*attach)

Factor the code that allocates and initializes the subdevice private data
out of the (*attach) to reduce the indent level and make the code easier
to follow.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: use comedi_alloc_spriv()
H Hartley Sweeten [Fri, 7 Mar 2014 20:40:56 +0000 (13:40 -0700)]
staging: comedi: jr3_pci: use comedi_alloc_spriv()

Use the helper function to allocate the subdevice private data. This
sets the s->private variable for us and allows the comedi core to
automatically kfree() the memory during the (*detach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: jr3_pci: tidy up subdevice init
H Hartley Sweeten [Fri, 7 Mar 2014 20:40:55 +0000 (13:40 -0700)]
staging: comedi: jr3_pci: tidy up subdevice init

For aesthetics, use a pointer to the comedi_subdevice instead of
accessing the dev->subdevices array directly.

Move the local variable for the subdevice private data so that
this function does not declare the variable twice.

Change the kzalloc for the subdevice private data to remove the
sizeof(struct foo).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>