platform/kernel/linux-starfive.git
10 years agostaging: comedi: ni_tio: make ni_tio_winsn() a proper comedi (*insn_write)
H Hartley Sweeten [Thu, 19 Dec 2013 23:32:01 +0000 (16:32 -0700)]
staging: comedi: ni_tio: make ni_tio_winsn() a proper comedi (*insn_write)

Change the parameters to ni_tio_winsn() to make it a proper comedi
(*insn_write) function. This allows using it directly and removing the
wrapper functions in the ni_660x and ni_mio_common modules.

For aesthetics, rename the 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: ni_tio: make ni_tio_rinsn() a proper comedi (*insn_read)
H Hartley Sweeten [Thu, 19 Dec 2013 23:32:00 +0000 (16:32 -0700)]
staging: comedi: ni_tio: make ni_tio_rinsn() a proper comedi (*insn_read)

Change the parameters to ni_tio_rinsn() to make is a proper comedi
(*insn_read) function. This allows using it directly and removing the
wrapper functions in the ni_660x and ni_mio_common modules.

For aesthetics, rename the 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: ni_tio.h: remove subdev_to_counter()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:59 +0000 (16:31 -0700)]
staging: comedi: ni_tio.h: remove subdev_to_counter()

This inline helper function simply returns the s->private void *.
Remove the helper and just get the s->private void * directly where
needed.

Signed-off-by: H Hartley Sweeten <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_tio.h: remove 'extern' from exported function prototypes
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:58 +0000 (16:31 -0700)]
staging: comedi: ni_tio.h: remove 'extern' from exported function prototypes

The 'extern' is not required, remove it.

Tidy up the function prototypes a bit.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_tio: move the MODULE_* stuff to the end of file
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:57 +0000 (16:31 -0700)]
staging: comedi: ni_tio: move the MODULE_* stuff to the end of file

For aesthetics, move all the MODULE_* information to the end of the 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: ni_tiocmd: move the MODULE_* stuff to the end of file
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:56 +0000 (16:31 -0700)]
staging: comedi: ni_tiocmd: move the MODULE_* stuff to the end of file

For aesthetics, move all the MODULE_* information to the end of the 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: ni_tio: use a local var for the 'counter_index'
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:55 +0000 (16:31 -0700)]
staging: comedi: ni_tio: use a local var for the 'counter_index'

Use a local variable for the 'counter->counter_index' to help shorten the
long lines and ugly line breaks.

Signed-off-by: H Hartley Sweeten <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_tiocmd: use a local var for the 'counter_index'
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:54 +0000 (16:31 -0700)]
staging: comedi: ni_tiocmd: use a local var for the 'counter_index'

Use a local variable for the 'counter->counter_index' to help shorten the
long lines and ugly line breaks.

Signed-off-by: H Hartley Sweeten <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_tio_internal.h: add missing NITIO_*_REG macro
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:53 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: add missing NITIO_*_REG macro

The "HW Save" registers are the only ones missing an access macro.
Add one for completness.

Signed-off-by: H Hartley Sweeten <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_tio_internal.h: replace NITIO_Gi_Interrupt_Enable_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:52 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Interrupt_Enable_Reg()

The "Interrupt Enable" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_Status_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:51 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Status_Reg()

The "Status" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple define.

Rename the define for the shared status register.

Signed-off-by: H Hartley Sweeten <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_tio_internal.h: replace NITIO_Gi_Interrupt_Acknowledge_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:50 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Interrupt_Acknowledge_Reg()

The "Interrupt Acknowledge" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_ABZ_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:49 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_ABZ_Reg()

The "ABZ" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_DMA_Status_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:48 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_DMA_Status_Reg()

The "DMA Status" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_DMA_Config_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:47 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_DMA_Config_Reg()

The "DMA Config" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gxx_Joint_Status2_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:46 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gxx_Joint_Status2_Reg()

The shared "Status2" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gxx_Joint_Status1_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:45 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gxx_Joint_Status1_Reg()

The shared "Status1" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gxx_Joint_Reset_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:44 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gxx_Joint_Reset_Reg()

The shared "Reset" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gxx_Status_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:43 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gxx_Status_Reg()

The shared "Status" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_Second_Gate_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:42 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Second_Gate_Reg()

The "Second Gate" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_Counting_Mode_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:41 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Counting_Mode_Reg()

The "Counting Mode" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_Input_Select_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:40 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Input_Select_Reg()

The "Input Select" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_LoadB_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:39 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_LoadB_Reg()

The "LoadB" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_LoadA_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:38 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_LoadA_Reg()

The "LoadA" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_Mode_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:37 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Mode_Reg()

The "Mode" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_SW_Save_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:36 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_SW_Save_Reg()

The "SW Save" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_Command_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:35 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Command_Reg()

The "Command" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio_internal.h: replace NITIO_Gi_Autoincrement_Reg()
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:34 +0000 (16:31 -0700)]
staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Autoincrement_Reg()

The "AutoIncrement" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple 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>
10 years agostaging: comedi: ni_tio.h: rename the CamelCase enum ni_gpct_register labels
H Hartley Sweeten [Thu, 19 Dec 2013 23:31:33 +0000 (16:31 -0700)]
staging: comedi: ni_tio.h: rename the CamelCase enum ni_gpct_register labels

As prefered by the CodingStyle, rename all the CamelCase labels of the
enum ni_gpct_register.

Cleanup all the helper functions in ni_tio_internal.h that used the enum.

The 'counter_index' parameter to all the functions is the ni_gpct_device
'counter_index' which is initialized when the subdevices are setup. This
value is always < 4 so the default: BUG() cases can never happen. For
aesthetics, rename the 'counter_idx' to simply 'idx' and fix the type in
some of the helpers.

Also, remove the unnecessary break statements after the return statements.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: bcm: fixed warning about no and prohibited space in InterfaceIdleMode.c.
Gokulnath Avanashilingam [Fri, 20 Dec 2013 15:24:32 +0000 (20:54 +0530)]
staging: bcm: fixed warning about no and prohibited space in InterfaceIdleMode.c.

This patch fixes all the warning related to spacing issues
found by checkpatch.pl script in InterfaceIdleMode.c

Signed-off-by: Gokulnath Avanashilingam <Gokulnath.Avanashilingam@in.bosch.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: bcm: using time_after and time_before in InterfaceIdleMode.c
Gokulnath Avanashilingam [Fri, 20 Dec 2013 15:24:31 +0000 (20:54 +0530)]
staging: bcm: using time_after and time_before in InterfaceIdleMode.c

Used the time_after and time_before insted of comparing
the jiffies directly.This will fix the warnings and errors
found by the checkpatch.pl script.

Signed-off-by: Gokulnath Avanashilingam <Gokulnath.Avanashilingam@in.bosch.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: bcm: line over 80 characters in InterfaceIdleMode.c
Gokulnath Avanashilingam [Fri, 20 Dec 2013 15:24:30 +0000 (20:54 +0530)]
staging: bcm: line over 80 characters in InterfaceIdleMode.c

Fixed all the line over 80 characters warning found by
checkpatch.pl script.

Signed-off-by: Gokulnath Avanashilingam <Gokulnath.Avanashilingam@in.bosch.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: bcm: Remove Developer Debug prints in InterfaceIdleMode.c
Gokulnath Avanashilingam [Fri, 20 Dec 2013 15:24:29 +0000 (20:54 +0530)]
staging: bcm: Remove Developer Debug prints in InterfaceIdleMode.c

Removed the developer debug prints BCM_DEBUG_PRINT()
as per the TODO list, also removed braces for the
if-statement to match coding style

Signed-off-by: Gokulnath Avanashilingam <Gokulnath.Avanashilingam@in.bosch.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: sep: add missing destroy_workqueue() in sep_crypto.c
Wei Yongjun [Fri, 20 Dec 2013 03:05:16 +0000 (11:05 +0800)]
staging: sep: add missing destroy_workqueue() in sep_crypto.c

Add the missing destroy_workqueue() before return from
sep_crypto_setup() and sep_crypto_takedown().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: fix return value check in capa_hmac()
Wei Yongjun [Fri, 20 Dec 2013 03:41:11 +0000 (11:41 +0800)]
staging: lustre: fix return value check in capa_hmac()

In case of error, the function crypto_alloc_hash() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agorlt8192e: Removing unused defines in rltlib_endianfree.h
Andreas Frembs [Fri, 20 Dec 2013 10:29:10 +0000 (11:29 +0100)]
rlt8192e: Removing unused defines in rltlib_endianfree.h

Checkpatch mentioned that these macros should be defined with a 'do {...} while(0)' statement.
So we used grep to find all files using these macros and we found out that these macros were only used
in rtl819x_Qos.h, in the defines we removed before.
Since the macros are not used anywhere else we decided to remove them from the driver.

Signed-off-by: Andreas Frembs <andreas.frembs@studium.uni-erlangen.de>
Signed-off-by: Matthias Schoepe <matthias.schoepe@studium.uni-erlangen.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agortl8192e: Removing unused defines in rtl819x_Qos.h
Andreas Frembs [Fri, 20 Dec 2013 10:29:09 +0000 (11:29 +0100)]
rtl8192e: Removing unused defines in rtl819x_Qos.h

In rtl819x_Qos.h there were several macros defined but never used.
So we removed this macros.

Signed-off-by: Andreas Frembs <andreas.frembs@studium.uni-erlangen.de>
Signed-off-by: Matthias Schoepe <matthias.schoepe@studium.uni-erlangen.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agortl8192e: Fixing checkpatch errors
Andreas Frembs [Fri, 20 Dec 2013 10:29:08 +0000 (11:29 +0100)]
rtl8192e: Fixing checkpatch errors

This patch fixes the following checkpatch errors from rtllib_endianfree.h:
 - ERROR: Macros with complex values should be enclosed in parenthesis

Signed-off-by: Andreas Frembs <andreas.frembs@studium.uni-erlangen.de>
Signed-off-by: Matthias Schoepe <matthias.schoepe@studium.uni-erlangen.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agosilicom: remaining checkpatch issues in bypass.c
Michael Hoefler [Fri, 20 Dec 2013 13:51:13 +0000 (14:51 +0100)]
silicom: remaining checkpatch issues in bypass.c

In this patch we fix some "logical" errors in bypass.c of the silicom bypass
driver (in staging).

Checkpatch complains about the following errors:
 - unnecessary forward declarations in a source file
 - assignment in if condition

In addition to that the __init and __exit macros were missing at the init and
cleanup function.

There are still two warnings left for this file related to too many leadingtabs
at nested blocks. I did not touch this issue becasue the code needs really some
refactoring. And since i do not have the appropriate hardware to test the code,
i do not change the functionality in any way.

Signed-off-by: Michael Hoefler <michael.hoefler@studium.uni-erlangen.de>
Signed-off-by: Christoph Kohl <christoph.kohl@t-online.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agosilicom: fix coding style issues in bypass.c
Michael Hoefler [Fri, 20 Dec 2013 13:51:12 +0000 (14:51 +0100)]
silicom: fix coding style issues in bypass.c

This patch improves bypass.c (in staging) in terms of coding style. This
includes different issues some of them mentioned by checkpatch:

 - a c++ one line comment
 - parenthesis at return statementes
 - multiple definitions in one line
 - missing braces according to the style guide

Signed-off-by: Michael Hoefler <michael.hoefler@studium.uni-erlangen.de>
Signed-off-by: Christoph Kohl <christoph.kohl@t-online.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agosilicom: fix whitespace issues in bypass.c
Michael Hoefler [Fri, 20 Dec 2013 13:51:11 +0000 (14:51 +0100)]
silicom: fix whitespace issues in bypass.c

This patch addresses several problems in bypass.c found by checkpatch.
Furthermore it removes/adds some empty lines to make the code more readable.

The following problems are fixed:
 - line over 80 characters
 - space after logical operator !
 - spaces instead of tabs
 - missing empty line after local declarations
 - empty line after {

The empty line issues were not discovered by checkpatch but in my opinion these
changes make perfect sense in terms of readability.

Signed-off-by: Michael Hoefler <michael.hoefler@studium.uni-erlangen.de>
Signed-off-by: Christoph Kohl <christoph.kohl@t-online.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: r8188eu: Replace wrappers ODM_StallExecution, ODM_delay_us, and rtw_udelay_os
Larry Finger [Fri, 20 Dec 2013 04:38:43 +0000 (22:38 -0600)]
staging: r8188eu: Replace wrappers ODM_StallExecution, ODM_delay_us, and rtw_udelay_os

Each instance may bre replaced by udelay

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: r8188eu: Replace wrappers ODM_delay_ms() and rtw_mdelay_os() with a simple...
Larry Finger [Fri, 20 Dec 2013 04:38:42 +0000 (22:38 -0600)]
staging: r8188eu: Replace wrappers ODM_delay_ms() and rtw_mdelay_os() with a simple mdelay

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: r8188eu: Replace wrappers ODM_sleep_ms() and rtw_msleep_os() with a simple...
Larry Finger [Fri, 20 Dec 2013 04:38:41 +0000 (22:38 -0600)]
staging: r8188eu: Replace wrappers ODM_sleep_ms() and rtw_msleep_os() with a simple msleep

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: r8188eu: Replace rtw_get_current_time() with jiffies
Larry Finger [Fri, 20 Dec 2013 04:38:40 +0000 (22:38 -0600)]
staging: r8188eu: Replace rtw_get_current_time() with jiffies

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: r8188eu: Remove calls to _rtw_spinlock_free
Larry Finger [Fri, 20 Dec 2013 04:38:39 +0000 (22:38 -0600)]
staging: r8188eu: Remove calls to _rtw_spinlock_free

This wrapper does nothing on Linux. When calls to it were removed, a number of
routines became empty and could also be removed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: r8188eu: Remove wrapper around spin_lock_init
Larry Finger [Fri, 20 Dec 2013 04:38:38 +0000 (22:38 -0600)]
staging: r8188eu: Remove wrapper around spin_lock_init

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: r8188eu: Remove wrappers around spin_unlock_irqrestore
Larry Finger [Fri, 20 Dec 2013 04:38:37 +0000 (22:38 -0600)]
staging: r8188eu: Remove wrappers around spin_unlock_irqrestore

Again there are two - _exit_critical() and _exit_critical_ex().

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: r8188eu: Remove wrappers for spin_lock_irqsave
Larry Finger [Fri, 20 Dec 2013 04:38:36 +0000 (22:38 -0600)]
staging: r8188eu: Remove wrappers for spin_lock_irqsave

There are two such wrappers - _enter_critical() and _enter_critical_ex().

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: r8188eu: Remove wrapper around spin_unlock_bh
Larry Finger [Fri, 20 Dec 2013 04:38:35 +0000 (22:38 -0600)]
staging: r8188eu: Remove wrapper around spin_unlock_bh

With this change, a number of variables for storing flags are no longer used.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: r8188eu: Remove wrapper around spin_lock_bh
Larry Finger [Fri, 20 Dec 2013 04:38:34 +0000 (22:38 -0600)]
staging: r8188eu: Remove wrapper around spin_lock_bh

Some comment lines that mentioned spin_lock_bh() are also removed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: r8188eu: Remove pointless thread_exit macro
Larry Finger [Fri, 20 Dec 2013 04:38:33 +0000 (22:38 -0600)]
staging: r8188eu: Remove pointless thread_exit macro

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: uses kzalloc for allocating memory
Lidza Louina [Fri, 20 Dec 2013 02:12:12 +0000 (21:12 -0500)]
staging: dgap: uses kzalloc for allocating memory

Originally, this driver created it's own allocating
function. This patch removes that function and calls
kzalloc directly.

This patch affects:
 - driver.c
 - driver.h
 - fep5.c
 - tty.c

Signed-off-by: Lidza Louina <lidza.louina@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgnc: fix checkpatch.pl usage of comparison with jiffies
stalinsrinivasan.s [Fri, 20 Dec 2013 16:33:27 +0000 (22:03 +0530)]
staging: dgnc: fix checkpatch.pl usage of comparison with jiffies

This is a patch to the dgnc_cls.c file that fixes up comparison with
jiffies usage warning found by the checkpatch.pl tool

Signed-off-by: S. Stalin Srinivasan <stalinsrinivasan.s@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgnc: fix checkpatch.pl usage of volatile.
stalinsrinivasan.s [Fri, 20 Dec 2013 16:33:26 +0000 (22:03 +0530)]
staging: dgnc: fix checkpatch.pl usage of volatile.

This is a patch to the dgnc_cls.c file that fixes up volatile usage
warning found by the checkpatch.pl tool

Signed-off-by: S. Stalin Srinivasan <stalinsrinivasan.s@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgnc: fix 80 characters per line limitation and code indent warnings.
stalinsrinivasan.s [Fri, 20 Dec 2013 16:33:25 +0000 (22:03 +0530)]
staging: dgnc: fix 80 characters per line limitation and code indent warnings.

This is a patch to the dgnc_cls.c file that
fixes up 80 characters per line and code indent
warnings found by the checkpatch.pl tool.

Signed-off-by: S. Stalin Srinivasan <stalinsrinivasan.s@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoion_test: Add compat_ioctl support (v2)
John Stultz [Thu, 19 Dec 2013 23:56:23 +0000 (15:56 -0800)]
ion_test: Add compat_ioctl support (v2)

Prior to subitting this, Colin reworked the compat_ioctl support
for the ion_test driver, moving the structure to be the same size
on both 32 and 64 bit architectures.

Two small things were left out. The compat_ioctl ptr assignment,
and the fact that despite having uniform sized types in the
structure, the structure pads out to different sizes on different
arches.

This patch resolves this issue by adding a padding entry after
the write flag, and adding the compat_ioctl ptr.

Changes in v2:
- Add a padding int rather then making write a u64

Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Fix trailing whitespace in dgap_trace.c
Masanari Iida [Thu, 19 Dec 2013 15:42:55 +0000 (00:42 +0900)]
staging: dgap: Fix trailing whitespace in dgap_trace.c

This patch fixed trailing whitespace found by
checkpatch.pl within dgap_trace.c

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: bcm: line over 80 characters in InterfaceDld.c
Gokulnath A [Wed, 18 Dec 2013 17:42:38 +0000 (23:12 +0530)]
staging: bcm: line over 80 characters in InterfaceDld.c

Fixed all the line over 80 characters warning found by
checkpatch.pl script.

Signed-off-by: Gokulnath A <Gokulnath.Avanashilingam@in.bosch.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging:bcm: Removed developer debug prints in InterfaceDld.c
Gokulnath A [Wed, 18 Dec 2013 17:42:37 +0000 (23:12 +0530)]
staging:bcm: Removed developer debug prints in InterfaceDld.c

Removed the developer debug prints BCM_DEBUG_PRINT()
as per the TODO list, also removed braces for the
if-statement to match coding style

Signed-off-by: Gokulnath A <Gokulnath.Avanashilingam@in.bosch.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: bcm: DDRInit: fixed up some commenting issues.
Gary Rookard [Wed, 18 Dec 2013 17:12:35 +0000 (12:12 -0500)]
Staging: bcm: DDRInit: fixed up some commenting issues.

I have deleated some unintelligible comments, and made a
few minor white space corrections.

Signed-off-by: Gary Alan Rookard
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Fix trailing whitespace in dgap_tty.c
Masanari Iida [Wed, 18 Dec 2013 16:20:26 +0000 (01:20 +0900)]
staging: dgap: Fix trailing whitespace in dgap_tty.c

This patch fixed "ERROR:trailing whitespace
found by checkpatch.pl within dgap_tty.c

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: Fix trailing whitespace in downld.c
Masanari Iida [Wed, 18 Dec 2013 16:19:39 +0000 (01:19 +0900)]
staging: dgap: Fix trailing whitespace in downld.c

This patch fix "ERROR: trailing whitespace found by
checkpatch.pl, whithin downld.c

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agovme_user: Use __u64 and __u32 in userspace structs
Aaron Sierra [Wed, 18 Dec 2013 16:11:18 +0000 (10:11 -0600)]
vme_user: Use __u64 and __u32 in userspace structs

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agovme_user: Enable compat_ioctl for mixed environment
Aaron Sierra [Wed, 18 Dec 2013 16:11:09 +0000 (10:11 -0600)]
vme_user: Enable compat_ioctl for mixed environment

Now that the VME userspace API structures compile to a consistent size
in mixed environments (32-bit userspace and 64-bit kernel), enable the
.compat_ioctl to allow ioctls to execute in this environment.

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: bcm: DDRInit: fixed issues w/ commenting.
Gary Rookard [Tue, 17 Dec 2013 22:08:52 +0000 (17:08 -0500)]
Staging: bcm: DDRInit: fixed issues w/ commenting.

removed C99 comments to follow the linux kernel coding style
thus fixing checkpatch errors respectfully.

Signed-off-by: Gary Alan Rookard <garyrookard@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ion: Avoid using rt_mutexes directly
John Stultz [Wed, 18 Dec 2013 01:04:29 +0000 (17:04 -0800)]
staging: ion: Avoid using rt_mutexes directly

RT_MUTEXES can be configured out of the kernel, causing compile
problems with ION.

To quote Colin:
"rt_mutexes were added with the deferred freeing feature.  Heaps need
to return zeroed memory to userspace, but zeroing the memory on every
allocation was causing performance issues.  We added a SCHED_IDLE
thread to zero memory in the background after freeing, but locking the
heap from the SCHED_IDLE thread might block a high priority allocation
thread for a long time.

The lock is only used to protect the heap's free_list and
free_list_size members, and is not held for any long or sleeping
operations.  Converting to a spinlock should prevent priority
inversion without using the rt_mutex.  I'd also rename it to free_lock
to so it doesn't get used as a general heap lock."

Thus this patch converts the rt_mutex usage to a spinlock and
renames the lock free_lock to be more clear as to its use.

I also had to change a bit of logic in ion_heap_freelist_drain()
to safely avoid list corruption.

Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agortl8188eu: remove unused code
Matthias Wirth [Mon, 16 Dec 2013 17:51:50 +0000 (18:51 +0100)]
rtl8188eu: remove unused code

These two macros needed reformatting but as they are not used anywhere we
just removed them.

Signed-off-by: Matthias Wirth <matthias.wirth@gmail.com>
Signed-off-by: Lukas Senger <lukas@fridolin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agortl8188eu: fix coding style
Matthias Wirth [Mon, 16 Dec 2013 17:51:49 +0000 (18:51 +0100)]
rtl8188eu: fix coding style

Signed-off-by: Matthias Wirth <matthias.wirth@gmail.com>
Signed-off-by: Lukas Senger <lukas@fridolin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agortl8188eu: fix whitespace and indentation
Matthias Wirth [Mon, 16 Dec 2013 17:51:48 +0000 (18:51 +0100)]
rtl8188eu: fix whitespace and indentation

Signed-off-by: Matthias Wirth <matthias.wirth@gmail.com>
Signed-off-by: Lukas Senger <lukas@fridolin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: xillybus: Return -EIO if *_iomap fails, instead of 0
Eli Billauer [Tue, 17 Dec 2013 19:36:29 +0000 (21:36 +0200)]
staging: xillybus: Return -EIO if *_iomap fails, instead of 0

This patch replicates the correction made by Wei Yongjun on a second
occurrence of the same bug.

The first correction was in commit 8eec4555511bfa1f8a2e0a2de45c988fd30c3efb.

Bug fixed: The error code was not set, so the error condition wasn't reflected
in the return value.

Reported-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agousbip: Fix sscanf handling
Alan [Wed, 11 Dec 2013 18:32:59 +0000 (18:32 +0000)]
usbip: Fix sscanf handling

Scan only to the length permitted by the buffer

One of a set of sscanf problems noted by Jackie Chang

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agovme_user: Update API to work in mixed environments
Aaron Sierra [Mon, 9 Dec 2013 16:05:40 +0000 (10:05 -0600)]
vme_user: Update API to work in mixed environments

This patch updates the vme_master and vme_slave structures to use
types with well defined size and to prevent the compiler from
inserting padding (between enable and vme_addr for one).

The original vme_master and vme_slave structs would be different
sizes and have different layouts depending on whether they were built
for a 32-bit or 64-bit system.

On x86 it is possible to have a 32-bit userspace and a 64-bit kernel.
In this type of environment, the userspace and kernel vme_user APIs
would disagree and prevent ioctls from executing (based on ioctl
signatures from _IOR and _IOW).

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Acked-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agovme: Convert VME core to register as a subsystem
Aaron Sierra [Mon, 9 Dec 2013 15:54:42 +0000 (09:54 -0600)]
vme: Convert VME core to register as a subsystem

Previously, VME bridge support was treated as any other driver (using
module_init() macro), but if VME bridge and vme_user (staging) drivers
were compiled into the kernel, then vme_user would attempt to register
itself before the VME core support had been loaded. This would result
in a kernel panic.

The load order of these built-in drivers is based on the order in which
drivers/staging/vme and driver/vme are compiled.

This patch changes the VME core driver to use the subsys_initcall()
macro which ensures that it is loaded before all other VME drivers
regardless of the order in which they are compiled.

Tested-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: fix result of memdup_user for user chanlist
Bernd Porr [Wed, 11 Dec 2013 16:06:15 +0000 (16:06 +0000)]
staging: comedi: fix result of memdup_user for user chanlist

If the channel list is not set in userspace we get an error at
PTR_ERR(async->cmd.chanlist). However, do_become_nonbusy(dev, s) cleans
up this pointer which causes a kernel ooops. Setting the channel list in
async to NULL and checking this in do_become_nonbusy prevents the oops.

[Ian Abbott] Also do the same for the chanlist allocated in
do_cmdtest_ioctl().

Signed-off-by: Bernd Porr <mail@berndporr.me.uk>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: keucr: Fix typo in keucr driver
Masanari Iida [Thu, 12 Dec 2013 13:22:59 +0000 (22:22 +0900)]
staging: keucr: Fix typo in keucr driver

Correct spelling typo in comment and printk.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: clean up CARDbSetMediaChannel.
Malcolm Priestley [Thu, 12 Dec 2013 23:33:08 +0000 (23:33 +0000)]
staging: vt6656: clean up CARDbSetMediaChannel.

White space and commented out code.

Camel case clean up.
pDevice -> priv
uConnectionChannel -> connection_channel

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/comedi: bug fix for module usage count on device removal
Ian Abbott [Wed, 11 Dec 2013 14:51:03 +0000 (14:51 +0000)]
staging/comedi: bug fix for module usage count on device removal

When a dynamically created comedi device is being automatically removed
by a call to `comedi_auto_unconfig()` from the lower level driver,
`comedi_device_cleanup()` is called to perform the detachment from the
lower level driver.  If the comedi device is open at the time,
`dev->use_count` will be the the number of outstanding opens.  The
function currently decrements the the module counts of the "comedi"
module and the low-level driver module by this amount and reduces
`dev->use_count` to zero.  There are various problems with this as the
`release` file operation handler `comedi_close()` also decrements
`dev->use_count` and decrements the module usage counts.  This means
that `dev->use_count` and the module counts can end up negative.

Also, the assumed one-to-one relationship between the file open count
and the low-level module usage count is invalid and can get screwed up.
We only want to stop the low-level module being unloaded while a comedi
device using the module has an open file object.

Also, there is no need to manipulate the module count of the core
"comedi" module at all since the comedi module is the owner of the file
operations structure and the system will not unload the module while
there are open file objects using it.

Correct the bugs and simplify as follows:

1. Get rid of the module count manipulations of the core "comedi" module
(`THIS_MODULE`) altogether.

2. Don't alter `dev->use_count` in `comedi_device_cleanup()` as it
should only be altered by the `open` and `release` file operation
handlers `comedi_open()` and `comedi_close()`.

3. Increment the low-level module count for the following reasons:

  a) In `comedi_open()` if the open count was zero and the comedi device
     is attached to the low-level driver.
  b) When the `COMEDI_DEVCONFIG` ioctl is used to manually attach an
     unattached comedi device to a low-level driver.  The open count
     will be greater than zero at this time.  The actual increment of
     the low-level module count is already done by
     `comedi_device_attach()`.

4. Decrement the low-level module count for the following reasons:

  a) In `comedi_close()` if the open count was 1 and the comedi device
     is attached to the low-level driver.
  b) In `comedi_device_cleanup()` (called via `comedi_auto_unconfig()`
     --> `comedi_release_hardware_device()` -->
     `comedi_free_board_dev()` when the comedi device is automatically
     unconfigured due to action by the low-level driver) if the device
     was attached (which it should be) and open count was non-zero
     (greater than zero).
  c) When the `COMEDI_DEVCONFIG` ioctl is used to manually detach the
     comedi device from the low-level driver.  The open count will be
     greater than zero at this time.

The open count should never go negative.  Parts 3 and 4 ensure that the
low-level module usage count is incremented on entering the state where
the comedi device is attached to the low-level driver AND the open count
is greater than zero, and is decremented on leaving that state.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/comedi: keep reference to class device after destroyed
Ian Abbott [Wed, 11 Dec 2013 14:51:02 +0000 (14:51 +0000)]
staging/comedi: keep reference to class device after destroyed

When a dynamically allocated `struct comedi_device` gets automatically
unconfigured by a call to `comedi_auto_unconfig()` from a lower-level
driver's bus removal function (e.g. when a USB device is disconnected),
the class device in `dev->class_dev` (where `dev` points to the `struct
comedi_device`) is destroyed by a call to `device_destroy()` that
matches a previous call to `device_create()`.

However, if the `struct comedi_device` is still associated with an open
file object, the now invalid `dev->class_dev` pointer may still be
passed to `dev_printk()` (via `dev_dbg()` etc.), producing bogus output
or worse.

To fix this, call `get_device()` on the class device if
`device_create()` was successful.  Add a matching call to `put_device()`
in `comedi_dev_kref_release()` when the `struct comedi_device` is freed.
The calls to `dev_dbg()` etc. after the call to `device_destroy()` will
still produce valid output, although the device will have been
unregistered in sysfs.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: TIDSPBRIDGE: Remove UUID helper
Ivaylo Dimitrov [Tue, 10 Dec 2013 22:03:12 +0000 (00:03 +0200)]
Staging: TIDSPBRIDGE: Remove UUID helper

Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't
need to be exported. It can also be made way simpler by using sscanf.

Signed-off-by: Ivaylo Dimitrov <freemangordon@abv.bg>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: Remove unused scStatistic data/functions from driver.
Malcolm Priestley [Wed, 11 Dec 2013 21:23:31 +0000 (21:23 +0000)]
staging: vt6656: Remove unused scStatistic data/functions from driver.

None of these stats reach user. So delete them from driver

mib.c and mib.h becomes dead code as result of this patch.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: dead code remove mib.c mic.h from driver.
Malcolm Priestley [Wed, 11 Dec 2013 21:25:38 +0000 (21:25 +0000)]
staging: vt6656: dead code remove mib.c mic.h from driver.

As result of patch
staging: vt6656: Remove unused scStatistic data from driver.

mib.c mic.h is dead code

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: delete non-required instances of include <linux/init.h>
Paul Gortmaker [Tue, 10 Dec 2013 20:23:48 +0000 (15:23 -0500)]
staging: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>.  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: TIDSPBRIDGE: Fix mmap to map the correct region of physical memory
Steven Luo [Wed, 11 Dec 2013 20:51:56 +0000 (22:51 +0200)]
Staging: TIDSPBRIDGE: Fix mmap to map the correct region of physical memory

Commit 559c71fe5dc3 ("Staging: TIDSPBRIDGE: Use vm_iomap_memory for
mmap-ing instead of remap_pfn_range") had the effect of inadvertently
shifting the start of the physical memory area mapped by
pdata->phys_mempool_base.  Correct this by subtracting that shift before
calling vm_iomap_memory() and adding it back afterwards.

Reported-by: Dheeraj CVR <cvr.dheeraj@gmail.com>
Signed-off-by: Ivaylo Dimitrov <freemangordon@abv.bg>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: et131x: improve code consistency: access struct tx_ring
ZHAO Gang [Sun, 8 Dec 2013 03:01:07 +0000 (11:01 +0800)]
staging: et131x: improve code consistency: access struct tx_ring

Let all the code use a pointer called tx_ring to access struct tx_ring
members.

Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: et131x: improve code consistency: access struct rx_ring
ZHAO Gang [Sun, 8 Dec 2013 03:01:06 +0000 (11:01 +0800)]
staging: et131x: improve code consistency: access struct rx_ring

Let all the code use a pointer called rx_ring to access struct rx_ring
members.

Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: s626: tidy up comedi_lrange table
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:28 +0000 (17:31 -0700)]
staging: comedi: s626: tidy up comedi_lrange table

The comedi_lrange tables are fixed length based on the 'length' value
before the array of comedi_krange 'range' values. For aesthetics, remove
the trailing comma from last 'range' 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: adl_pci9111: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:27 +0000 (17:31 -0700)]
staging: comedi: adl_pci9111: tidy up comedi_lrange tables

Tidy up the format of the comedi_lrange table.

Signed-off-by: H Hartley Sweeten <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_pci1724: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:26 +0000 (17:31 -0700)]
staging: comedi: adv_pci1724: tidy up comedi_lrange tables

Tidy up the format of the comedi_lrange table.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbduxfast: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:25 +0000 (17:31 -0700)]
staging: comedi: usbduxfast: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <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: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:24 +0000 (17:31 -0700)]
staging: comedi: ni_at_a2150: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Use the BIP_RANGE macro instead of the more generic RANGE macro to
reduce the potential for typos.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: comedi_test: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:23 +0000 (17:31 -0700)]
staging: comedi: comedi_test: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: dyna_pci10xx: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:22 +0000 (17:31 -0700)]
staging: comedi: dyna_pci10xx: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: me4000: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:21 +0000 (17:31 -0700)]
staging: comedi: me4000: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: icp_multi: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:20 +0000 (17:31 -0700)]
staging: comedi: icp_multi: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: aio_aio12_8: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:19 +0000 (17:31 -0700)]
staging: comedi: aio_aio12_8: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <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: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:18 +0000 (17:31 -0700)]
staging: comedi: pcl816: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <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 comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:17 +0000 (17:31 -0700)]
staging: comedi: fl512: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <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: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:16 +0000 (17:31 -0700)]
staging: comedi: das16m1: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adq12b: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:15 +0000 (17:31 -0700)]
staging: comedi: adq12b: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

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