openwrt/staging/blogic.git
10 years agostaging: comedi: ni_mio_common: use CMDF_WAKE_EOS
Ian Abbott [Wed, 3 Sep 2014 12:45:39 +0000 (13:45 +0100)]
staging: comedi: ni_mio_common: use CMDF_WAKE_EOS

Replace use of `TRIG_WAKE_EOS` command flag with the new name
`CMDF_WAKE_EOS`.  The numeric value is the same.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_labpc_common: use CMDF_WAKE_EOS
Ian Abbott [Wed, 3 Sep 2014 12:45:38 +0000 (13:45 +0100)]
staging: comedi: ni_labpc_common: use CMDF_WAKE_EOS

Replace use of `TRIG_WAKE_EOS` command flag with the new name
`CMDF_WAKE_EOS`.  The numeric value is the same.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: das1800: use CMDF_WAKE_EOS
Ian Abbott [Wed, 3 Sep 2014 12:45:37 +0000 (13:45 +0100)]
staging: comedi: das1800: use CMDF_WAKE_EOS

Replace use of `TRIG_WAKE_EOS` command flag with the new name
`CMDF_WAKE_EOS`.  The numeric value is unchanged.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: cb_pcidas64: use CMDF_WAKE_EOS
Ian Abbott [Wed, 3 Sep 2014 12:45:36 +0000 (13:45 +0100)]
staging: comedi: cb_pcidas64: use CMDF_WAKE_EOS

Replace use of `TRIG_WAKE_EOS` command flag with the new name
`CMDF_WAKE_EOS`.  The numeric value is unchanged.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: cb_pcidas: use CMDF_WAKE_EOS
Ian Abbott [Wed, 3 Sep 2014 12:45:35 +0000 (13:45 +0100)]
staging: comedi: cb_pcidas: use CMDF_WAKE_EOS

Replace use of `TRIG_WAKE_EOS` command flag with the new name
`CMDF_WAKE_EOS`.  The numeric value is unchanged.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: use CMDF_WAKE_EOS
Ian Abbott [Wed, 3 Sep 2014 12:45:34 +0000 (13:45 +0100)]
staging: comedi: amplc_pci230: use CMDF_WAKE_EOS

Replace use of `TRIG_WAKE_EOS` command flag with the new name
`CMDF_WAKE_EOS`.  The numeric value is unchanged.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adv_pci1710: use CMDF_WAKE_EOS
Ian Abbott [Wed, 3 Sep 2014 12:45:33 +0000 (13:45 +0100)]
staging: comedi: adv_pci1710: use CMDF_WAKE_EOS

Replace use of `TRIG_WAKE_EOS` command flag with the new name
`CMDF_WAKE_EOS`.  The numeric value is unchanged.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adl_pci9118: use CMDF_WAKE_EOS
Ian Abbott [Wed, 3 Sep 2014 12:45:32 +0000 (13:45 +0100)]
staging: comedi: adl_pci9118: use CMDF_WAKE_EOS

Replace use of `TRIG_WAKE_EOS` command flag with the new name
`CMDF_WAKE_EOS`.  The numeric value is unchanged.  Also change
diagnostic messages to use "CMDF_WAKE_EOS" instead of "TRIG_WAKE_EOS"
and change the Comedi driver description comment to use "CMDF_WAKE_EOS".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_3120: use CMDF_WAKE_EOS
Ian Abbott [Wed, 3 Sep 2014 12:45:31 +0000 (13:45 +0100)]
staging: comedi: addi_apci_3120: use CMDF_WAKE_EOS

Replace use of `TRIG_WAKE_EOS` command flag with the new name
`CMDF_WAKE_EOS`.  The numeric value is unchanged.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: use CMDF_WAKE_EOS in do_cmd_ioctl()
Ian Abbott [Wed, 3 Sep 2014 12:45:30 +0000 (13:45 +0100)]
staging: comedi: use CMDF_WAKE_EOS in do_cmd_ioctl()

`TRIG_WAKE_EOS` is now just a synonym for `CMDF_WAKE_EOS`.  Change
`do_cmd_ioctl()` to use the new name.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: add CMDF_WAKE_EOS as synonym for TRIG_WAKE_EOS
Ian Abbott [Wed, 3 Sep 2014 12:45:29 +0000 (13:45 +0100)]
staging: comedi: add CMDF_WAKE_EOS as synonym for TRIG_WAKE_EOS

`TRIG_WAKE_EOS` is one of the values that can be OR-ed into the `flags`
member of `struct comedi_cmd`.  It's intended action is tune the
asynchronous command to interrupt at the end of every "scan".  The name
is a bit of a left-over from earlier times.  A better name would be
`CMDF_WAKE_EOS` to match various other command flags.

Define `CMDF_WAKE_EOS` with the same numeric value as the old
`TRIG_WAKE_EOS` and redefine `TRIG_WAKE_EOS` as a synonym of it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_labpc_common: use CMDF_PRIORITY
Ian Abbott [Wed, 3 Sep 2014 12:45:28 +0000 (13:45 +0100)]
staging: comedi: ni_labpc_common: use CMDF_PRIORITY

Replace use of `TRIG_RT` command flag with the equivalent flag
`CMDF_PRIORITY`.  The numeric value is unchanged.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_at_a2150: use CMDF_PRIORITY
Ian Abbott [Wed, 3 Sep 2014 12:45:27 +0000 (13:45 +0100)]
staging: comedi: ni_at_a2150: use CMDF_PRIORITY

Replace use of `TRIG_RT` command flag with the equivalent flag
`CMDF_PRIORITY`.  The numeric value is unchanged.  Also replace
"TRIG_RT" with "CMDF_PRIORITY" in the kernel messages.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: das1800: use CMDF_PRIORITY
Ian Abbott [Wed, 3 Sep 2014 12:45:26 +0000 (13:45 +0100)]
staging: comedi: das1800: use CMDF_PRIORITY

Replace use of `TRIG_RT` command flag with the equivalent flag
`CMDF_PRIORITY`.  The numeric value is unchanged.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: das16: use CMDF_PRIORITY
Ian Abbott [Wed, 3 Sep 2014 12:45:25 +0000 (13:45 +0100)]
staging: comedi: das16: use CMDF_PRIORITY

Replace use of `TRIG_RT` command flag with the equivalent flag
`CMDF_PRIORITY`.  The numeric value is unchanged.  Also replace
"TRIG_RT" with "CMDF_PRIORITY" in kernel log messages.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: comedi_test: use CMDF_PRIORITY
Ian Abbott [Wed, 3 Sep 2014 12:45:24 +0000 (13:45 +0100)]
staging: comedi: comedi_test: use CMDF_PRIORITY

Replace use of `TRIG_RT` command flag with the equivalent flag
`CMDF_PRIORITY`.  The numeric value is unchanged.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: emxx_udc: remove check for CONFIG_MACH_EMGR
Paul Bolle [Thu, 4 Sep 2014 10:44:53 +0000 (12:44 +0200)]
staging: emxx_udc: remove check for CONFIG_MACH_EMGR

There's a check for CONFIG_MACH_EMGR. But the Kconfig symbol MACH_EMGR
doesn't exist. Remove that check and the single #define it hides. Note
that this macro isn't used by this driver anyway.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8821ae: base: add missing blank line after declaration
An Ha [Wed, 3 Sep 2014 22:33:08 +0000 (18:33 -0400)]
Staging: rtl8821ae: base: add missing blank line after declaration

Add a missing blank line after declaration to fix coding style issue.

Signed-off-by: An Ha <zero579911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: et131x: Fix whitespace - alignment matching open parenthesis
Mark Einon [Wed, 3 Sep 2014 21:40:57 +0000 (22:40 +0100)]
staging: et131x: Fix whitespace - alignment matching open parenthesis

Fix occurrences in et131x.c of:

CHECK: Alignment should match open parenthesis

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: et131x: Add auto-negotiation and 1000BT_Half as supported protocols
Mark Einon [Wed, 3 Sep 2014 21:40:56 +0000 (22:40 +0100)]
staging: et131x: Add auto-negotiation and 1000BT_Half as supported protocols

The driver supports auto-negotiation and 100BaetT_Half but doesn't
advertise or list it in it's phydev. Fix that.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: et131x: Remove spinlock fbr_lock
Mark Einon [Wed, 3 Sep 2014 21:40:55 +0000 (22:40 +0100)]
staging: et131x: Remove spinlock fbr_lock

The spinlock fbr_lock is only used in a single call sequence staring
from et131x_poll. As this call is already locked by napi->poll_lock,
we can remove it.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: et131x: Remove dead code in isr
Mark Einon [Wed, 3 Sep 2014 21:40:54 +0000 (22:40 +0100)]
staging: et131x: Remove dead code in isr

Dan Carpenter reports:
The patch c2ebf58ba089: "staging: et131x: Implement NAPI support"
from Aug 21, 2014, leads to the following static checker warning:

        drivers/staging/et131x/et131x.c:4004 et131x_isr()
        warn: we tested 'status' before and it was 'true'

We don't actually need the dead code, as we're now using NAPI to
handle enabling interrupts - but we do need to enable interrupts if
NAPI is not scheduled - so enable interrupts if this is the case.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8821ae: hal_bt_coexist: add a blank newline
An Ha [Wed, 3 Sep 2014 01:00:46 +0000 (21:00 -0400)]
Staging: rtl8821ae: hal_bt_coexist: add a blank newline

Fix coding style issue which requires a blank line after declarations.

Signed-off-by: An Ha <zero579911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8821ae: hal_bt_coexist: fix curly brace placement
An Ha [Wed, 3 Sep 2014 01:00:45 +0000 (21:00 -0400)]
Staging: rtl8821ae: hal_bt_coexist: fix curly brace placement

Fix coding style issue where the if statement unnecessarily uses curly
braces for one line statements and where the else conditional statement
should follow the closing curly brace '}'. Also, the open curly brace
'{' should be on the same line as the if statement.

Signed-off-by: An Ha <zero579911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8821ae: hal_bt_coexist: fix pointer placement coding style issue
An Ha [Wed, 3 Sep 2014 01:00:44 +0000 (21:00 -0400)]
Staging: rtl8821ae: hal_bt_coexist: fix pointer placement coding style issue

Fix pointer placement coding style issue, where using "foo *" is
preferable over "foo*".

Signed-off-by: An Ha <zero579911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8821ae: hal_bt_coexist: add/remove spaces
An Ha [Wed, 3 Sep 2014 01:00:43 +0000 (21:00 -0400)]
Staging: rtl8821ae: hal_bt_coexist: add/remove spaces

Fix coding style issue which requires a space before the open
curly brace '{', after the open parenthesis '(', after a comma, and
after the equal sign '=' in an assignment.

Also, remove unnecessary whitespace after open parenthesis '(' and
before a quoted newline.

Signed-off-by: An Ha <zero579911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8821ae: hal_bt_coexist: fix commenting style
An Ha [Wed, 3 Sep 2014 01:00:42 +0000 (21:00 -0400)]
Staging: rtl8821ae: hal_bt_coexist: fix commenting style

Fix commenting style from C99 comments to C89 comments

Signed-off-by: An Ha <zero579911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8723au: Remove write-only variables hal_data_8723a.EEPROM[VP]ID
Jes Sorensen [Wed, 3 Sep 2014 12:15:16 +0000 (14:15 +0200)]
staging: rtl8723au: Remove write-only variables hal_data_8723a.EEPROM[VP]ID

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: rtl8192u: Fix "space prohibited after that open parenthesis '(...
Greg Donald [Tue, 2 Sep 2014 23:30:30 +0000 (18:30 -0500)]
drivers: staging: rtl8192u: Fix "space prohibited after that open parenthesis '('" errors

Fix checkpatch.pl "space prohibited after that open parenthesis '('" errors

Signed-off-by: Greg Donald <gdonald@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: skel: remove driver
H Hartley Sweeten [Tue, 2 Sep 2014 17:01:50 +0000 (10:01 -0700)]
staging: comedi: skel: remove driver

The comedi skeleton driver is one of the few "hybrid" drivers with
both legacy and PCI attach mechanisms. Instead of splitting this
driver, just remove it. There are many other comedi drivers that
provide better examples.

Signed-off-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: range check board index
Ian Abbott [Mon, 1 Sep 2014 13:13:30 +0000 (14:13 +0100)]
staging: comedi: ni_at_a2150: range check board index

The "ni_at_a2150" driver determines the board type by calling
`a2150_probe()`.  This reads a register and converts it to a board index
in the range 0 to 3.  However, the board table array it indexes into
(`a2150_boards[]`) only has 2 entries.  Return an error from the
Comedi driver "attach" handler `a2150_attach()` if the probed board
index is beyond the end of the array.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: binder: fix coding style issues
Dmitry Voytik [Mon, 8 Sep 2014 14:16:34 +0000 (18:16 +0400)]
staging: binder: fix coding style issues

Fix coding style issues:
* put braces in all if-else branches;
* limit the length of changed lines to 80 columns.
checkpatch.pl warning count reduces by 3.

Signed-off-by: Dmitry Voytik <voytikd@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: android: Break up a long line in binder_send_failed_reply
William Panlener [Thu, 4 Sep 2014 03:44:03 +0000 (22:44 -0500)]
staging: android: Break up a long line in binder_send_failed_reply

Kernel coding style. Breaking long lines and strings.

Signed-off-by: William Panlener <wpanlener@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ozwpan: use kmalloc_array over kmalloc with multiply
Adrian Nicoara [Mon, 8 Sep 2014 19:02:49 +0000 (15:02 -0400)]
staging: ozwpan: use kmalloc_array over kmalloc with multiply

Cleanup checkpatch.pl warnings.

Signed-off-by: Adrian Nicoara <anicoara@uwaterloo.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ozwpan: fix redundant return in void function
Adrian Nicoara [Mon, 8 Sep 2014 18:43:44 +0000 (14:43 -0400)]
staging: ozwpan: fix redundant return in void function

Cleanup checkpatch.pl warnings.

Signed-off-by: Adrian Nicoara <anicoara@uwaterloo.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ozwpan: fix redundant else after break or return
Adrian Nicoara [Mon, 8 Sep 2014 18:41:48 +0000 (14:41 -0400)]
staging: ozwpan: fix redundant else after break or return

Cleanup checkpatch.pl warnings.

Signed-off-by: Adrian Nicoara <anicoara@uwaterloo.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ozwpan: fix missing blank line after declaration
Adrian Nicoara [Mon, 8 Sep 2014 18:39:58 +0000 (14:39 -0400)]
staging: ozwpan: fix missing blank line after declaration

Cleanup checkpatch.pl warnings.

Signed-off-by: Adrian Nicoara <anicoara@uwaterloo.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: uislib: uislib.c: sparse warning of context imbalance
Sudip Mukherjee [Fri, 5 Sep 2014 09:22:46 +0000 (14:52 +0530)]
staging: unisys: uislib: uislib.c: sparse warning of context imbalance

fixed sparse warning : context imbalance in 'pause_device'
unexpected unlock
this patch will generate warning from checkpatch for
lines over 80 character , but since those are user-visible strings
so it was not modified.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Tested-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: unisys: uislib: uisqueue.c: rewrite of do_locked_client_insert
Sudip Mukherjee [Wed, 3 Sep 2014 09:29:21 +0000 (14:59 +0530)]
staging: unisys: uislib: uisqueue.c: rewrite of do_locked_client_insert

1) removed unused variables
2) fixed sparse warning of context imbalance in 'do_locked_client_insert'
                         different lock contexts for basic block
3) removed the call to visor_signalqueue_empty() , this function is
   checking whether a signal queue is empty, but the return value
   of the function is not beeing used, so it is safe to remove.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: ptlrpc: expand the GOTO macro
Julia Lawall [Sun, 7 Sep 2014 16:18:29 +0000 (18:18 +0200)]
staging: lustre: ptlrpc: expand the GOTO macro

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier lbl;
identifier rc;
constant c;
@@

- GOTO(lbl,\(rc\|c\));
+ goto lbl;

@@
identifier lbl;
expression rc;
@@

- GOTO(lbl,rc);
+ rc;
+ goto lbl;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: obdclass: expand the GOTO macro
Julia Lawall [Sun, 7 Sep 2014 16:18:35 +0000 (18:18 +0200)]
staging: lustre: obdclass: expand the GOTO macro

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier lbl;
identifier rc;
constant c;
@@

- GOTO(lbl,\(rc\|c\));
+ goto lbl;

@@
identifier lbl;
expression rc;
@@

- GOTO(lbl,rc);
+ rc;
+ goto lbl;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: obdclass: expand the GOTO macro + break
Julia Lawall [Sun, 7 Sep 2014 16:18:34 +0000 (18:18 +0200)]
staging: lustre: obdclass: expand the GOTO macro + break

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier lbl,rc,f;
constant c;
@@

- GOTO(lbl,\(rc\|rc->f\|c\));
- break;
+ goto lbl;

@@
identifier lbl;
expression rc;
@@

- GOTO(lbl,rc);
- break;
+ rc;
+ goto lbl;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: obdclass: expand double GOTO macros
Julia Lawall [Sun, 7 Sep 2014 16:18:33 +0000 (18:18 +0200)]
staging: lustre: obdclass: expand double GOTO macros

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier lbl;
@@

if (...)
  GOTO(lbl,...);
+else
GOTO(lbl,...);

@@
identifier lbl;
expression e,e1,e2;
@@

if (e)
-  GOTO(lbl,e1);
-else GOTO(lbl,e2);
+  e1;
+else e2;
+goto lbl;

@@
identifier lbl1,lbl2;
expression e,e1,e2;
@@

+ e1=e2;
if (e)
-  GOTO(lbl1,e1=e2);
-GOTO(lbl2,e1=e2);
+  goto lbl1;
+goto lbl2;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: lvfs: expand the GOTO macro
Julia Lawall [Sun, 7 Sep 2014 16:18:32 +0000 (18:18 +0200)]
staging: lustre: lvfs: expand the GOTO macro

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier lbl;
identifier rc;
constant c;
@@

- GOTO(lbl,\(rc\|c\));
+ goto lbl;

@@
identifier lbl;
expression rc;
@@

- GOTO(lbl,rc);
+ rc;
+ goto lbl;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: libcfs: expand the GOTO macro
Julia Lawall [Sun, 7 Sep 2014 16:18:30 +0000 (18:18 +0200)]
staging: lustre: libcfs: expand the GOTO macro

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier lbl;
identifier rc;
constant c;
@@

- GOTO(lbl,\(rc\|c\));
+ goto lbl;

@@
identifier lbl;
expression rc;
@@

- GOTO(lbl,rc);
+ rc;
+ goto lbl;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: annotate lock/unlock in lov_stripe_lock / lov_stripe_unlock
Mostyn Bramley-Moore [Sun, 7 Sep 2014 09:46:40 +0000 (11:46 +0200)]
staging/lustre: annotate lock/unlock in lov_stripe_lock / lov_stripe_unlock

Annotate the lock/unlock pair in lov_stripe_lock/lov_stripe_unlock to
avoid sparse warning about a context imbalance.
Part of the eudyptula challenge: http://eudyptula-challenge.org/

Signed-off-by: Mostyn Bramley-Moore <mbmcode@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/obdclass: remove local_storage.[ch]
John L. Hammond [Fri, 5 Sep 2014 20:08:18 +0000 (15:08 -0500)]
staging/lustre/obdclass: remove local_storage.[ch]

Remove the unused files lustre/obdclass/local_storage.[ch].

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/obdclass: remove llog_ioctl.c
John L. Hammond [Fri, 5 Sep 2014 20:08:17 +0000 (15:08 -0500)]
staging/lustre/obdclass: remove llog_ioctl.c

Remove the unused function llog_ioctl() and the file
lustre/obdclass/llog_ioctl.c.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/ptlrpc: remove sptlrpc_conf_target_get_rules()
John L. Hammond [Fri, 5 Sep 2014 20:08:16 +0000 (15:08 -0500)]
staging/lustre/ptlrpc: remove sptlrpc_conf_target_get_rules()

Remove the unused function sptlrpc_conf_target_get_rules() and its
supporting functions.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/mgc: remove server specific llog handling
John L. Hammond [Fri, 5 Sep 2014 20:08:15 +0000 (15:08 -0500)]
staging/lustre/mgc: remove server specific llog handling

In mgc_process_cfg_log() remove code to handle
LLOG_CONFIG_ORIG_CTXT. This context is not setup on clients.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: remove unused OBD methods
John L. Hammond [Fri, 5 Sep 2014 20:08:14 +0000 (15:08 -0500)]
staging/lustre: remove unused OBD methods

Remove the unused OBD device methods:
    obd_brw()
    obd_cancel()
    obd_cancel_unused()
    obd_change_cbdata()
    obd_create_async()
    obd_enqueue()
    obd_enqueue_rqset()
    obd_extent_calc()
    obd_llog_connect()
    obd_llog_finish()
    obd_llog_init()
    obd_merge_lvb()
    obd_pin()
    obd_pin_observer()
    obd_ping()
    obd_precreate()
    obd_punch()
    obd_punch_rqset()
    obd_sync()
    obd_sync_rqset()
    obd_unpin()
    obd_unpin_observer()

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/mgc: inline mgc_cancel()
John L. Hammond [Fri, 5 Sep 2014 20:08:13 +0000 (15:08 -0500)]
staging/lustre/mgc: inline mgc_cancel()

The function mgc_cancel() is never invoked as an OBD device method and
is only called directly from mgc_process_log() so remove it.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/mdc: inline llog methods
John L. Hammond [Fri, 5 Sep 2014 20:08:12 +0000 (15:08 -0500)]
staging/lustre/mdc: inline llog methods

In mdc_setup() and mdc_precleanup() call mdc_llog_init() and
mdc_llog_finish() directly rather than through the OBD method wrappers
obd_llog_init() and obd_llod_finish(). Simplify the prototypes of
mdc_llog_init() and mdc_llog_finish() according to their uses.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/mdc: remove unused OBD methods
John L. Hammond [Fri, 5 Sep 2014 20:08:11 +0000 (15:08 -0500)]
staging/lustre/mdc: remove unused OBD methods

Remove the unused OBD device methods mdc_pin() and mdc_unpin().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: remove obd_ost.h
John L. Hammond [Fri, 5 Sep 2014 20:08:10 +0000 (15:08 -0500)]
staging/lustre: remove obd_ost.h

Move the structures defined in lustre/include/obd_ost.h to the one
file that uses them (lustre/osc/osc_request.c). Remove the unused
function osc_update_enqueue(). Remove the then empty header
lustre/include/obd_ost.h.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/osc: remove obsolete llog handling code
John L. Hammond [Fri, 5 Sep 2014 20:08:09 +0000 (15:08 -0500)]
staging/lustre/osc: remove obsolete llog handling code

In osc_request.c there is no reason to handle any llog contexts since
they are never setup. Remove the functions unused function
osc_llog_init() and the obsolete function osc_llog_finish(). Remove
the llog cleanup code in osc_disconnect() and osc_precleanup().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/osc: remove unused OBD methods
John L. Hammond [Fri, 5 Sep 2014 20:08:08 +0000 (15:08 -0500)]
staging/lustre/osc: remove unused OBD methods

Remove the unused OBD device methods:
    osc_brw()
    osc_cancel()
    osc_cancel_unused()
    osc_change_cbdata()
    osc_enqueue()
    osc_punch()
    osc_sync()
and their supporting functions.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre/lov: remove unused OBD methods
John L. Hammond [Fri, 5 Sep 2014 20:08:07 +0000 (15:08 -0500)]
staging/lustre/lov: remove unused OBD methods

Remove the unused OBD device methods:
    lov_brw()
    lov_cancel()
    lov_cancel_unused()
    lov_change_cbdata()
    lov_enqueue()
    lov_extent_calc()
    lov_getattr()
    lov_merge_lvb()
    lov_punch()
    lov_setattr()
    lov_sync()
and their supporting functions.

In lov_iocontrol() remove the unused cases LL_IOC_LOV_SETSTRIPE and
LL_IOC_LOV_SETEA and their supporting functions.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: Different prototypes between the declaration and the definition
Loïc Pellegrino [Thu, 4 Sep 2014 18:28:50 +0000 (19:28 +0100)]
staging/lustre: Different prototypes between the declaration and the definition

Align the prototype of lprocfs_wr_uint() in the declaration with the one used
in the definition.

The prototype is:
int lprocfs_wr_uint(struct file *file, const char __user *buffer,
                    unsigned long count, void *data)
In obdclass/lprocfs_status.c

But in lustre/include/lprocfs_status.h, the __user annotation is missing for
the attribute buffer.

The correct prototype is the first one (the definition) since:
- This function is eventually called by the write() function pointer of an
instance of struct file_operations
- In this function, buffer is a parameter of copy_from_user()
- Before the commit 73bb1da692d0dc3e93b9c9e29084d6a5dcbc37a6, the declaration
and the definition had the same prototype, but only the .c has been updated.

Correcting this will remove a sparse error and add sparse warnings.
This is a task of the Eudyptula challenge.

Signed-off-by: Loïc Pellegrino <oort10@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: Annotate user buffer with __user
LABBE Corentin [Thu, 4 Sep 2014 13:24:57 +0000 (15:24 +0200)]
staging: lustre: Annotate user buffer with __user

Fix the warning reported by sparse on drivers/staging/lustre/lnet/lnet/router_proc.c
warning: incorrect type in argument 4 (different address spaces)
The correction is to annotate all user buffer variable by __user

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: include missing header
Nicolas Thery [Sat, 6 Sep 2014 05:18:47 +0000 (07:18 +0200)]
staging: rtl8188eu: include missing header

This patch fixes the following sparse warnings:

drivers/staging/rtl8188eu/hal/phy.c:46:5: warning: symbol
'phy_query_bb_reg' was not declared. Should it be static?
drivers/staging/rtl8188eu/hal/phy.c:56:6: warning: symbol
'phy_set_bb_reg' was not declared. Should it be static?
drivers/staging/rtl8188eu/hal/phy.c:129:5: warning: symbol
'phy_query_rf_reg' was not declared. Should it be static?
drivers/staging/rtl8188eu/hal/phy.c:140:6: warning: symbol
'phy_set_rf_reg' was not declared. Should it be static?
drivers/staging/rtl8188eu/hal/phy.c:228:6: warning: symbol
'phy_set_tx_power_level' was not declared. Should it be static?
drivers/staging/rtl8188eu/hal/phy.c:324:6: warning: symbol
'phy_set_bw_mode' was not declared. Should it be static?
drivers/staging/rtl8188eu/hal/phy.c:360:6: warning: symbol 'phy_sw_chnl'
was not declared. Should it be static?

Signed-off-by: Nicolas Thery <nthery@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8821ae: Fix sparse warning by making functions static.
Andreas Schlick [Sat, 6 Sep 2014 08:13:09 +0000 (10:13 +0200)]
staging: rtl8821ae: Fix sparse warning by making functions static.

Signed-off-by: Andreas Schlick <ninox@posteo.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: goldfish: avoid multiple assignments
Loic Pefferkorn [Wed, 3 Sep 2014 20:23:15 +0000 (22:23 +0200)]
staging: goldfish: avoid multiple assignments

Coding style: avoid multiple assignments

Signed-off-by: Loic Pefferkorn <loic@loicp.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: goldfish: document mutex usage
Loic Pefferkorn [Wed, 3 Sep 2014 20:23:14 +0000 (22:23 +0200)]
staging: goldfish: document mutex usage

Coding style: document mutex usage

Signed-off-by: Loic Pefferkorn <loic@loicp.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: goldfish: fix alignment to match open parenthesis
Loic Pefferkorn [Wed, 3 Sep 2014 20:23:13 +0000 (22:23 +0200)]
staging: goldfish: fix alignment to match open parenthesis

Coding style: fix alignment to match open parenthesis

Signed-off-by: Loic Pefferkorn <loic@loicp.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: goldfish: document spinlock usage
Loic Pefferkorn [Wed, 3 Sep 2014 20:23:12 +0000 (22:23 +0200)]
staging: goldfish: document spinlock usage

Coding style: document spinlock usage

Signed-off-by: Loic Pefferkorn <loic@loicp.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: goldfish: remove useless space after a cast
Loic Pefferkorn [Wed, 3 Sep 2014 20:23:11 +0000 (22:23 +0200)]
staging: goldfish: remove useless space after a cast

Coding style: remove useless space after a cast

Signed-off-by: Loic Pefferkorn <loic@loicp.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: goldfish: suppress consecutive blank lines
Loic Pefferkorn [Wed, 3 Sep 2014 20:23:10 +0000 (22:23 +0200)]
staging: goldfish: suppress consecutive blank lines

Coding style: suppress consecutive blank lines

Signed-off-by: Loic Pefferkorn <loic@loicp.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: gs_fpgaboot: remove unnecessary return statements
Michał Bartoszkiewicz [Thu, 4 Sep 2014 20:05:36 +0000 (22:05 +0200)]
staging: gs_fpgaboot: remove unnecessary return statements

This fixes "void function return statements are not generally useful"
warnings from checkpatch.pl.

Signed-off-by: Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
Reviewed-by: Insop Song <insop.song@gainspeed.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: xgifb: remove unnecessary else
Thomas Gummerer [Fri, 5 Sep 2014 15:09:34 +0000 (17:09 +0200)]
staging: xgifb: remove unnecessary else

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/lustre: Fixed checkpatch warning: Use #include <linux/statfs.h> instead of...
Filipe Gonçalves [Fri, 5 Sep 2014 04:09:46 +0000 (05:09 +0100)]
staging/lustre: Fixed checkpatch warning: Use #include <linux/statfs.h> instead of <asm/statfs.h>

Signed-off-by: Filipe Gonçalves <filipe@codinghighway.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agodrivers: staging: dgap: fix the checkpatch.pl issue "Warning: line over 80 characters"
Piotr Witoslawski [Thu, 4 Sep 2014 06:18:53 +0000 (08:18 +0200)]
drivers: staging: dgap: fix the checkpatch.pl issue "Warning: line over 80 characters"

Break lines exceeding 80 characters

Signed-off-by: Piotr Witoslawski <pwitos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: lustre: lmv: lmv_internal.h: fix checkpatch.pl spacing errors
Juston Li [Thu, 4 Sep 2014 05:42:24 +0000 (22:42 -0700)]
staging: lustre: lmv: lmv_internal.h: fix checkpatch.pl spacing errors

lmv_internal.h:96: ERROR: space prohibited after that open parenthesis '('
lmv_internal.h:96: ERROR: space required before the open parenthesis '('
lmv_internal.h:147: WARNING: space prohibited between function name and open parenthesis '('

Signed-off-by: Juston Li <juston.h.li@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: rtl8192u: fix brace style coding issue in r819xU_firmware.c
Chaitra Ramaiah [Thu, 4 Sep 2014 15:11:03 +0000 (20:41 +0530)]
Staging: rtl8192u: fix brace style coding issue in r819xU_firmware.c

Signed-off-by: Chaitra Ramaiah <linux.delve@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: fix missing blank lines after declarations
Luca Ceresoli [Wed, 3 Sep 2014 06:28:21 +0000 (08:28 +0200)]
staging: rtl8188eu: fix missing blank lines after declarations

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Greg Kroah-Hartman <gregkh@linux.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: android: use braces on all arms of if
Grzegorz Swirski [Tue, 2 Sep 2014 19:24:04 +0000 (20:24 +0100)]
staging: android: use braces on all arms of if

Signed-off-by: Grzegorz Swirski <grzegorz@swirski.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: simplify interrupt enable handling
Ian Abbott [Mon, 1 Sep 2014 11:04:00 +0000 (12:04 +0100)]
staging: comedi: amplc_pci230: simplify interrupt enable handling

`struct pci230_private` has two members to manage the enabled interrupt
sources.  `int_en` is the interrupt sources we want to be enabled and
`ier` is a shadow of the write-only interrupt enable register.  They
have the same value most of the time.  They differ in the interrupt
handler (`pci230_interrupt()`) itself when it temporarily clears bits in
the interrupt enable register and the `ier` member in order to unlatch
them in hardware, but leaves the `int_en` member alone.  They also
differ in `pci230_ai_stop()` and `pci230_ao_stop()` which clear bits in
the `int_en` member and wait for the interrupt handler to finish before
copying the value to the `ier` member and the interrupt enable register.

Simplify the handling a bit, by making the `ier` member take on the role
of the `int_en` member, and allowing the value to differ from the
interrupt enable register while the interrupt handler is running.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: change pci230_handle_ao_fifo() return type
Ian Abbott [Mon, 1 Sep 2014 11:03:59 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: change pci230_handle_ao_fifo() return type

Change the return type of `pci230_handle_ao_fifo()` from `int` to
`bool`.  A return value of `true` indicates the AO command is still
running.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: reduce indentation in pci230_ai_start()
Ian Abbott [Mon, 1 Sep 2014 11:03:58 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: reduce indentation in pci230_ai_start()

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: reduce indentation in pci230_ai_inttrig_convert()
Ian Abbott [Mon, 1 Sep 2014 11:03:57 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: reduce indentation in pci230_ai_inttrig_convert()

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: reduce indentation in pci230_ao_start()
Ian Abbott [Mon, 1 Sep 2014 11:03:56 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: reduce indentation in pci230_ao_start()

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: reduce indentation in pci230_ao_inttrig_scan_begin()
Ian Abbott [Mon, 1 Sep 2014 11:03:55 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: reduce indentation in pci230_ao_inttrig_scan_begin()

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: rewrite shared resource handling
Ian Abbott [Mon, 1 Sep 2014 11:03:54 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: rewrite shared resource handling

Some counter channels may be required for AI commands and AO commands.
Depending on how the commands are set up, it may not be possible to run
both at the same time, so we keep some state and code to find out if the
required resources are busy or not.

The existing code is a bit unwieldy - the code for claiming resources
involves two `for` loops for example.  Rewrite it to make it simpler.

The new code just has a bit-mask value for each shared resource (counter
channels), and an array indexed by resource "owners" (AI and AO
commands), so the code for claiming resources now just has a single loop
that checks that none of the other owners have claimed the wanted
resources.

Rename the functions involved, because the old names involving 'put' and
'get' suggested some sort of usage counting.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: replace `state` member with bitfields
Ian Abbott [Mon, 1 Sep 2014 11:03:53 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: replace `state` member with bitfields

The `state` member of `struct pci230_private` is used with the atomic
bit-op functions and has a couple of bits defined, `AI_CMD_STARTED` and
`AO_CMD_STARTED`.  Spin-locks are used to protect the clearing of these
bits and other stuff.  No special protection is used for setting these
bits.  Replace the `state` member with a couple of new, single-bit
bitfield members, `ai_cmd_started` and `ao_cmd_started` to save some
space.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: make `intr_running` a bitfield
Ian Abbott [Mon, 1 Sep 2014 11:03:52 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: make `intr_running` a bitfield

Change the `intr_running` member of `struct pci230_private` into a
single-bit bitfield of type `bool` to save a bit of space.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: use comedi_range_is_bipolar()
Ian Abbott [Mon, 1 Sep 2014 11:03:51 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: use comedi_range_is_bipolar()

Use the inline `comedi_range_is_bipolar()` function from "comedidev.h"
to decide whether a range is bipolar or unipolar instead of using the
local static arrays `pci230_ai_bipolar[]` and `pci230_ao_bipolar[]`
which can then be removed.

Change the types of the `ai_bipolar` and `ao_bipolar` members of `struct
pci230_private` to `bool` to match the return value of
`comedi_range_is_bipolar()` and change them into single-bit bitfields to
save a bit of space.  Also change the type and name of some local
variables in `pci230_ai_check_chanlist()` that hold the result of
`comedi_range_is_bipolar()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: add `pci230_` prefix to functions
Ian Abbott [Mon, 1 Sep 2014 11:03:50 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: add `pci230_` prefix to functions

Most functions in "amplc_pci230" are named with the prefix `pci230_`,
apart from one or two that have the prefix `amplc_pci230_` and a few
odd-balls with no particular prefix.  Rename the ones without a prefix
for consistency.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: rename pci230_ai_rinsn()
Ian Abbott [Mon, 1 Sep 2014 11:03:49 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: rename pci230_ai_rinsn()

Rename the AI subdevice "insn_read" handler function `pci230_ai_rinsn()`
to `pci230_ai_insn_read()` for consistency.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: remove 'inline'
Ian Abbott [Mon, 1 Sep 2014 11:03:48 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: remove 'inline'

Some functions in "amplc_pci230.c" are declared `inline`.  Remove the
`inline` specifiers and let the compiler do what it wants with them.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: simplify pci230_ai_read()
Ian Abbott [Mon, 1 Sep 2014 11:03:47 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: simplify pci230_ai_read()

`pci230_ai_read()` reads a sample from the ADC data register and
converts it to a comedi sample value.  The AI sample may have 12 or 16
bits of resolution, depending on the board type, but 12-bit sample
values are in bits 15 to 4 of the register.  The hardware value is
signed, 2's complement if set to a bipolar mode, or unsigned, straight
binary if set to a unipolar mode.  To convert to a Comedi sample value
it may need shifting right by 4 bits, and the top bit of the sample
value may need to be toggled.

Simplify the existing code by doing the 2's complement to straight
binary conversion before the shift.  That way, it is always bit 15 that
is inverted regardless of the resolution.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: simplify pci230_ao_mangle_datum()
Ian Abbott [Mon, 1 Sep 2014 11:03:46 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: simplify pci230_ao_mangle_datum()

`pci230_ao_mangle_datum()` converts comedi sample values for the AO
subdevice to hardware register values.  The comedi sample value will be
an unsigned value in the range 0 to 4095 (assuming 12-bit resolution).
The hardware wants the value shifted so the m.s. bit of the sample in in
bit 15.  If set to a bipolar range, it also expects a 2's complement
value, so the top bit of the sample value needs to be inverted in that
case.

Simplify the existing code by doing the 2's complement conversion after
the shift.  That way, it is always bit 15 that is inverted regardless of
the resolution.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: shrink struct pci230_board
Ian Abbott [Mon, 1 Sep 2014 11:03:45 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: shrink struct pci230_board

The `ai_bits`, `ao_bits`, and `min_hwver` members of `struct
pci230_board` are only set to small, non-negative values, so make them
`unsigned char`.  The `have_dio` member is used as a boolean so change
it to a bitfield of type `bool`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: remove ao_chans member
Ian Abbott [Mon, 1 Sep 2014 11:03:44 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: remove ao_chans member

The PCI230(+) has an AO subdevice with 2 channels, but the PCI260(+) has
none.

The `ao_chans` member of `struct pci230_board` indicates whether the
board has an AO subdevice and the number of AO channels.  The
`ao_bits` member indicates the AO sample width in bits and will only be
non-zero for boards with an AO subdevice.

Use `ao_bits` to indicate whether the board has an AO subdevice.  If it
has, assume the the number of AO channels is 2.  Then the `ao_chans`
member becomes redundant and can be removed.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: remove ai_chans member
Ian Abbott [Mon, 1 Sep 2014 11:03:43 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: remove ai_chans member

All boards supported by the "amplc_pci230" driver have 16 AI channels,
so the `ai_chans` member of `struct pci230_board` is superfluous and can
be removed.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: absorb pci230_alloc_private()
Ian Abbott [Mon, 1 Sep 2014 11:03:42 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: absorb pci230_alloc_private()

`pci230_alloc_private()` is now only called from `pci230_auto_attach()`
to allocate private device storage and initialize various spin-lock
members therein.  Absorb the body of `pci230_alloc_private()` into
`pci230_auto_attach()` itself.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: no need to comedi_set_hw_dev() here
Ian Abbott [Mon, 1 Sep 2014 11:03:41 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: no need to comedi_set_hw_dev() here

The comedi core module calls `comedi_set_hw_dev()` to associate the
hardware `struct device` with the `struct comedi_device` before it calls
the comedi driver's "auto_attach" hook `pci230_auto_attach()`.  There is
no need for `pci230_auto_attach()` to call `comedi_set_hw_dev()` itself,
so remove the call.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: absorb pci230_attach_common()
Ian Abbott [Mon, 1 Sep 2014 11:03:40 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: absorb pci230_attach_common()

`pci230_attach_common()` is now only called from `pci230_auto_attach()`,
so absorb it into that function.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: set detach handler to comedi_pci_detach()
Ian Abbott [Mon, 1 Sep 2014 11:03:39 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: set detach handler to comedi_pci_detach()

Since the comedi driver's "detach`" handler `pci230_detach()` now merely
calls `comedi_pci_detach()` with the same parameter, use
`comedi_pci_detach()` itself as the "detach" handler.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: no need to manipulate PCI ref count
Ian Abbott [Mon, 1 Sep 2014 11:03:38 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: no need to manipulate PCI ref count

This driver no longer supports a "legacy" attach mechanism that searches
for a suitable PCI device and increments it's reference count, but since
the common "detach" handler `pci230_detach()` still has a left-over
`pci_dev_put()`, a matching `pci_dev_get()` is needed in the
"auto_attach" handler `pci230_auto_attach()`.  There is no longer any
reason to "get" and "put" the PCI device, so those calls can be removed.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: remove "legacy" attach mechanism
Ian Abbott [Mon, 1 Sep 2014 11:03:37 +0000 (12:03 +0100)]
staging: comedi: amplc_pci230: remove "legacy" attach mechanism

The "amplc_pci230" driver currently retains the legacy attach mechanism
to allow devices to be attached manually via the `COMEDI_DEVCONFIG`
ioctl.  The only real use for this is to pretend that a PCI230+ or
PCI260+ is a PCI230 or PCI260 for backwards compatibility, as they have
different number of bits of resolution on the AI subdevice.  Since the
card would be automatically configured as a PCI230+ or PCI260+ at PCI
probe time anyway, hopefully any users who want it to appear as a PCI230
or PCI260 would have got tired of removing the automatically configured
device and configuring it manually by now and will have updated their
software to cope with the PCI230+ or PCI260+.

Get rid of the legacy attach mechanism by removing the Comedi driver
"attach" handler `pci230_attach()` and associated code.  Also remove the
"wildcard" entry from the board table `pci230_boards[]` as it is no
longer needed.  Don't bother initializing the `board_name`, `offset`,
and `num_names` members of `struct comedi_driver amplc_pci230_driver`
any longer as they are only needed when configuring the device manually.

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