]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/log
mirror_ubuntu-focal-kernel.git
8 years agostaging: comedi: COMEDI_BUFINFO: update buffer before becoming non-busy
Ian Abbott [Fri, 19 Feb 2016 16:13:52 +0000 (16:13 +0000)]
staging: comedi: COMEDI_BUFINFO: update buffer before becoming non-busy

The `COMEDI_BUFINFO` ioctl is used to advance the current position in
the buffer by a specified amount (which can be 0) and get the new
position.  For an asynchronous command in the "read" direction, if the
command has finished acquiring data normally, `do_become_nonbusy()` is
called to terminate the command.  That resets the buffer position, and
currently, the position information returned back to the user is after
the buffer has been reset.  It should be more useful to return the
buffer position before the reset, so move the call to
`do_become_nonbusy()` after the code that gets the updated buffer
position.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: COMEDI_BUFINFO: force bytes_read or bytes_written to 0
Ian Abbott [Fri, 19 Feb 2016 16:13:51 +0000 (16:13 +0000)]
staging: comedi: COMEDI_BUFINFO: force bytes_read or bytes_written to 0

The `COMEDI_BUFINFO` ioctl is used to advance the current position in
the buffer by a specified amount (which can be 0) and get the new
position.  On input, the `bytes_read` member of `struct comedi_bufinfo`
specifies the amount to advance the "read" position for an asynchronous
command in the "read" direction, and the `bytes_written` member
specifies the amount to advance the "write" position for a command in
the "write" direction.  The handler `do_bufinfo_ioctl()` may adjust
these by the amount the position is actually advanced before copying
them back to the user.  Currently, it ignores the specified `bytes_read`
value for a command in the "write" direction, and ignores the specified
`bytes_written` for a command in the "read" direction, so the values
copied back to the user are unchanged.  Change it to force the ignored
value to 0 before copying the values back to the user.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: COMEDI_BUFINFO: get amount freed, not amount allocated
Ian Abbott [Fri, 19 Feb 2016 16:13:50 +0000 (16:13 +0000)]
staging: comedi: COMEDI_BUFINFO: get amount freed, not amount allocated

The `COMEDI_BUFINFO` ioctl is used to advance the current position in
the buffer by a specified amount (which can be 0) and get the new
position.  On input, the `bytes_read` member of `struct comedi_bufinfo`
specifies the amount to advance the "read" position for an asynchronous
command in the "read" direction, and the `bytes_written` member
specifies the amount to advance the "write" position for a command in
the "write" direction.  The handler `do_bufinfo_ioctl()` may limit the
specified values according to amount of readable or writable space in
the buffer.  On output, the `struct comedi_bufinfo` is filled in with
the updated position information, along with the adjusted `bytes_read`
and `bytes_written` members.

Advancing the buffer position occurs in two steps: first, some buffer
space is allocated, and second, it is freed, advancing the current
"read" or "write" position.  Currently, `do_bufinfo_ioctl()` limits
`bytes_read` or `bytes_written` to the amount it could allocate in the
first step, but that is invisible and irrelevant to the ioctl user.
It's mostly irrelevant to the COMEDI internals as well, apart from
limiting how much can be freed in the second step.  Change it to ignore
how much it managed to allocate in the first step and just use the
amount that was actually freed in the second step, which is the amount
the current buffer position was actually moved by this ioctl call.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: drivers: Use DIV_ROUND_CLOSEST
Amitoj Kaur Chawla [Fri, 19 Feb 2016 15:27:15 +0000 (20:57 +0530)]
staging: comedi: drivers: Use DIV_ROUND_CLOSEST

The kernel.h macro DIV_ROUND_CLOSEST performs the computation
`(x +d/2)/d` but is perhaps more readable.

The Coccinelle script used is as follows:
// <smpl>
@@
expression x,__divisor;
@@
- (((x) + ((__divisor) / 2)) / (__divisor))
+ DIV_ROUND_CLOSEST(x,__divisor)
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: drivers: Remove unnecessary else following return
Janani Ravichandran [Thu, 18 Feb 2016 22:48:17 +0000 (17:48 -0500)]
staging: comedi: drivers: Remove unnecessary else following return

Else is unnecessary when there is a return statement in the
corresponding if block.
Coccinelle patch:

@rule1@
expression e1;
@@

if (e1) { ... return ...; }
-       else{
        ...
-            }

@rule2@
expression e2;
statement s1;
@@

if(e2) { ... return ...; }
-       else
s1

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: android: Remove unneeded else following a return
Janani Ravichandran [Thu, 18 Feb 2016 22:39:11 +0000 (17:39 -0500)]
staging: android: Remove unneeded else following a return

Remove unnecessary else when there is a return statement in the
corresponding if block.
Coccinelle patch used:

@rule1@
expression e1;
@@

if (e1) { ... return ...; }
-       else{
        ...
-            }

@rule2@
expression e2;
statement s1;
@@

if(e2) { ... return ...; }
-       else
s1

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: mt29f_spinand: Remove unneeded else following return
Janani Ravichandran [Thu, 18 Feb 2016 22:28:07 +0000 (17:28 -0500)]
staging: mt29f_spinand: Remove unneeded else following return

Remove unnecessary else when there is a return statement in the
corresponding if block. Coccinelle patch used:
@rule1@
expression e1;
@@

        if (e1) { ... return ...; }
-       else{
         ...
-     }

@rule2@
expression e2;
statement s1;
@@

if(e2) { ... return ...; }
-       else
s1

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6656: simplify tests of successful urb status
Alison Schofield [Wed, 17 Feb 2016 17:45:28 +0000 (09:45 -0800)]
staging: vt6656: simplify tests of successful urb status

Use if (status) in tests for successful urb status.

This replaces (status != 0) and (status == STATUS_SUCCESS).
(STATUS_SUCCESS is defined for NDIS status in this driver, but
was being misused)

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: Replace explicit NULL comparison
Bhaktipriya Shridhar [Thu, 18 Feb 2016 18:54:30 +0000 (00:24 +0530)]
staging: rtl8712: Replace explicit NULL comparison

Replace explicit NULL comparison with ! operator.
Found with Coccinelle.

@@
expression e;
@@
- e == NULL
+ !e

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: reduce stack usage
Arnd Bergmann [Wed, 17 Feb 2016 08:32:58 +0000 (09:32 +0100)]
staging: rtl8712: reduce stack usage

The "translate_scan" function in rtl8712 uses a lot of stack, and
gets inlined into its single caller, r8711_wx_get_scan, which
in some configurations now blows the 1024 byte stack warning
limit:

drivers/staging/rtl8712/rtl871x_ioctl_linux.c: In function 'r8711_wx_get_scan':
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1227:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

This somewhat reduces the stack usage by moving the translate_scan
function out of line with the noinline_for_stack annotation.
It might be possible to modify translate_scan() a little further
to reduce the stack usage, but with this patch, we can build without
the warning, the the call chain to get here is rather predictable
(sys_ioctl->vfs_ioctl->sock_ioctl->dev_ioctl->wext_ioctl->
r8711_wx_get_scan).

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: Improve suspend/resume functionality.
Hemmo Nieminen [Fri, 19 Feb 2016 19:02:24 +0000 (21:02 +0200)]
staging: rtl8712: Improve suspend/resume functionality.

Fix a driver hang caused by earlier suspend/resume cycles. By handling a
ENODEV error during suspend as a real error we eventually end up stopping
the whole driver.

Fix this by handling the ENODEV error (during suspend) essentially by
retrying.

Signed-off-by: Hemmo Nieminen <hemmo.nieminen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: Declare function as static
Amitoj Kaur Chawla [Tue, 16 Feb 2016 13:01:55 +0000 (18:31 +0530)]
staging: rtl8712: Declare function as static

Declare rtl871x_intf_resume() function static since it is defined and called
in this file only.

This fixes the following sparse warning:
warning: symbol 'rtl871x_intf_resume' was not declared. Should it be static?

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: Remove unneeded else following a return
Janani Ravichandran [Thu, 18 Feb 2016 22:22:50 +0000 (17:22 -0500)]
staging: fsl-mc: Remove unneeded else following a return

Remove unnecessary else when there is a return statement in the
corresponding if block. Coccinelle patch used:

@rule1@
expression e1;
@@

if (e1) { ... return ...; }
-       else{
        ...
-       }

@rule2@
expression e2;
statement s1;
@@

if(e2) { ... return ...; }
-       else
               s1

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: fsl-mc: bus: Drop owner assignment from platform_driver
Bhumika Goyal [Thu, 18 Feb 2016 05:49:38 +0000 (11:19 +0530)]
Staging: fsl-mc: bus: Drop owner assignment from platform_driver

For platform_driver, we don't need to set .owner field as is set by
platform driver core. The semantic patch used here first checks whether
platform_driver struct was actually used in a call to set the .owner
field.
The coccinelle script that generated the patch can be found here:
http://www.spinics.net/lists/kernel/msg2029903.html

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: octeon: Remove blank lines after open braces
Dilek Uzulmez [Fri, 19 Feb 2016 12:35:43 +0000 (14:35 +0200)]
Staging: octeon: Remove blank lines after open braces

This patch fixes "blank lines aren't necessary after an open brace '{'"
checkpatch.pl warning in ethernet.c

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: octeon: drop atomic usage from rx counters
Aaro Koskinen [Fri, 19 Feb 2016 20:47:12 +0000 (22:47 +0200)]
staging: octeon: drop atomic usage from rx counters

We have only one NAPI poll running at a time, so virtual port rx counters
can be updated normally.

Update of rx_dropped can still race with the gathering of statistics,
but full accuracy is not required there.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: David Daney <david.daney@cavium.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: octeon-usb: make driver name to match the file name
Aaro Koskinen [Tue, 16 Feb 2016 22:22:18 +0000 (00:22 +0200)]
staging: octeon-usb: make driver name to match the file name

Make driver name to match the file name.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: octeon-usb: add spaces around operator
Aaro Koskinen [Tue, 16 Feb 2016 22:22:17 +0000 (00:22 +0200)]
staging: octeon-usb: add spaces around operator

Add spaces around operator to improve readability.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: octeon-usb: switch to use kernel types
Aaro Koskinen [Tue, 16 Feb 2016 22:22:16 +0000 (00:22 +0200)]
staging: octeon-usb: switch to use kernel types

Switch to use kernel types:

uint64_t -> u64
uint32_t -> u32
uint16_t -> u16
uint8_t  -> u8
int8_t   -> s8

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: octeon-usb: clean up includes
Aaro Koskinen [Tue, 16 Feb 2016 22:22:15 +0000 (00:22 +0200)]
staging: octeon-usb: clean up includes

Clean up includes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: octeon-usb: delete space after cast
Aaro Koskinen [Tue, 16 Feb 2016 22:22:14 +0000 (00:22 +0200)]
staging: octeon-usb: delete space after cast

Delete space after cast.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: octeon-usb: add missing braces
Aaro Koskinen [Tue, 16 Feb 2016 22:22:13 +0000 (00:22 +0200)]
staging: octeon-usb: add missing braces

Some if branches are missing braces as required by coding style.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: octeon-usb: delete redundant blank lines
Aaro Koskinen [Tue, 16 Feb 2016 22:22:12 +0000 (00:22 +0200)]
staging: octeon-usb: delete redundant blank lines

Delete redundant blank lines.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192e: Drop useless initialisation
Bhaktipriya Shridhar [Thu, 18 Feb 2016 21:43:56 +0000 (03:13 +0530)]
staging: rtl8192e: Drop useless initialisation

Removed initialisation of a varible if it is immediately reassigned.

Changes were made using Coccinelle.

@@
type T;
constant C;
expression e;
identifier i;
@@
T i
- = C
;
i = e;

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192e: Remove explicit pointer cast in assignments
Janani Ravichandran [Tue, 16 Feb 2016 17:24:40 +0000 (12:24 -0500)]
staging: rtl8192e: Remove explicit pointer cast in assignments

In this file, the values returned by rtllib_priv() are unnecessarily cast
into a pointer type in some assignment statements. Remove the cast as it
is unneeded.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192u: Remove create_workqueue()
Bhaktipriya Shridhar [Sat, 20 Feb 2016 11:19:50 +0000 (16:49 +0530)]
staging: rtl8192u: Remove create_workqueue()

With cmwq, use of dedicated workqueues can be replaced by system_wq.
Removed the dedicated workqueue and used system_wq instead.

Since the work items in the workqueues do not need to
be ordered, increase of concurrency by switching to system_wq should
not break anything.

All work items are sync canceled so it is guaranteed that no work is
running when driver is detached.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8192u: Convert long if-else block to switch-case
Bhumika Goyal [Tue, 16 Feb 2016 09:56:05 +0000 (15:26 +0530)]
Staging: rtl8192u: Convert long if-else block to switch-case

Replace long if-else block with switch-case to make it more readable and
compact.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fbtft: Fix block comment coding style
Anchal Jain [Mon, 15 Feb 2016 16:08:27 +0000 (21:38 +0530)]
staging: fbtft: Fix block comment coding style

Add the required leading * on subsequent lines as well as
move the */ on a separate line. Checkpatch found this issue.

Signed-off-by: Anchal Jain <anchalj109@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: core: Remove unnecessary braces
Bhaktipriya Shridhar [Thu, 18 Feb 2016 22:48:24 +0000 (04:18 +0530)]
staging: rtl8188eu: core: Remove unnecessary braces

This patch removes braces for single statement blocks. The warning
was detected using checkpatch.pl.
Coccinelle was used to make the change.

@@
expression e,e1;
@@

- if (e) {
+ if (e)
  e1;
- }

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: Remove RF_PATH_C & RF_PATH_D
Andrew Bradford [Thu, 18 Feb 2016 03:14:07 +0000 (22:14 -0500)]
staging: rtl8188eu: Remove RF_PATH_C & RF_PATH_D

RTL8188EE has a maximum of 2 RF paths (chains) so paths C and D are not
needed to support this part.

Signed-off-by: Andrew Bradford <andrew@bradfordembedded.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8188eu/core: Coding style fix, avoid line over 80 characters
Colin Vidal [Tue, 16 Feb 2016 22:12:19 +0000 (23:12 +0100)]
Staging: rtl8188eu/core: Coding style fix, avoid line over 80 characters

Jump a new line after and operator of the test. It avoids to exceed 80
chars line, and remove a checkpatch warning.

Signed-off-by: Colin Vidal <colin@cvidal.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8188eu/core: Coding style fix, set constant operand on right in tests
Colin Vidal [Tue, 16 Feb 2016 22:12:18 +0000 (23:12 +0100)]
Staging: rtl8188eu/core: Coding style fix, set constant operand on right in tests

Remove a checkpatch warning, putting constant operant on right of two tests.

Signed-off-by: Colin Vidal <colin@cvidal.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8188eu/core: Coding style fix, set conform spaces between identifiers
Colin Vidal [Tue, 16 Feb 2016 22:12:17 +0000 (23:12 +0100)]
Staging: rtl8188eu/core: Coding style fix, set conform spaces between identifiers

And a space after include keyword, making the preprocessor more
readable, and remove an unexpected space between a type and variable
name.

Signed-off-by: Colin Vidal <colin@cvidal.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8188eu/core: remove paragraph which mention FSF address in comment header
Colin Vidal [Tue, 16 Feb 2016 22:12:16 +0000 (23:12 +0100)]
Staging: rtl8188eu/core: remove paragraph which mention FSF address in comment header

As FSF address changed in the past, and can change in the future,
remove the address paragraph in the comment header, and avoid a warning
of checkpatch.

Signed-off-by: Colin Vidal <colin@cvidal.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: core: Use put_unaligned_le16
Amitoj Kaur Chawla [Tue, 16 Feb 2016 14:26:05 +0000 (19:56 +0530)]
staging: rtl8188eu: core: Use put_unaligned_le16

Introduce the use of function put_unaligned_le16.
This is done using the following Coccinelle semantic patch:

//<smpl>
@@ identifier tmp; expression ptr; expression y,e; type T; @@

- tmp = cpu_to_le16(y);

  <+... when != tmp
- memcpy(ptr, (T)&tmp, ...);
+ put_unaligned_le16(y,ptr);
  ...+>
? tmp = e

@@ type T; identifier tmp; @@

- T tmp;
...when != tmp
//</smpl>

Corresponding header file has been added too.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8188eu: core: rtw_xmit.c: Remove NULL test before vfree
Bhumika Goyal [Mon, 15 Feb 2016 08:58:22 +0000 (14:28 +0530)]
Staging: rtl8188eu: core: rtw_xmit.c: Remove NULL test before vfree

The function vfree tests whether the argument is NULL and returns
immediately. So NULL test is not needed before vfree. Also remove blank
line between function calls.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8188eu: core: rtw_mlme.c: Remove NULL test before vfree
Bhumika Goyal [Mon, 15 Feb 2016 08:58:20 +0000 (14:28 +0530)]
Staging: rtl8188eu: core: rtw_mlme.c: Remove NULL test before vfree

The function vfree tests whether the argument is NULL and returns
immediately. So NULL test before vfree is not needed. Also remove braces
around if branch as they are no longer needed.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: hal: Use macro ARRAY_SIZE
Bhaktipriya Shridhar [Thu, 18 Feb 2016 19:30:13 +0000 (01:00 +0530)]
staging: rtl8723au: hal: Use macro ARRAY_SIZE

The macro ARRAY_SIZE is more concise to use instead of dividing
size of the array by the size of its type.

Changes were made using Coccinelle.

@@
type T;
T[] E;
@@

- (sizeof(E)/sizeof(T))
+ ARRAY_SIZE(E)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: Remove unnecessary else following return
Janani Ravichandran [Thu, 18 Feb 2016 22:56:53 +0000 (17:56 -0500)]
staging: rtl8723au: Remove unnecessary else following return

Remove unnecessary else when there is a return statement in the
corresponding if block.
Coccinelle patch used:

@rule1@
expression e1;
@@

if (e1) { ... return ...; }
-       else{
        ...
-            }

@rule2@
expression e2;
statement s1;
@@

if(e2) { ... return ...; }
-       else
s1

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: whitespace and blank line cleaning
Geliang Tang [Thu, 18 Feb 2016 14:19:31 +0000 (22:19 +0800)]
staging: rtl8723au: whitespace and blank line cleaning

This patch cleans whitespaces and blank lines involved with
previous two patchs in this patch set.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: core: rtw_recv: remove useless codes
Geliang Tang [Thu, 18 Feb 2016 14:19:30 +0000 (22:19 +0800)]
staging: rtl8723au: core: rtw_recv: remove useless codes

There are some useless codes in rtw_free_recvframe23a_queue() and
recvframe_defrag(), so remove them.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: use list_for_each_entry*()
Geliang Tang [Thu, 18 Feb 2016 14:19:29 +0000 (22:19 +0800)]
staging: rtl8723au: use list_for_each_entry*()

Use list_for_each_entry*() instead of list_for_each*() to simplify
the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8723au: hal: Remove unused macros
Bhumika Goyal [Mon, 15 Feb 2016 08:47:11 +0000 (14:17 +0530)]
Staging: rtl8723au: hal: Remove unused macros

The macros PlatformProcessHCICommands and PlatformTxBTQueuedPackets
are not used anywhere in the kernel so remove them.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: most: hdm-usb: Remove create_workqueue()
Amitoj Kaur Chawla [Sat, 20 Feb 2016 09:45:38 +0000 (15:15 +0530)]
staging: most: hdm-usb: Remove create_workqueue()

With concurrency managed workqueues, use of dedicated workqueues can
be replaced by using system_wq. Drop schedule_usb_work by using
system_wq.

Since there is only one work item per buf_anchor and most_dev and they
do not need to be ordered, increase of concurrency by switching to
system_wq should not break anything.

Both work items are sync canceled before the driver can be
unregistered, to ensure no work item is pending or executing on any
CPU by the time exit path is in flight.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: most: hdm-dim2: Replace pr_err with dev_err
Amitoj Kaur Chawla [Thu, 18 Feb 2016 14:42:11 +0000 (20:12 +0530)]
staging: most: hdm-dim2: Replace pr_err with dev_err

Replace pr_err with dev_err when a appropriate device structure is
present.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: most: hdm-dim2: Replace request_irq with devm_request_irq
Amitoj Kaur Chawla [Thu, 18 Feb 2016 14:42:00 +0000 (20:12 +0530)]
staging: most: hdm-dim2: Replace request_irq with devm_request_irq

Devm_ functions allocate memory that is released when a driver
detaches. Replace request_irq with devm_request_irq to get the
interrupt for device which is automatically freed on exit. Remove
corresponding free_irq from probe and remove functions of a platform
device.

Also, remove an unnecessary label.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: most: hdm-dim2: Switch to devm_ioremap_resource()
Amitoj Kaur Chawla [Thu, 18 Feb 2016 14:41:50 +0000 (20:11 +0530)]
staging: most: hdm-dim2: Switch to devm_ioremap_resource()

Devm_ functions allocate memory that is released when a driver
detaches. Replace request_mem_region and ioremap with
devm_ioremap_resource and remove corresponding freeing functions
release_mem_region and iounmap from probe and remove functions of a
platform device.

Also, an unnecessary platform_set_drvdata() has been removed since the
driver core clears the driver data to NULL after device release or on
probe failure. There is no need to manually clear the device driver
data to NULL.

Lastly, unnecessary labels have been removed.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: most: hdm-dim2: Replace kzalloc with devm_kzalloc
Amitoj Kaur Chawla [Thu, 18 Feb 2016 14:41:36 +0000 (20:11 +0530)]
staging: most: hdm-dim2: Replace kzalloc with devm_kzalloc

Devm_ functions allocate memory that is released when a driver detaches.
Replace kzalloc with devm_kzalloc and remove corresponding
kfrees from probe and remove functions of a platform
device.

Also, an unnecessary label has been removed.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: netlogic: Return zero pointer after failed kmalloc
Laura Garcia Liebana [Thu, 18 Feb 2016 17:38:42 +0000 (18:38 +0100)]
staging: netlogic: Return zero pointer after failed kmalloc

Return a ZERO_SIZE_PTR in the xlr_config_spill function if the
kmalloc returns an invalid value. This change prevents a possible
segmentation fault as the invalid pointer is fed into PTR_ALIGN macro.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: netlogic: Fix indent for conditional statement
Laura Garcia Liebana [Wed, 17 Feb 2016 08:53:07 +0000 (09:53 +0100)]
staging: netlogic: Fix indent for conditional statement

Insert code indent for conditional statements. Checkpatch detected this
issue.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: netlogic: Insert spaces around operator
Laura Garcia Liebana [Wed, 17 Feb 2016 08:52:39 +0000 (09:52 +0100)]
staging: netlogic: Insert spaces around operator

Spaces preferred around that '/' (ctx:VxV). Checkpatch detected these
issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: netlogic: Fix comparison to NULL
Laura Garcia Liebana [Wed, 17 Feb 2016 08:52:06 +0000 (09:52 +0100)]
staging: netlogic: Fix comparison to NULL

Avoid the use of comparison to NULL, use !<variable> instead. Checkpatch
detected these issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: netlogic: Fix CamelCase for constants
Laura Garcia Liebana [Wed, 17 Feb 2016 08:51:32 +0000 (09:51 +0100)]
staging: netlogic: Fix CamelCase for constants

Avoid the use of CamelCase for constants. Checkpatch detected these
issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: netlogic: Fix multiple assignments
Laura Garcia Liebana [Wed, 17 Feb 2016 08:48:47 +0000 (09:48 +0100)]
staging: netlogic: Fix multiple assignments

Avoid the use of multiple assignments in a single line. Checkpatch found
this issue.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: netlogic: Remove blank spaces after a cast
Laura Garcia Liebana [Wed, 17 Feb 2016 08:47:33 +0000 (09:47 +0100)]
staging: netlogic: Remove blank spaces after a cast

Remove uneeded blank spaces after a cast. Checkpatch found these issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: netlogic: Fix several parentheses alignments
Laura Garcia Liebana [Wed, 17 Feb 2016 08:46:35 +0000 (09:46 +0100)]
staging: netlogic: Fix several parentheses alignments

Align arguments with the open parenthesis. Checkpatch found these
issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: media: davinci_vpfe: remove ret variable in switch statements
Thaissa Falbo [Thu, 18 Feb 2016 21:17:54 +0000 (19:17 -0200)]
staging: media: davinci_vpfe: remove ret variable in switch statements

Remove ret variable in functions that used it to determine the return.
Simplified the return logic for these functions.

Found with Coccinelle script:

@@
local idexpression ret;
expression c,d;
identifier label;
@@

switch ( ... ) {
case label :
...
- ret = c;
- break;
+ return c;
...
default:
...
- ret = d;
+ return d;
...
}
... when != ret
- return ret;

@@
type T; identifier i;
@@
- T i;
... when != i

Signed-off-by: Thaissa Falbo <thaissa.falbo@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: media: davinci_vpfe: remove unnecessary ret variable
Thaissa Falbo [Thu, 18 Feb 2016 16:18:12 +0000 (14:18 -0200)]
staging: media: davinci_vpfe: remove unnecessary ret variable

Simplified return of funcions by removing assignment of ret variable.

Coccinelle script used:

@@
local idexpression ret;
expression e;
@@

- ret = e;
- if(ret)
-       return ret;
+ if(e)
+       return e;

@@
local idexpression ret;
expression e;
@@

- ret = e;
- return ret;
+ return e;

@@
local idexpression ret;
expression e;
@@

- ret = e;
- if(ret){
+ if(e){
        ... when != ret
-       return ret;
+       return e;
}

@@
type T; identifier i;
@@
- T i;
... when != i

Signed-off-by: Thaissa Falbo <thaissa.falbo@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging:media:davinci_vpfe: Fix lines over 80 characters
Thaissa Falbo [Mon, 15 Feb 2016 06:10:11 +0000 (04:10 -0200)]
staging:media:davinci_vpfe: Fix lines over 80 characters

Fix "line over 80 characters" checkpatch warnings

WARNING: line over 80 characters

Signed-off-by: Thaissa Falbo <thaissa.falbo@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging:media:davinci_vpfe: Fixed code identation warning as detected by checkpatch
Thaissa Falbo [Mon, 15 Feb 2016 05:38:39 +0000 (03:38 -0200)]
staging:media:davinci_vpfe: Fixed code identation warning as detected by checkpatch

Fixed code indentation warning as detected by checkpatch.

WARNING: suspect code indent for conditional statements (24, 40)
#1672: FILE: drivers/staging/media/davinci_vpfe/dm365_resizer.c:1672:

Signed-off-by: Thaissa Falbo <thaissa.falbo@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging:media:davinci_vpfe: Fixed comparisons with constants warnings
Thaissa Falbo [Mon, 15 Feb 2016 04:52:49 +0000 (02:52 -0200)]
staging:media:davinci_vpfe: Fixed comparisons with constants warnings

WARNING: Comparisons should place the constant on the right side of the
test

Fixed warnings by moving the constants to the right side of the comparisons.

Signed-off-by: Thaissa Falbo <thaissa.falbo@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging:media:davinci_vpfe: Fixed block comments according to kernel coding style
Thaissa Falbo [Mon, 15 Feb 2016 04:07:41 +0000 (02:07 -0200)]
staging:media:davinci_vpfe: Fixed block comments according to kernel coding style

Fixed block comments by following the checkpatch warnings

WARNING: Block comments use * on subsequent lines
WARNING: Block comments use a trailing */ on separate line

Signed-off-by: Thaissa Falbo <thaissa.falbo@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rdma: hfi1: Use offset_in_page macro
Amitoj Kaur Chawla [Sat, 20 Feb 2016 13:38:02 +0000 (19:08 +0530)]
staging: rdma: hfi1: Use offset_in_page macro

Use offset_in_page macro instead of (var & ~PAGE_MASK)

The Coccinelle semantic patch used to make this change is as follows:
// <smpl>
@@
unsigned long p;
@@
- p & ~PAGE_MASK
+ offset_in_page(p)
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rdma: hfi1: Use DIV_ROUND_UP
Amitoj Kaur Chawla [Sat, 20 Feb 2016 08:28:27 +0000 (13:58 +0530)]
staging: rdma: hfi1: Use DIV_ROUND_UP

The kernel.h macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)) but is perhaps more readable.

The Coccinelle script used is as follows:

// <smpl>
@@
expression n,d;
@@
(
- (n + d - 1) / d
+ DIV_ROUND_UP(n,d)
|
- (n + (d - 1)) / d
+ DIV_ROUND_UP(n,d)
)
@@
expression n,d;
@@
- DIV_ROUND_UP((n),d)
+ DIV_ROUND_UP(n,d)
@@
expression n,d;
@@
- DIV_ROUND_UP(n,(d))
+ DIV_ROUND_UP(n,d)
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rdma: hfi1: Replace kmalloc and memcpy with kmemdup
Amitoj Kaur Chawla [Mon, 15 Feb 2016 19:25:25 +0000 (00:55 +0530)]
staging: rdma: hfi1: Replace kmalloc and memcpy with kmemdup

Replace kmalloc and memcpy with kmemdup. Found using Coccinelle.

The semantic patch used to make this change can be found here:
scripts/coccinelle/api/memdup.cocci

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wlan-ng: fix NULL comparison
Fu Yong Quah [Sat, 20 Feb 2016 10:23:14 +0000 (10:23 +0000)]
staging: wlan-ng: fix NULL comparison

Fix NULL equality comparision by changing it with exclamation mark,
as suggested by Documentation/CodingStyle

Signed-off-by: Fu Yong Quah <fuyong@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wlan-ng: Remove flush_scheduled_work
Amitoj Kaur Chawla [Wed, 17 Feb 2016 17:36:14 +0000 (23:06 +0530)]
staging: wlan-ng: Remove flush_scheduled_work

flush_scheduled_work() is scheduled for deprecation. Use
cancel_work_sync() instead to ensure that there is no pending or
running work item.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: wlan-ng: Remove unused functions and prototypes
Bhumika Goyal [Wed, 17 Feb 2016 16:50:09 +0000 (22:20 +0530)]
Staging: wlan-ng: Remove unused functions and prototypes

hfa384x_drvr_getconfig_async is not used anywhere in the kernel
so remove it. Also remove its prototype from the header file. Also
the function hfa384x_cb_rrid was only used by hfa384x_drvr_getconfig_async
so remove its definition and prototype as well.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: wlan-ng: Remove function hfa384x_drvr_commtallies
Bhumika Goyal [Wed, 17 Feb 2016 16:50:08 +0000 (22:20 +0530)]
Staging: wlan-ng: Remove function hfa384x_drvr_commtallies

The function hfa384x_drvr_commtallies is not used anywhere in the kernel
so remove it. Also remove its prototype from the header file.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: resolver: fix comparison to NULL
Eva Rachel Retuya [Thu, 18 Feb 2016 10:59:39 +0000 (18:59 +0800)]
staging: iio: resolver: fix comparison to NULL

Remove comparison of spi->dev.platform_data to NULL by replacing it with
'!spi->dev.platform_data' as checkpatch suggested:

CHECK: Comparison to NULL could be written "!spi->dev.platform_data"

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: resolver: remove unnecessary blank line
Eva Rachel Retuya [Thu, 18 Feb 2016 10:59:38 +0000 (18:59 +0800)]
staging: iio: resolver: remove unnecessary blank line

Delete the excess newline. Issue found by checkpatch.

CHECK: Please don't use multiple blank lines

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: resolver: delete space after a cast
Eva Rachel Retuya [Thu, 18 Feb 2016 10:59:37 +0000 (18:59 +0800)]
staging: iio: resolver: delete space after a cast

Delete unwanted whitespace after casting. Issue pointed out by
checkpatch.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: resolver: add missing braces on if-else statements
Eva Rachel Retuya [Thu, 18 Feb 2016 10:59:36 +0000 (18:59 +0800)]
staging: iio: resolver: add missing braces on if-else statements

Add braces around the else clause to adhere to kernel coding style. This
clears the following checkpatch issue:

CHECK: braces {} should be used on all arms of this statement

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: resolver: use blank line after array declaration
Eva Rachel Retuya [Thu, 18 Feb 2016 10:59:35 +0000 (18:59 +0800)]
staging: iio: resolver: use blank line after array declaration

Add a blank line after array declaration. This clears the checkpatch
check:

CHECK: Please use a blank line after function/struct/union/enum
declarations

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: resolver: add spaces around operators
Eva Rachel Retuya [Thu, 18 Feb 2016 10:59:34 +0000 (18:59 +0800)]
staging: iio: resolver: add spaces around operators

Add spaces around operators to improve readability and to address the
checkpatch issue:

CHECK: spaces preferred around that '/' (ctx:VxV)

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: resolver: align to match open parenthesis
Eva Rachel Retuya [Thu, 18 Feb 2016 10:59:33 +0000 (18:59 +0800)]
staging: iio: resolver: align to match open parenthesis

Use a combination of tabs and spaces to align parameters to its
corresponding open parenthesis. Checkpatch found this issue.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: light: fix multiple assignments in a single line
Eva Rachel Retuya [Thu, 18 Feb 2016 07:35:40 +0000 (15:35 +0800)]
staging: iio: light: fix multiple assignments in a single line

Rewrite the multiple assignments to clear checkpatch check:

CHECK: multiple assignments should be avoided

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: light: add space around '*"
Eva Rachel Retuya [Thu, 18 Feb 2016 07:35:39 +0000 (15:35 +0800)]
staging: iio: light: add space around '*"

Address checkpatch check pointing out the lack of space around the
operator '*'.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: light: fix block comments according to kernel coding style
Eva Rachel Retuya [Thu, 18 Feb 2016 07:35:38 +0000 (15:35 +0800)]
staging: iio: light: fix block comments according to kernel coding style

Add the trailing */ accordingly to suit the preferred way of placing
block comments.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: light: omit space after a cast
Eva Rachel Retuya [Thu, 18 Feb 2016 07:35:37 +0000 (15:35 +0800)]
staging: iio: light: omit space after a cast

Remove the unneeded space as pointed out by checkpatch:
CHECK: No space is necessary after a cast

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: light: indent to match open parenthesis
Eva Rachel Retuya [Thu, 18 Feb 2016 07:35:36 +0000 (15:35 +0800)]
staging: iio: light: indent to match open parenthesis

Indent the parameters to match open parenthesis as suggested by checkpatch.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: accel: Remove unnecessary else after goto in if block
Janani Ravichandran [Thu, 18 Feb 2016 21:22:29 +0000 (16:22 -0500)]
staging: iio: accel: Remove unnecessary else after goto in if block

This patch removes the unnecessary else following an if block with a
goto statement.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: adc: Remove unnecessary test from if conditions
Amitoj Kaur Chawla [Tue, 16 Feb 2016 18:14:31 +0000 (23:44 +0530)]
staging: iio: adc: Remove unnecessary test from if conditions

Remove unnecessary test condition on ret variable which has been
previously tested and returns its value if the value is non zero.

This fixes the following smatch warnings:
drivers/staging/iio/adc/ad7816.c:299 ad7816_set_oti() warn: we tested
'ret' before and it was 'false'
drivers/staging/iio/adc/ad7816.c:306 ad7816_set_oti() warn: we tested
'ret' before and it was 'false'

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: wilc1000: Remove and rename struct typedefs from .c files
Bhumika Goyal [Sat, 20 Feb 2016 21:42:11 +0000 (03:12 +0530)]
Staging: wilc1000: Remove and rename struct typedefs from .c files

Using typedef for a structure type is not suggested in Linux kernel coding
style guidelines. So remove typedefs from structures wilc_sdio_t,
wilc_spi_t and wilc_mac_cfg_t.
Also remove '_t' suffix from the struct names by hand.

The following semantic patch detects cases:

@tn1@
type td;
@@

typedef struct { ... } td;

@script:python tf@
td << tn1.td;
tdres;
@@
coccinelle.tdres = td;

@@ type tn1.td;
identifier tf.tdres;
@@
-typedef
 struct
+ tdres
  { ... }
-td
  ;
@@ type tn1.td;
identifier tf.tdres;
@@
-td
+ struct tdres

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: wilc1000: Remove unused function WILC_WFI_update_stats
Bhumika Goyal [Sat, 20 Feb 2016 18:00:25 +0000 (23:30 +0530)]
Staging: wilc1000: Remove unused function WILC_WFI_update_stats

This patch removes the function WILC_WFI_update_stats as it is not used
anywhere in the kernel. Also remove its declaration from the header
file. Grepped to find the occurences.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: lnet: Remove and rename struct typedef lstcon_session_t
Bhumika Goyal [Fri, 19 Feb 2016 13:43:52 +0000 (19:13 +0530)]
Staging: lustre: lnet: Remove and rename struct typedef lstcon_session_t

This patch gets rid of struct typedef lstcon_session_t as it is not
suggested to use typdefs for structure types. Also drop '_t' from the name.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: Replace __attribute__((packed)) with __packed
Amitoj Kaur Chawla [Thu, 18 Feb 2016 18:06:12 +0000 (23:36 +0530)]
staging: lustre: Replace __attribute__((packed)) with __packed

This patch fixes the following checkpatch.pl warning:
"WARNING: __packed is preferred over __attribute__((packed))".

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: lustre: Remove unneeded else after goto
Janani Ravichandran [Thu, 18 Feb 2016 22:15:48 +0000 (17:15 -0500)]
staging: lustre: lustre: Remove unneeded else after goto

Remove unnecessary else following an if block with a goto statement.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: lustre: Remove unnecessary else after return
Janani Ravichandran [Thu, 18 Feb 2016 21:52:45 +0000 (16:52 -0500)]
staging: lustre: lustre: Remove unnecessary else after return

Else is unnecessary when there is a return statement in the
corresponding if block. Coccinelle patch used:

@rule1@
expression e1;
@@

if (e1) { ... return ...; }
-       else{
        ...
-       }

@rule2@
expression e2;
statement s1;
@@

if(e2) { ... return ...; }
-       else
s1

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: lov: Pull assignments out of function call
Bhumika Goyal [Tue, 16 Feb 2016 19:31:58 +0000 (01:01 +0530)]
Staging: lustre: lov: Pull assignments out of function call

Assignments in function call arguments are undesirable. So pull such
assignments out before function call.
Made a coccinelle script to detect such cases:
@@
expression fn,b,d;
@@
* fn(...,d=b,...);

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: osc: osc_request: Declare local function and structure as static
Amitoj Kaur Chawla [Tue, 16 Feb 2016 13:44:12 +0000 (19:14 +0530)]
staging: lustre: osc: osc_request: Declare local function and structure as static

Declare osc_cleanup() function and osc_obd_ops structure as static
since they are defined and called only in this file.

Removed osc_cleanup() function prototype since it wasn't required.

This fixes the following sparse warnings:
drivers/staging/lustre/lustre/osc/osc_request.c:3210:5: warning:
symbol 'osc_cleanup' was not declared. Should it be static?
drivers/staging/lustre/lustre/osc/osc_request.c:3259:16: warning:
symbol 'osc_obd_ops' was not declared. Should it be static?

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: obdclass: obd_mount: Declare function as static
Amitoj Kaur Chawla [Tue, 16 Feb 2016 11:49:35 +0000 (17:19 +0530)]
staging: lustre: obdclass: obd_mount: Declare function as static

Declare lustre_mount() function static since it is defined and called in this
file only.

This fixes the following sparse warning:
drivers/staging/lustre/lustre/obdclass/obd_mount.c:1169:15: warning:
symbol 'lustre_mount' was not declared. Should it be static?

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: Fixed the parenthesis
Shalin Mehta [Mon, 15 Feb 2016 03:37:02 +0000 (19:37 -0800)]
staging: lustre: Fixed the parenthesis

The parentehsis are fixed in the macro for the ldlm lock to set and
clear the flags.

Signed-off-by: Shalin Mehta <shalinmehta85@gmail.com>
Acked-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre: Convert cfs_str2num_check to use kstrtoul
Oleg Drokin [Tue, 16 Feb 2016 05:47:17 +0000 (00:47 -0500)]
staging/lustre: Convert cfs_str2num_check to use kstrtoul

simple_strtoul is obsolete

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre: Convert cfs_trace_daemon_command to use kstrtoul
Oleg Drokin [Tue, 16 Feb 2016 05:47:16 +0000 (00:47 -0500)]
staging/lustre: Convert cfs_trace_daemon_command to use kstrtoul

simple_strtoul is obsolete

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre: Remove space after cast in cfs_crypto_hash_final()
Oleg Drokin [Tue, 16 Feb 2016 05:47:14 +0000 (00:47 -0500)]
staging/lustre: Remove space after cast in cfs_crypto_hash_final()

This is against kernel-code style.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/libcfs: Get rid of multiple assignments
Oleg Drokin [Tue, 16 Feb 2016 05:47:13 +0000 (00:47 -0500)]
staging/lustre/libcfs: Get rid of multiple assignments

They make checkpatch unhappy, and I guess overall might confuse
people too.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre: Get rid of cfs_trace_buf_type_t typedef
Oleg Drokin [Tue, 16 Feb 2016 05:47:12 +0000 (00:47 -0500)]
staging/lustre: Get rid of cfs_trace_buf_type_t typedef

Replace it with enum cfs_trace_buf_type

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre: Update cfs_cpu_notify switch statement with a comment
Oleg Drokin [Tue, 16 Feb 2016 05:47:11 +0000 (00:47 -0500)]
staging/lustre: Update cfs_cpu_notify switch statement with a comment

We do really mean to fall through to that default case statement from
all previous ones, so add a comment to unconfuse verious tools

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/lustre/libcfs: Remove empty lines after/before braces
Oleg Drokin [Tue, 16 Feb 2016 05:47:10 +0000 (00:47 -0500)]
staging/lustre/libcfs: Remove empty lines after/before braces

No need for an empty line after opening curvy brace and no need
for an empty line before the closing one too.
Remove them.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>