platform/kernel/linux-rpi.git
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>
10 years agostaging: comedi: comedi_fops: introduce __comedi_get_user_chanlist()
H Hartley Sweeten [Thu, 6 Mar 2014 19:02:57 +0000 (12:02 -0700)]
staging: comedi: comedi_fops: introduce __comedi_get_user_chanlist()

The COMEDI_CMD and COMEDI_CMDTEST ioctl functions both copy the chanlist
passed by the user from __user memory space to kernel memory space. They
then do some sanity checking of the chanlist with comedi_check_chanlist()
before the subdevice (*do_cmdtest) and (*do_cmd) operations are called.

Introduce a helper function to handle the memdup_user() and the sanity
checking.

Also, remove the unnecessary dev_dbg() when the memdup_user() or
comedi_check_chanlist() fail.

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: comedi_fops: introduce __comedi_get_user_cmd()
H Hartley Sweeten [Thu, 6 Mar 2014 19:02:56 +0000 (12:02 -0700)]
staging: comedi: comedi_fops: introduce __comedi_get_user_cmd()

The COMEDI_CMD and COMEDI_CMDTEST ioctl functions both copy the
comedi_cmd passed by the user from __user memory space to kernel
memory space. They then do some basic sanity checking of the cmd
before the subdevice (*do_cmdtest) and (*do_cmd) operations are
called.

Introduce a helper function to handle the copy_from_user() and
do the basic sanity checking.

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: bcm: fixed parentheses and quoted string across lines coding style in CmHost.c
Joshua Baldock [Thu, 13 Mar 2014 06:14:58 +0000 (17:14 +1100)]
Staging: bcm: fixed parentheses and quoted string across lines coding style in CmHost.c

This is a patch to the CmHost.c file that fixes up parentheses and
quoted string across lines warnings found by checkpatch.pl tool.

Signed-off-by: Joshua Baldock <joshua.baldock@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: line6: long line fixes
Davide Berardi [Mon, 17 Mar 2014 02:34:41 +0000 (03:34 +0100)]
staging: line6: long line fixes

Fixed some line over 80 characters.

Signed-off-by: Davide Berardi <berardi.dav@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoMerge 3.14-rc7 into staging-next
Greg Kroah-Hartman [Mon, 17 Mar 2014 18:27:39 +0000 (11:27 -0700)]
Merge 3.14-rc7 into staging-next

This resolves a merge issue with drivers/staging/cxt1e1/linux.c that was
fixed in a report from Stephen Rothwell

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: bcm: Typedefs.h Fix "foo * bar" warning.
Aybuke Ozdemir [Sun, 16 Mar 2014 04:14:43 +0000 (06:14 +0200)]
staging: bcm: Typedefs.h Fix "foo * bar" warning.

This patch fixes these error messages found by checkpatch.pl:
ERROR: "foo* bar" should be "foo *bar"

Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: bcm: Typedefs.h Fix do not use // c99 comments.
Aybuke Ozdemir [Sun, 16 Mar 2014 04:07:14 +0000 (06:07 +0200)]
staging: bcm: Typedefs.h Fix do not use // c99 comments.

This patch fixes "do not use // C99 comments"
errors in Typedefs.h

Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: vt6656: power.c Fix line over 80 characters.
Aybuke Ozdemir [Sun, 16 Mar 2014 02:52:09 +0000 (04:52 +0200)]
staging: vt6656: power.c Fix line over 80 characters.

Fix checkpatch.pl issue with
line over 80 characters in power.c

Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: nokia_h4p: nokia_fw-bcm.c Fix line over 80 characters.
Aybuke Ozdemir [Sun, 16 Mar 2014 02:06:08 +0000 (04:06 +0200)]
staging: nokia_h4p: nokia_fw-bcm.c Fix line over 80 characters.

Fix checkpatch.pl issue with
line over 80 characters in nokia_fw-bcm.c

Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: winbond: Moved trailing statement to next line
Gulsah Kose [Sun, 16 Mar 2014 01:16:30 +0000 (03:16 +0200)]
staging: winbond: Moved trailing statement to next line

Fix checkpatch.pl issues with trailing statement to next line in wb35reg.c

Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: cxt1e1: Fix space prohibited between function name and open parenthesis
Gulsah Kose [Sat, 15 Mar 2014 23:13:09 +0000 (01:13 +0200)]
staging: cxt1e1: Fix space prohibited between function name and open parenthesis

Fix checkpatch.pl issues with space prohibited between function name and
open parenthesis in libsbew.h

Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: dgnc: Fix quoted string split across lines warning
Gulsah Kose [Sat, 15 Mar 2014 22:50:49 +0000 (00:50 +0200)]
staging: dgnc: Fix quoted string split across lines warning

This patch fixes "quoted string split across lines warning" warning in
dgnc_cls.c

Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: line6: Fix line over 80 characters
Gulsah Kose [Sat, 15 Mar 2014 21:54:42 +0000 (23:54 +0200)]
staging: line6: Fix line over 80 characters

Fix checkpatch.pl issue with line over 80 characters in midi.c

Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging:keucr: Remove typedefs
Himangi Saraogi [Sat, 15 Mar 2014 21:44:57 +0000 (03:14 +0530)]
staging:keucr: Remove typedefs

As suggested by Pablo, this patch uses a coccinelle script to remove the
typedefs:
typedef u8 BOOLEAN;  <-- use "bool" instead.
typedef u8 BYTE;     <-- use "u8"
typedef u8 *PBYTE;   <-- use "u8 *"
typedef u16 WORD;    <-- use "u16"
typedef u16 *PWORD;  <-- use "u16 *"
typedef u32 DWORD;   <-- use "u32"
typedef u32 *PDWORD; <-- use "u32 *"
in common.h.

The coccinelle script is:
/* coccinelle script to remove typedefs. */
@remove_typedef@
@@
-typedef bool BOOLEAN;
-typedef u8 BYTE;
-typedef u8 *PBYTE;
-typedef u16 WORD;
-typedef u16 *PWORD;
-typedef u32 DWORD;
-typedef u32 *PDWORD;

@fix_usage@
typedef BOOLEAN;
@@
-BOOLEAN
+bool

@fix_usage1@
typedef BYTE;
@@
-BYTE
+u8

@fix_usage2@
typedef PBYTE;
@@
-PBYTE
+u8 *

@fix_usage3@
typedef WORD;
@@
-WORD
+u16

@fix_usage4@
typedef PWORD;
@@
-PWORD
+u16 *

@fix_usage5@
typedef DWORD;
identifier f;
@@
-DWORD
+u32

@fix_usage6@
typedef PDWORD;
@@
-PDWORD
+u32 *

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: rtl8187se: Remove initialization of static variable in ieee80211/ieee80211_s...
Ana Rey [Sun, 16 Mar 2014 19:44:43 +0000 (20:44 +0100)]
staging: rtl8187se: Remove initialization of static variable in ieee80211/ieee80211_softmac.c

Fix checkpatch.pl errors:
ERROR: do not initialise statics to 0 or NULL

Signed-off-by: Ana Rey <anarey@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: rtl8187se: Fix pointer declarations in ieee80211/ieee80211_softmac.c
Ana Rey [Sun, 16 Mar 2014 19:44:42 +0000 (20:44 +0100)]
staging: rtl8187se: Fix pointer declarations in ieee80211/ieee80211_softmac.c

Fix pointer declarations as the codingStyle of the kernel recommends in
ieee80211/ieee80211_softmac.c

Fix checkpatch.pl errors:
ERROR: "foo* bar" should be "foo *bar"
ERROR: "(foo*)" should be "(foo *)"

Signed-off-by: Ana Rey <anarey@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: rtl8187se: Move trailing statement to next line
Ana Rey [Sun, 16 Mar 2014 19:44:41 +0000 (20:44 +0100)]
staging: rtl8187se: Move trailing statement to next line

Move trailing statements to next line as the codingStyle of
the kernel recommends.

Fix checkpatch.pl errors:
ERROR: trailing statements should be on next line

Signed-off-by: Ana Rey <anarey@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: rtl8187se: Delete some innecesary whitespaces
Ana Rey [Sun, 16 Mar 2014 19:44:40 +0000 (20:44 +0100)]
staging: rtl8187se: Delete some innecesary whitespaces

Delete some whitespaces (whitespace before a quoted newline, space
at the start of a line and space before a tabs) as the codingStyle of
the kernel recommends.

Fix checkpatch.pl errors:
WARNING: unnecessary whitespace before a quoted newline
WARNING: please, no spaces at the start of a line
WARNING: please, no space before tabs

Signed-off-by: Ana Rey <anarey@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
10 years agostaging: rtl8187se: Add whitespaces around '&', '||' and '&&'
Ana Rey [Sun, 16 Mar 2014 19:44:39 +0000 (20:44 +0100)]
staging: rtl8187se: Add whitespaces around '&', '||' and '&&'

Add whitespaces around '&', '||' and '&&' as the codingStyle of the kernel
recommends.

Fix checkpatch.pl errors:
ERROR: spaces required around that '||' (ctx:VxV)
ERROR: spaces required around that '&&' (ctx:VxV)
ERROR: need consistent spacing around '&'

Signed-off-by: Ana Rey <anarey@gmail.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>