]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
8 years agostaging: comedi: dt2811: add async command support for AI subdevice
H Hartley Sweeten [Wed, 4 May 2016 22:25:38 +0000 (15:25 -0700)]
staging: comedi: dt2811: add async command support for AI subdevice

The interrupt support available on this board is pretty limited but its
simple enough to give basic async command support.

This allows reading a single channel continuously using either the internal
or an external clock to trigger each conversion. The command can also use
the external trigger input to start the command if the external clock is
being used for conversions.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: comedi: comedi_fops.c: Fixed coding style issue
Shyam Saini [Tue, 10 May 2016 15:51:07 +0000 (21:21 +0530)]
Staging: comedi: comedi_fops.c: Fixed coding style issue

Fixed following checkpatch.pl warnings
WARNING: Prefer WRITE_ONCE(<FOO>, <BAR>) over ACCESS_ONCE(<FOO>) = <BAR>

WARNING: Prefer READ_ONCE(<FOO>) over ACCESS_ONCE(<FOO>)

Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: update the MODULE_DESCRIPTION
H Hartley Sweeten [Wed, 4 May 2016 19:47:24 +0000 (12:47 -0700)]
staging: comedi: dt2811: update the MODULE_DESCRIPTION

Change the MODULE_DESCRIPTION to something more useful than the generic
"Comedi low-level 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>
8 years agostaging: comedi: dt2811: rename 'boardtypes'
H Hartley Sweeten [Wed, 4 May 2016 19:47:23 +0000 (12:47 -0700)]
staging: comedi: dt2811: rename 'boardtypes'

Rename this array 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>
8 years agostaging: comedi: dt2811: remove unused define
H Hartley Sweeten [Wed, 4 May 2016 19:47:22 +0000 (12:47 -0700)]
staging: comedi: dt2811: remove unused define

This define is not used by the driver. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: tidy up analog input subdevice init
H Hartley Sweeten [Wed, 4 May 2016 19:47:21 +0000 (12:47 -0700)]
staging: comedi: dt2811: tidy up analog input subdevice init

Add some whitespace to the analog output subdevice initialization
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>
8 years agostaging: comedi: dt2811: simplify analog input range options
H Hartley Sweeten [Wed, 4 May 2016 19:47:20 +0000 (12:47 -0700)]
staging: comedi: dt2811: simplify analog input range options

The A/D ranges are not programmable but the gain is. Currently this driver
uses a configuration option to select the comedi_lrange that will be used
for the analog input subdevice. This requires that the user makes sure the
correct option value is used.

The user space library uses the range information to convert between raw
values and physical units. If the user passed an incorrect option when
attaching the driver the conversion will be incorrect.

A previous patch allowed the gain to be set based on the chanspec range.
Prior to that the gain was always set to 1 so any conversion with a gain
that is not 1 would be incorrect anyway.

Simplify the analog input ranges by providing a range_table for the pgh and
pgl boards that contain all the possible range/gain options. The user can
then select the correct range (and gain) when converting values or reading
the analog inputs.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: remove private data
H Hartley Sweeten [Wed, 4 May 2016 19:47:19 +0000 (12:47 -0700)]
staging: comedi: dt2811: remove private data

The remaining members of the private data are not used by the driver.
Remove it and the allocation.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: simplify A/D reference configuration
H Hartley Sweeten [Wed, 4 May 2016 19:47:18 +0000 (12:47 -0700)]
staging: comedi: dt2811: simplify A/D reference configuration

The analog inputs are confgured with jumpers on the board to be:
  * 16 single-ended inputs
  * 8 differential inputs
  * 16 pseudo-differential inputs (common ground)

Simplify the handling of this configuration option and properly set
the subdev_flags based on the selected input mode.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: tidy up analog output subdevice init
H Hartley Sweeten [Wed, 4 May 2016 19:47:17 +0000 (12:47 -0700)]
staging: comedi: dt2811: tidy up analog output subdevice init

Add some whitespace to the analog output subdevice initialization.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: simplify analog output range options
H Hartley Sweeten [Wed, 4 May 2016 19:47:16 +0000 (12:47 -0700)]
staging: comedi: dt2811: simplify analog output range options

The D/A ranges are not programmable. Currently this driver uses some
configuration options to select the comedi_lrange for each channel.
This is a bit messy and it requires the user to make sure the correct
option value is used.

The range information isn't used by the driver. The user space library
uses it to convert between raw data values and physical units. If the
user passed an incorrect option when attaching the driver the conversion
will be incorrect.

Simplify the analog output ranges by providing a range_table that
contains all the possible output ranges. The user can then select the
correct range when converting values.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: tidy up the digital subdevices
H Hartley Sweeten [Wed, 4 May 2016 19:47:15 +0000 (12:47 -0700)]
staging: comedi: dt2811: tidy up the digital subdevices

Add some whitespace to the digital input and output subdevice
initialization. Reorder the initialization 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>
8 years agostaging: comedi: dt2811: tidy up Timer/Counter register defines
H Hartley Sweeten [Wed, 4 May 2016 19:47:14 +0000 (12:47 -0700)]
staging: comedi: dt2811: tidy up Timer/Counter register defines

This register currently is not being used. For aesthetics, cleanup the
define and the comment about the frequency control.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: tidy up Digital Input/Output register defines
H Hartley Sweeten [Wed, 4 May 2016 19:47:13 +0000 (12:47 -0700)]
staging: comedi: dt2811: tidy up Digital Input/Output register defines

The digital input and outputs are separate ports even though they share the
same register offset. For aesthetics, define then separately and remove the
redundant information in the comment.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: tidy up D/A Data register defines
H Hartley Sweeten [Wed, 4 May 2016 19:47:12 +0000 (12:47 -0700)]
staging: comedi: dt2811: tidy up D/A Data register defines

Cleanup the defines for these registers and and remove the redundant
information in the comment.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: tidy up A/D Data register defines
H Hartley Sweeten [Wed, 4 May 2016 19:47:11 +0000 (12:47 -0700)]
staging: comedi: dt2811: tidy up A/D Data register defines

Cleanup the defines for these registers and and remove the redundant
information in the comment.

Tidy up the reading of the data registers in the (*insn_read).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: tidy up A/D Gain/Channel register defines
H Hartley Sweeten [Wed, 4 May 2016 19:47:10 +0000 (12:47 -0700)]
staging: comedi: dt2811: tidy up A/D Gain/Channel register defines

Cleanup the defines for this register and its bits and remove the
redundant information in the comment.

Make the (*insn_read) use the range to set the gain bits correctly.
Currently the gain is always set to 1.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: tidy up A/D Control/Status register defines
H Hartley Sweeten [Wed, 4 May 2016 19:47:09 +0000 (12:47 -0700)]
staging: comedi: dt2811: tidy up A/D Control/Status register defines

Cleanup the defines for this register and its bits and remove the
redundant information in the comment.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: remove disabled code
H Hartley Sweeten [Wed, 4 May 2016 19:47:08 +0000 (12:47 -0700)]
staging: comedi: dt2811: remove disabled code

There is no reason the (*attach) should be trying to read an analog
input sample. Remove this disabled 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>
8 years agostaging: comedi: dt2811: remove redundant block comment
H Hartley Sweeten [Wed, 4 May 2016 19:47:07 +0000 (12:47 -0700)]
staging: comedi: dt2811: remove redundant block comment

The configuration options are listed in the comedi comment block.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt2811: tidy up copyright and comedi comments
H Hartley Sweeten [Wed, 4 May 2016 19:47:06 +0000 (12:47 -0700)]
staging: comedi: dt2811: tidy up copyright and comedi comments

Fix the checkpatch.pl issue:
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging:comedi:Use unsigned int instead of unsigned
Nikita Eshkeev [Tue, 3 May 2016 15:22:23 +0000 (18:22 +0300)]
staging:comedi:Use unsigned int instead of unsigned

This patch fixed the checkpatch.pl warning:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Nikita Eshkeev <kastolom@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: update the MODULE_DESCRIPTION
H Hartley Sweeten [Tue, 3 May 2016 19:30:03 +0000 (12:30 -0700)]
staging: comedi: das16m1: update the MODULE_DESCRIPTION

Change the MODULE_DESCRIPTION to something more usefull than the generic
"Comedi low-level 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>
8 years agostaging: comedi: das16m1: rename struct das16m1_private_struct
H Hartley Sweeten [Tue, 3 May 2016 19:30:02 +0000 (12:30 -0700)]
staging: comedi: das16m1: rename struct das16m1_private_struct

For aesthetics, remove the redundant '_struct' suffix.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: convert munge_sample_array() into a subdevice (*munge)
H Hartley Sweeten [Tue, 3 May 2016 19:30:01 +0000 (12:30 -0700)]
staging: comedi: das16m1: convert munge_sample_array() into a subdevice (*munge)

For aesthetics, convert this function into a subdevice (*munge) function and let
the comedi core handle the munging.

Add a comment about why the data needs to be munged.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: minor cleanup to das16m1_ai_insn_read()
H Hartley Sweeten [Tue, 3 May 2016 19:30:00 +0000 (12:30 -0700)]
staging: comedi: das16m1: minor cleanup to das16m1_ai_insn_read()

The (*insn_read) functions return the number of data values read. The 'n'
value is correct but for clarity change the return to 'insn->n'.

For aesthetics, change the 'n' loop variable name to 'i'. That's more common
in 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>
8 years agostaging: comedi: das16m1: init local variables when declared
H Hartley Sweeten [Tue, 3 May 2016 19:29:59 +0000 (12:29 -0700)]
staging: comedi: das16m1: init local variables when declared

For aesthetics, init the comedi_subdevice, comedi_async, and comedi_cmd
pointers when the local variables are declared.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: remove an unnecessery comment
H Hartley Sweeten [Tue, 3 May 2016 19:29:58 +0000 (12:29 -0700)]
staging: comedi: das16m1: remove an unnecessery comment

The configuration options are listed in the comedi comment block.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: tidy up misc. defines
H Hartley Sweeten [Tue, 3 May 2016 19:29:57 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up misc. defines

For aesthetics, move these after the register map defines and rename
the FIFO_SIZE define.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: tidy up 8254/8255 register defines
H Hartley Sweeten [Tue, 3 May 2016 19:29:56 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up 8254/8255 register defines

For aesthetics, rename these defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: tidy up digital output subdevice init
H Hartley Sweeten [Tue, 3 May 2016 19:29:55 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up digital output subdevice init

Add some whitespace to the subdevice init and rename the support
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>
8 years agostaging: comedi: das16m1: tidy up das16m1_di_insn_bits()
H Hartley Sweeten [Tue, 3 May 2016 19:29:54 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up das16m1_di_insn_bits()

The (*insn_bits) for a digital input subdevice only needs to return the
state of the inputs in data[1]. Remove 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>
8 years agostaging: comedi: das16m1: tidy up digital input subdevice init
H Hartley Sweeten [Tue, 3 May 2016 19:29:53 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up digital input subdevice init

Add some whitespace to the subdevice init and rename the support
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>
8 years agostaging: comedi: das16m1: tidy up analog input subdevice init
H Hartley Sweeten [Tue, 3 May 2016 19:29:52 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up analog input subdevice init

Add some whitespace to the subdevice init and rename the support
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>
8 years agostaging: comedi: das16m1: introduce das16m1_ai_set_queue()
H Hartley Sweeten [Tue, 3 May 2016 19:29:51 +0000 (12:29 -0700)]
staging: comedi: das16m1: introduce das16m1_ai_set_queue()

Introduce a helper function to handle writing the channel/gain data to
the queue for single channel reads, (*insn_read), and multi-channel
scans, (*do_cmd).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: tidy up queue register defines
H Hartley Sweeten [Tue, 3 May 2016 19:29:50 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up queue register defines

Rename these defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: tidy up interrupt control register defines
H Hartley Sweeten [Tue, 3 May 2016 19:29:49 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up interrupt control register defines

Rename these defines and use the BIT macro to define the bits. Define
some macros for the multi-bit fields in the register.

Rename the private data 'control_state' member to better match the
register name.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: remove unnecessary ai 'cancel' operations
H Hartley Sweeten [Tue, 3 May 2016 19:29:48 +0000 (12:29 -0700)]
staging: comedi: das16m1: remove unnecessary ai 'cancel' operations

The comedi core will only call the (*insn_read) and (*do_cmd) functions
if the subdevice is not "busy". All async commands are terminated by
a (*cancel) operation which clears the INTE and PACER_MASK bits in the
interrupt control register. These bits are also cleared when the driver
first attaches. There is no need for the (*insn_read) or (*do_cmd) to
duplicate the cancel.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: tidy up clear interrupt register define
H Hartley Sweeten [Tue, 3 May 2016 19:29:47 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up clear interrupt register define

Rename this define and use a consistent comment throughout 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>
8 years agostaging: comedi: das16m1: tidy up digital input/output register defines
H Hartley Sweeten [Tue, 3 May 2016 19:29:46 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up digital input/output register defines

The digtial inputs and outputs are read/written using the same register
offset but they are different logical registers. Physically they are the
same register with the hi 4 bits returning the inputs and the lo 4 bits
driving the outputs.

For aesthetics, use two different defines for the registers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: tidy up control/status register defines
H Hartley Sweeten [Tue, 3 May 2016 19:29:45 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up control/status register defines

Rename the defines for the control/status register/bits. Use the BIT
macro to define the bits.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: tidy up analog input data register defines
H Hartley Sweeten [Tue, 3 May 2016 19:29:44 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up analog input data register defines

Convert the inline helper munge_sample() into a macro and rename the
defines for the analog input data register/bits. Use the register define
when accessing this register instead of just 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>
8 years agostaging: comedi: das16m1: tidy up register map comment
H Hartley Sweeten [Tue, 3 May 2016 19:29:43 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up register map comment

The comment about all the registers is not neccessary. The defines
give the same information. This also fixes a checkpatch.pl issue:
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: remove unnecessary private data comments
H Hartley Sweeten [Tue, 3 May 2016 19:29:42 +0000 (12:29 -0700)]
staging: comedi: das16m1: remove unnecessary private data comments

These comments are just extra cruft. Removing them also fixes a
checkpatch.pl issue:
WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: tidy up comment in das16m1_cmd_exec()
H Hartley Sweeten [Tue, 3 May 2016 19:29:41 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up comment in das16m1_cmd_exec()

Fix the checkpatch.pl issue:
WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: tidy up comments in das16m1_handler()
H Hartley Sweeten [Tue, 3 May 2016 19:29:40 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up comments in das16m1_handler()

Fix the checkpatch.pl issue:
WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: das16m1: tidy up copyright and comedi comments
H Hartley Sweeten [Tue, 3 May 2016 19:29:39 +0000 (12:29 -0700)]
staging: comedi: das16m1: tidy up copyright and comedi comments

Fix the checkpatch.pl issue:
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/libcfs: Remove "Please contact Oracle" from header
Oleg Drokin [Wed, 15 Jun 2016 03:33:43 +0000 (23:33 -0400)]
staging/lustre/libcfs: Remove "Please contact Oracle" from header

The "Please contact Oracle Corporation" lines are removed since not
only Oracle has nothing to do with Lustre anymore, there's a pointer
to GPL already that's independent of any particular company.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre: Remove stray line from selftest/selftest.h
Oleg Drokin [Wed, 15 Jun 2016 03:33:42 +0000 (23:33 -0400)]
staging/lustre: Remove stray line from selftest/selftest.h

The 'copy of GPLv2]' is an ending from template that's no longer needed,
so remove it to avoid any extra confusion.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/lov: Fix gpl URL in lov_pool.c
Oleg Drokin [Wed, 15 Jun 2016 03:33:41 +0000 (23:33 -0400)]
staging/lustre/lov: Fix gpl URL in lov_pool.c

There's no longer a matching sun.com URL, so refer to
gnu.org copy.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre: Replace sun.com GPLv2 URL with gnu.org one.
Oleg Drokin [Wed, 15 Jun 2016 03:33:40 +0000 (23:33 -0400)]
staging/lustre: Replace sun.com GPLv2 URL with gnu.org one.

http://www.sun.com/software/products/lustre/docs/GPLv2.pdf is no
longer around, so replae it with (hopefully more permanent)
http://http://www.gnu.org/licenses/gpl-2.0.html

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reported-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre: Remove the "Please contact SUN for GPL" from headers
Oleg Drokin [Wed, 15 Jun 2016 03:33:39 +0000 (23:33 -0400)]
staging/lustre: Remove the "Please contact SUN for GPL" from headers

Since SUN is no longer around and there's no point in contacting them,
just remove that whole thing. Copy of GPL is available online anyway
(URLs to be updated in next patch).

This patch was generated with:
find drivers/staging/lustre -name "*.[ch]" -exec perl -0777 -i -pe 's/ \* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,\n \* CA 95054 USA or visit www.sun.com if you need additional information or\n \* have any questions.\n \*\n//igs' {} \;

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Reported-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: socklnd: remove typedefs
James Simmons [Fri, 10 Jun 2016 20:14:23 +0000 (16:14 -0400)]
staging: lustre: socklnd: remove typedefs

Remove all remaining typedefs in socklnd driver.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: o2iblnd: remove typedefs
James Simmons [Fri, 10 Jun 2016 20:13:39 +0000 (16:13 -0400)]
staging: lustre: o2iblnd: remove typedefs

Remove all remaining typedefs in o2iblnd driver.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/lmv: Fix Multiple Assignments
Nathaniel Clark [Fri, 10 Jun 2016 02:35:18 +0000 (22:35 -0400)]
staging/lustre/lmv: Fix Multiple Assignments

Fix all multiple assignments on lustre/lmv directory.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/ptlrpc: Fix Multiple Assignments
Nathaniel Clark [Fri, 10 Jun 2016 02:35:17 +0000 (22:35 -0400)]
staging/lustre/ptlrpc: Fix Multiple Assignments

Fix all multiple assignments on lustre/ptlrpc directory.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/obdclass: Fix Multiple Assignments
Nathaniel Clark [Fri, 10 Jun 2016 02:35:16 +0000 (22:35 -0400)]
staging/lustre/obdclass: Fix Multiple Assignments

Fix all multiple assignments on lustre/obdclass directory.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/lov: Fix Multiple Assignments
Nathaniel Clark [Fri, 10 Jun 2016 02:35:15 +0000 (22:35 -0400)]
staging/lustre/lov: Fix Multiple Assignments

Fix all multiple assignments on lustre/lov directory.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/llite: Fix Multiple Assignments
Nathaniel Clark [Fri, 10 Jun 2016 02:35:14 +0000 (22:35 -0400)]
staging/lustre/llite: Fix Multiple Assignments

Fix all multiple assignments on lustre/llite directory.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/ldlm: Fix Multiple Assignments
Nathaniel Clark [Fri, 10 Jun 2016 02:35:13 +0000 (22:35 -0400)]
staging/lustre/ldlm: Fix Multiple Assignments

Fix all multiple assignments on lustre/ldlm directory.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/fid: Fix Multiple Assignments
Nathaniel Clark [Fri, 10 Jun 2016 02:35:12 +0000 (22:35 -0400)]
staging/lustre/fid: Fix Multiple Assignments

Fix all multiple assignments on lustre/fid directory.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/osc: Fix Multiple Assignment Warnings
Nathaniel Clark [Fri, 10 Jun 2016 02:35:11 +0000 (22:35 -0400)]
staging/lustre/osc: Fix Multiple Assignment Warnings

Fix all multiple assignments on lustre/osc directory.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: hide call to Posix ACL in ifdef
Arnd Bergmann [Mon, 13 Jun 2016 20:44:57 +0000 (22:44 +0200)]
staging: lustre: hide call to Posix ACL in ifdef

A call to forget_cached_acl() was recently added to the lustre file
system, but this is only available when CONFIG_FS_POSIX_ACL is
enabled, otherwise the build now fails with:

lustre/llite/file.c: In function 'll_get_acl':
lustre/llite/file.c:3134:2: error: implicit declaration of function 'forget_cached_acl' [-Werror=implicit-function-declaration]
  forget_cached_acl(inode, type);

This adds one more #ifdef for this call, corresponding to the
other 22 such checks for ACL in lustre.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: b788dc51e425 ("staging: lustre: llite: drop acl from cache")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: lnet: Replace semaphore ln_rc_signal with completion
Binoy Jayan [Wed, 8 Jun 2016 07:50:42 +0000 (13:20 +0530)]
staging: lustre: lnet: Replace semaphore ln_rc_signal with completion

The semaphore ln_rc_signal is used as completion, so convert it to
struct completion.  Semaphores are going away in the future.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Acked-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: llite: remove lloop device
James Simmons [Wed, 8 Jun 2016 22:50:12 +0000 (18:50 -0400)]
staging: lustre: llite: remove lloop device

The lloop device was original developed to work around
the lack of direct I/O for the default loop back device.
Also the lloop device greatly out performed the default
loop back device. The lloop hasn't been worked on for
some time and now it no longer out performs the loop
device and loop now supports direct I/O. Since this is
the case we can delete this device.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoMerge tag 'iio-for-4.8a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
Greg Kroah-Hartman [Thu, 9 Jun 2016 16:15:58 +0000 (09:15 -0700)]
Merge tag 'iio-for-4.8a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

First round of IIO new device support, features and cleanups for the 4.8 cycle.

New device support
* ads1015
  - add ads1115 support
* bma220 accelerometer
  - new driver
  - triggered buffer support.
* bmc150
  - add bmm150 support.
* bmp280
  - bme280 support with addition of humidity channel.
* max5487 potentiometer
  - new driver
* MMA7660FC accelerometer.
  - New driver
* st-pressure
  - support for the lps22hb
* loop trigger.
  - This one is *nasty* but we have real applications (parrot drones) where
  it is useful.  The trigger basically spins as hard as it can firing off
  a new trigger each time all triggered devices come back to say they are
  done.  It doesn't hang a machine even when doing it on a dummy driver.
  A lot nicer than having this implemented within lots of device drivers
  anyway.

Core stuff
* Add support to create IIO devices via configfs (similar to we did for
triggers a while back) + docs.
* New channel types
  - IIO_ELECTRICAL_CONDUCTIVITY
* Couple of MAINTAINERS patches to list the device tree bindings.
* Make trigger ops structure non optional (comment fix). It hasn't been for
an awful long time, but that's not what the description said.

New features
* ak8975
  - support adapters that are limited to byte data only by allowing the
  emulated block read i2c function that was recently introduced.
* atlas-ph
  - support atlas-ec (electrical conductivity sensor)
* bmi160
  - add available frequency and scale attributes to make the driver
  more user friendly (and avoid having to read the datasheet to know
  what will work).
* dummy
  - move creation to configfs interface.  It's not real hardware so we
  are not that worried about the ABI breakage ;)
* mma8452
  - oversampling ration support
* nau7802
  - expose available gains to make life easier for userspace.
* st-sensors
  - allow use of emulation for SMBus block reads as all the st parts support
  it.
* ti-ads1015
  - list datasheet names to allow their use by inkernel consumers.
* Various module alias additions to help auto probing.  Drop one redundant one
as well.

Cleanups
* ad7266, ad7476, ad7887, ad7923, ad799x
  - use direct mode claim function rather than open coding it during sensor
  read (prevents switching on buffers mid read).
* ad7793, ad7791
  - use direct mode claim to prevent frequency changes when buffers running.
* afe440x - These are ABI breaking but the driver requires custom userspace
  code to do anything useful anyway and that is still being written and under
  control of TI.  Ultimately we may have other libraries to do pulse
  oximetry with these devices but we aren't aware of any yet.
  - kernel-doc format fixes
  - drop ifdef fun around of_match_ptr - it's not worth the mess to save
  a tiny amount of space.
  - drop some unnecessary register initializations.
  - drop the weird locked gain modes as they gain us nothing (can just set
  all gains separately).
  - remove handling of offset attributes seeing as no channels actually have
  them (oops)
  - Drop the LED3 input channel as it's an alias for ALED2.
  - *big one* remove channel names - an experiment that turned out to not
  make sense - see patch for details.
  - use regmap fields to clean up code.
  - tie the tia gain stages to appropriate channels in the ABI as that is
  what they really effect. Same with the LED currents.
  - cleanout some unused defines and fix a missnamed one.
* atlas-ph
  - reorganise to allow support of other similar parts.
* bmc150
  - document supported chips in kconfig help.
* jsa1212
  - drop an unneeded i2c functionality check for functionality the driver
  doesn't use.
* mxs-lradc
  - simply touch screen registration code.
  - remove the touch screen unregister as all devm based now.
  - disable only those channels that are masked in hardware stop (others
  are already dealt with elsewhere)
* st-sensors
  - unexport st_sensors_get_buffer_element as nothing outside the st-sensors
  core driver uses it.
  - fix handling of failure to start up regulators.
* tpl0102
  - drop an i2c functionality test for features that aren't needed.
* ti-am335x
  - use variable name rather than type in sizeof for clarity.
  - use SIMPLE_DEV_PM_OPS helper macro to tidy up a bit.

Tools
* Add install / uninstall to makefile.  Someone cares, so presumably
some people will find it useful!
*  generic_buffer
   - rename to iio_generic_buffer to line up with other tools.
   - handle cleanup when receiving signals
   - Add a --device-num option and a --trigger-num option rather than
   relying on naming which doesn't work if you have two of the same part.

8 years agostaging: unisys: visornic: change return statements
David Binder [Sat, 14 May 2016 03:17:22 +0000 (23:17 -0400)]
staging: unisys: visornic: change return statements

Changes return statements in visornic_rx() to use literals instead of a
variable. Also changes function description to reflect the correct return
type.

Signed-off-by: David Binder <david.binder@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: iovmcall_gnuc.h change -1 return values
Erik Arfvidson [Sat, 14 May 2016 03:17:21 +0000 (23:17 -0400)]
staging: unisys: iovmcall_gnuc.h change -1 return values

This patch changes the vague -1 return values to -EPERM.
This operation is not supported is a good alternative
to -1 because the return is basically telling the caller
that the processor doesn't support vmcall operations.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorchipset change -1 return value
Erik Arfvidson [Sat, 14 May 2016 03:17:20 +0000 (23:17 -0400)]
staging: unisys: visorchipset change -1 return value

This patch changes the vague -1 return value to -EINVAL

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus change -1 return values
Erik Arfvidson [Sat, 14 May 2016 03:17:19 +0000 (23:17 -0400)]
staging: unisys: visorbus change -1 return values

This patch changes the vague -1 return values to -EFAULT since
it would be the most appropriate, given that this error
would only occur in an unexpected bad offset field.
Resulting in a bad address.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorhba change -1 return value
Erik Arfvidson [Sat, 14 May 2016 03:17:18 +0000 (23:17 -0400)]
staging: unisys: visorhba change -1 return value

This patch changes the vague -1 return value to -EBUSY

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorinput change -1 return value
Erik Arfvidson [Sat, 14 May 2016 03:17:17 +0000 (23:17 -0400)]
staging: unisys: visorinput change -1 return value

This patch changes the vague -1 return value to -EINVAL

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorhba: "Prefer 'unsigned int'" checkpatch warnings
Tim Sell [Sat, 14 May 2016 03:17:16 +0000 (23:17 -0400)]
staging: unisys: visorhba: "Prefer 'unsigned int'" checkpatch warnings

This patch fixes a few checkpatch warnings in visorhba:

    WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visornic: remove extraneous error check
David Binder [Sat, 14 May 2016 03:17:15 +0000 (23:17 -0400)]
staging: unisys: visornic: remove extraneous error check

Removes an extraneous error check in devdata_initialize(), and updates the
function comment accordingly.

Signed-off-by: David Binder <david.binder@unisys.com>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visornic: check for error instead of success
David Binder [Thu, 12 May 2016 13:14:48 +0000 (09:14 -0400)]
staging: unisys: visornic: check for error instead of success

Changes the conditional logic to check for an error code instead
of a success code.

Signed-off-by: David Binder <david.binder@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorhba: return 0 literal
David Binder [Thu, 12 May 2016 13:14:47 +0000 (09:14 -0400)]
staging: unisys: visorhba: return 0 literal

Returns 0 instead of variable rc in visorhba_init().

Signed-off-by: David Binder <david.binder@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visornic: cleanup error handling
David Binder [Thu, 12 May 2016 13:14:46 +0000 (09:14 -0400)]
staging: unisys: visornic: cleanup error handling

Adjusts goto labels to prevent attempts to free unallocated resources.

Signed-off-by: David Binder <david.binder@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visornic: simplify visornic if statements
David Binder [Thu, 12 May 2016 13:14:45 +0000 (09:14 -0400)]
staging: unisys: visornic: simplify visornic if statements

Changes the conditional logic by looking for the absence of work
to do, instead of the opposite.

Signed-off-by: David Binder <david.binder@unisys.com>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorhba: visorhbas_open[] no longer used, so deleted
Tim Sell [Thu, 12 May 2016 13:14:44 +0000 (09:14 -0400)]
staging: unisys: visorhba: visorhbas_open[] no longer used, so deleted

The prior patch which simplified the visorhba debugfs interface made it so
visorhbas_open[] and VISORHBA_OPEN_MAX were no longer needed, so they have
now been deleted.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorhba: simplify and enhance debugfs interface
Tim Sell [Thu, 12 May 2016 13:14:43 +0000 (09:14 -0400)]
staging: unisys: visorhba: simplify and enhance debugfs interface

debugfs info for each visorhba device is now presented by a file named of
the following form within the debugfs tree:

    visorhba/vbus<x>:dev<y>/info

where <x> is the vbus number, and <y> is the relative device number.

Also, the debugfs presentation function was converted to use the seq_file
interface, so that it could access the device context without resorting to
a global array.  This also simplified the function.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorhba: remove unused (and broken) logic
Tim Sell [Thu, 12 May 2016 13:14:42 +0000 (09:14 -0400)]
staging: unisys: visorhba: remove unused (and broken) logic

The handling of CMD_NOTIFYGUEST_TYPE messages from the IO partition appears
to be only partially implemented, but fortunately it is never used in our
current environment.  This patch deletes the unused code.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorhba: correct scsi task mgmt completion handling
Tim Sell [Thu, 12 May 2016 13:14:41 +0000 (09:14 -0400)]
staging: unisys: visorhba: correct scsi task mgmt completion handling

This patch is necessary to enable ANY task mgmt command to complete
successfully via visorhba.

When issuing a task mgmt command (CMD_SCSITASKMGMT_TYPE) to the IO
partition (back-end), forward_taskmgmt_command() includes pointers
within the command area that will be used to wake up the issuing
process and provide the result when the command completes:

    cmdrsp->scsitaskmgmt.notify_handle = (u64)&notifyevent;
    cmdrsp->scsitaskmgmt.notifyresult_handle = (u64)&notifyresult;

'notify_handle' is a pointer to a 'wait_queue_head_t' variable, and
'notifyresult' is a pointer to an int.  Both of these are just local
stack variables in the issuing process.

The way it's supposed to happen is that when the IO partition completes
the command, in our completion handling we get copies of those pointers
back from the IO partition, where we stash the result of the command at
'*notifyresult' (which should not be 0xffff, because that is the initial
value that the caller is looking to see a change in), and wake up the
wait queue at '*notify_handle'.  There are several places we do that dance,
but prior to this patch, we always do it WRONG, like:

    cmdrsp->scsitaskmgmt.notifyresult_handle = TASK_MGMT_FAILED;
    wake_up_all((wait_queue_head_t *)cmdrsp->scsitaskmgmt.notify_handle);

The wake_up_all() part is correct (albeit with the help of the sloppy
pointer casting, but that's irrelevant to the bug), but the assignment of
'notifyresult_handle' is WRONG, and SHOULD read:

    *(int *)(cmdrsp->scsitaskmgmt.notifyresult_handle) = TASK_MGMT_FAILED;

Without this change, the caller is NEVER going to notice a change in his
local value of 'notifyresult' when he does the:

    if (!wait_event_timeout(notifyevent, notifyresult != 0xffff,
                            msecs_to_jiffies(45000)))

and hence will be timing out EVERY taskmgmt command.

This patch also eliminates the need for sloppy casting of pointers
back-and-forth between u64 values, with the help of idr_alloc() to provide
handles for us.  It is the generated int handles we pass to the IO
partition to denote our completion context, and these are validated and
converted back to the required pointers when the task mgmt commands are
returned back to us by the IO partition.

== Testing ==

You must enable dynamic debugging in visorhba (build kernel with
'CONFIG_DYNAMIC_DEBUG=y', provide kernel parameter 'visorhba.dyndbg=+p')
to see kernel messages involved with visorhba scsi task mgmt commands,
which were added in this patch in the form of a few dev_dbg() / pr_debug()
messages.

In order to inject faults necessary to get visorhba to actully issue scsi
task mgmt commands, you will need to compile a kernel with
CONFIG_FAIL_IO_TIMEOUT and friends, in the "Kernel hacking" section:
* Enable "Fault-injection framework"
  * Enable "Fault-injection capability for disk IO"
  * Enable "Fault-injection capability for faking disk interrupts"
* Enable "Debugfs entries for fault-injection capabilities"

When running a kernel with those options, you can manually inject a fault
that will force a scsi task mgmt command to be issued like this:

    # mount -t debugfs nodev /sys/kernel/debug
    # cd /sys/kernel/debug/fail_io_timeout
    # cat interval
    1
    # cat probability
    0
    # cat times
    1
    # echo 100 >probability
    # cd /sys/block/sda
    # l | grep fail
    -rw-r--r--  1 root root 4096 May  5 10:53 io-timeout-fail
    -rw-r--r--  1 root root 4096 May  5 10:54 make-it-fail
    # echo 1 >io-timeout-fail
    # echo 1 >make-it-fail

To test this patch, after performing the above steps, I did something to
force a block device i/o, then shortly afterwards examined the kernel log.
There I found evidence that visorhba had successfully issued a task mgmt
command, and that it completed successfully:

    [  333.352612] FAULT_INJECTION: forcing a failure.
    name fail_io_timeout, interval 1, probability 100, space 0, times 1
    [  333.352617] CPU: 0 PID: 295 Comm: vhba_incoming Tainted: G         C
                   4.6.0-rc3-ARCH+ #2
    [  333.352619] Hardware name: Dell Inc. PowerEdge T110/ ,
                   BIOS 1.23 12/15/2009
    [  333.352620]  0000000000000000 ffff88001d1a7dd0 ffffffff8125beeb
                    ffffffff818507c0
    [  333.352623]  0000000000000064 ffff88001d1a7df0 ffffffff8128047a
                    ffff8800113462b0
    [  333.352625]  ffff88000e523000 ffff88001d1a7e00 ffffffff81241c79
                    ffff88001d1a7e18
    [  333.352627] Call Trace:
    [  333.352634]  [<ffffffff8125beeb>] dump_stack+0x4d/0x72
    [  333.352637]  [<ffffffff8128047a>] should_fail+0x11a/0x120
    [  333.352641]  [<ffffffff81241c79>] blk_should_fake_timeout+0x29/0x30
    [  333.352643]  [<ffffffff81241c36>] blk_complete_request+0x16/0x30
    [  333.352654]  [<ffffffffa0118b36>] scsi_done+0x26/0x80 [scsi_mod]
    [  333.352657]  [<ffffffffa014a56c>] process_incoming_rsps+0x2bc/0x770
                                         [visorhba]
    [  333.352661]  [<ffffffff81095630>] ? wait_woken+0x80/0x80
    [  333.352663]  [<ffffffffa014a2b0>] ? add_scsipending_entry+0x100/0x100
                                         [visorhba]
    [  333.352666]  [<ffffffff81077759>] kthread+0xc9/0xe0
    [  333.352669]  [<ffffffff814609d2>] ret_from_fork+0x22/0x40
    [  333.352671]  [<ffffffff81077690>] ? kthread_create_on_node+0x180/0x180
    [  364.025672] sd 0:0:1:1: visorhba: initiating type=1 taskmgmt command
    [  364.029721] visorhba: notifying initiator with result=0x1
    [  364.029726] sd 0:0:1:1: visorhba: taskmgmt type=1 success; result=0x1

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorhba: delete processing of vdiskmgmt commands
Tim Sell [Thu, 12 May 2016 13:14:40 +0000 (09:14 -0400)]
staging: unisys: visorhba: delete processing of vdiskmgmt commands

We never issue SCSI commands of type CMD_VDISKMGMT_TYPE, so there is no
need to have code that processes their completions.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: cleanup file headers
Wolfram Sang [Tue, 31 May 2016 10:56:43 +0000 (12:56 +0200)]
staging: ks7010: cleanup file headers

Remove svn-ids and fix typos in the licence declaration. Add my
copyright to the sdio code which I worked on mainly.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: drop counting sd errors
Wolfram Sang [Tue, 31 May 2016 10:56:42 +0000 (12:56 +0200)]
staging: ks7010: drop counting sd errors

They were counted but never really used anywhere. Also change the printk
to a debug print, since it mostly shows on the expected -ENOMEDIUM on
card removal.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: simplify module_init/exit
Wolfram Sang [Tue, 31 May 2016 10:56:41 +0000 (12:56 +0200)]
staging: ks7010: simplify module_init/exit

The printouts are not needed, the driver core has enough debug output
for this if wanted. So, use a helper to save boilerplate code.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: adapt to new trans_start handling
Wolfram Sang [Tue, 31 May 2016 10:56:40 +0000 (12:56 +0200)]
staging: ks7010: adapt to new trans_start handling

trans_start is gone from netdevice, so use the new helper function to
set the mark.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: fix module annotations
Wolfram Sang [Tue, 31 May 2016 10:56:39 +0000 (12:56 +0200)]
staging: ks7010: fix module annotations

List all authors, beautify description, match license to what is stated
in file headers, add firmware information.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: remove supported card table with one element
Wolfram Sang [Tue, 31 May 2016 10:56:38 +0000 (12:56 +0200)]
staging: ks7010: remove supported card table with one element

There is only this card supported, no need to iterate over the table.
The resulting firmware filename wasn't used anyway, but came from the
config file or hardcoded default.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: indent ks7010_sdio.c
Wolfram Sang [Tue, 31 May 2016 10:56:37 +0000 (12:56 +0200)]
staging: ks7010: indent ks7010_sdio.c

Unlike the previous patches which are plain indent outcomes, this has
some manual fixups to be not overly strict with the 80 char limit.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: indent michael_mic.h
Wolfram Sang [Tue, 31 May 2016 10:56:36 +0000 (12:56 +0200)]
staging: ks7010: indent michael_mic.h

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: indent michael_mic.c
Wolfram Sang [Tue, 31 May 2016 10:56:35 +0000 (12:56 +0200)]
staging: ks7010: indent michael_mic.c

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: indent ks_wlan_net.c
Wolfram Sang [Tue, 31 May 2016 10:56:34 +0000 (12:56 +0200)]
staging: ks7010: indent ks_wlan_net.c

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: indent ks_wlan_ioctl.h
Wolfram Sang [Tue, 31 May 2016 10:56:33 +0000 (12:56 +0200)]
staging: ks7010: indent ks_wlan_ioctl.h

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: indent ks_wlan.h
Wolfram Sang [Tue, 31 May 2016 10:56:32 +0000 (12:56 +0200)]
staging: ks7010: indent ks_wlan.h

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: indent ks_hostif.h
Wolfram Sang [Tue, 31 May 2016 10:56:31 +0000 (12:56 +0200)]
staging: ks7010: indent ks_hostif.h

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: indent ks_hostif.c
Wolfram Sang [Tue, 31 May 2016 10:56:30 +0000 (12:56 +0200)]
staging: ks7010: indent ks_hostif.c

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: indent ks7010_sdio.h
Wolfram Sang [Tue, 31 May 2016 10:56:29 +0000 (12:56 +0200)]
staging: ks7010: indent ks7010_sdio.h

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: indent ks7010_config.c
Wolfram Sang [Tue, 31 May 2016 10:56:28 +0000 (12:56 +0200)]
staging: ks7010: indent ks7010_config.c

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ks7010: indent eap_packet.h
Wolfram Sang [Tue, 31 May 2016 10:56:27 +0000 (12:56 +0200)]
staging: ks7010: indent eap_packet.h

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>