]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/log
mirror_ubuntu-hirsute-kernel.git
8 years agostaging: rtl8188eu: Remove unnecessary parantheses
Bhaktipriya Shridhar [Mon, 22 Feb 2016 17:08:03 +0000 (22:38 +0530)]
staging: rtl8188eu: Remove unnecessary parantheses

Removed parantheses on the right hand side of assignments as they are
not needed.

This was done with Coccinelle:

@@ expression a, b; @@

a =
- (
b
- )
;

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: sm750fb: Remove unused functions
Bhumika Goyal [Fri, 11 Mar 2016 06:58:49 +0000 (12:28 +0530)]
Staging: sm750fb: Remove unused functions

The functions dviGetDeviceID and dviGetVendorID are not used anywhere in
the kernel so remove them. Also, remove their function prototypes.
Grepped to find occurences.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: sm750fb: Remove leading and trailing whitespace.
Sandhya Bankar [Sun, 6 Mar 2016 09:37:44 +0000 (15:07 +0530)]
Staging: sm750fb: Remove leading and trailing whitespace.

Remove leading and trailing whitespace.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: sm750fb: convert pr_err() to dev_err()
Eva Rachel Retuya [Sun, 6 Mar 2016 05:20:21 +0000 (13:20 +0800)]
staging: sm750fb: convert pr_err() to dev_err()

Replace pr_err() calls with respective dev_err() counterpart.
Change is safe since pdev is not NULL, this was identified by hand.
Semantic patch used to detect and apply the transformation:

@r exists@
identifier f,s,i;
position p;
@@

f(...,struct s *i,...) {
  <+...
  pr_err@p(...)
  ...+>
}

@s@
identifier r.s, dev;
@@

struct s {
...
struct device dev;
...
};

@t@
identifier r.i, s.dev;
expression fmt;
position r.p;
@@

- pr_err@p(
+ dev_err(&i->dev,
fmt, ...);

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: sm750fb: Remove Unused macro
Bhaktipriya Shridhar [Sun, 28 Feb 2016 15:57:49 +0000 (21:27 +0530)]
staging: sm750fb: Remove Unused macro

The macro PEEK32 is used nowhere in the file. Hence,removed.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: sm750fb: Use pcim_enable_device()
Amitoj Kaur Chawla [Sun, 28 Feb 2016 15:52:00 +0000 (21:22 +0530)]
staging: sm750fb: Use pcim_enable_device()

Devm_ functions allocate memory that is released when a driver
detaches.
Replace pci_enable_device with the managed pcim_enable_device
and remove corresponding pci_disable_device from probe and
suspend functions of a pci_dev.

Also, an unnecessary label has been removed by replacing it
with a direct return statement.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: sm750fb: Replace kzalloc with devm_kzalloc
Amitoj Kaur Chawla [Sun, 28 Feb 2016 15:51:53 +0000 (21:21 +0530)]
staging: sm750fb: 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 pci_dev.

Also, an unnecessary label has been removed by replacing it
with a direct return statement.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: sm750fb: Remove unnecessary pci_set_drvdata()
Amitoj Kaur Chawla [Thu, 25 Feb 2016 05:37:37 +0000 (11:07 +0530)]
staging: sm750fb: Remove unnecessary pci_set_drvdata()

Unnecessary pci_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.

The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct pci_dev *pci;
@@
- pci_set_drvdata(pci, NULL);
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: sm750fb: Remove parentheses from return arguments
Amitoj Kaur Chawla [Wed, 24 Feb 2016 17:00:15 +0000 (22:30 +0530)]
staging: sm750fb: Remove parentheses from return arguments

Remove unnecessary parentheses from return arguments.

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@@
identifier i;
constant c;
@@

return
- (
    \(i\|-i\|i(...)\|c\)
- )
  ;
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: most: hdm-usb: Remove invalid reference error
Amitoj Kaur Chawla [Fri, 11 Mar 2016 18:41:47 +0000 (00:11 +0530)]
staging: most: hdm-usb: Remove invalid reference error

commit e3479f77("staging: most: hdm-usb: Remove create_workqueue()")
cancel_work_sync(&anchor->clear_work_obj) is introduced after freeing
`anchor` causing a invalid reference error. This patch removes this
error by shifting the call to cancel_work_sync before freeing
`anchor`.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rts5208: Change form of NULL comparisons
Bhaktipriya Shridhar [Sat, 5 Mar 2016 21:09:51 +0000 (02:39 +0530)]
staging: rts5208: Change form of NULL comparisons

Change null comparisons of the form x == NULL to !x.
This was done using 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: rts5208: Remove NULL test before vfree
Bhaktipriya Shridhar [Sun, 28 Feb 2016 20:28:44 +0000 (01:58 +0530)]
staging: rts5208: Remove NULL test before vfree

vfree frees the virtually continuous memory area starting at addr.
If addr is NULL, no operation is performed. So NULL test is not needed
before vfree.

This was done using Coccinelle:

@@
expression x;
@@
-if (x != NULL)
    vfree(x);

@@
expression x;
@@

-if (x != NULL) {
vfree(x);
x = NULL;
-}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rts5208: simplify NULL tests
Eva Rachel Retuya [Sat, 27 Feb 2016 12:39:24 +0000 (20:39 +0800)]
staging: rts5208: simplify NULL tests

Replace direct comparisons to NULL i.e. 'x == NULL' with '!x' for
consistency. Coccinelle semantic patch used:

@@
identifier func;
expression x;
statement Z;
@@

x = func(...);

if (
(
+ !
x
- == NULL
|
+ !
- NULL ==
x
)
   ) Z

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rts5208: Use min instead of ternary operator
Bhumika Goyal [Fri, 26 Feb 2016 10:04:34 +0000 (15:34 +0530)]
Staging: rts5208: Use min instead of ternary operator

This patch replaces ternary operator with macro min as it shorter and
thus increases code readability. Macro min returns the minimum of the
two compared values.
Made a semantic patch for changes:

@@
type T;
T x;
T y;
@@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rts5208: rtsx_transport.c: Drop void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 19:42:24 +0000 (14:42 -0500)]
staging: rts5208: rtsx_transport.c: Drop void pointer cast

Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void *e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rts5208: rtsx.c: Drop unneeded void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 19:37:56 +0000 (14:37 -0500)]
staging: rts5208: rtsx.c: Drop unneeded void pointer cast

Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void *e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rts5208: Remove unnecessary pci_set_drvdata()
Amitoj Kaur Chawla [Thu, 25 Feb 2016 05:38:20 +0000 (11:08 +0530)]
staging: rts5208: Remove unnecessary pci_set_drvdata()

Unnecessary pci_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.

The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct pci_dev *pci;
@@
- pci_set_drvdata(pci, NULL);
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rts5208: Remove unnecessary parentheses
Dilek Uzulmez [Tue, 23 Feb 2016 18:32:24 +0000 (20:32 +0200)]
Staging: rts5208: Remove unnecessary parentheses

Problem found using checkpatch.pl
CHECK: Unnecessary parentheses around chip->ms_card

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rts5208: Prefer using BIT macro
Bhaktipriya Shridhar [Sun, 21 Feb 2016 09:53:37 +0000 (15:23 +0530)]
staging: rts5208: Prefer using BIT macro

Replace all instances of bit shifting on 1 with the BIT(x) macro.
This was done using Coccinelle.

@@ int c; @@
- (1 << c)
+ BIT(c)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rts5208: Removed unnecessary return variable
Bhaktipriya Shridhar [Sun, 21 Feb 2016 07:35:20 +0000 (13:05 +0530)]
staging: rts5208: Removed unnecessary return variable

This patch removes unnecessary return variables in switch statements.
This was done with Coccinelle:

@@ local idexpression ret; expression e1,e2; identifier label;
@@
switch ( ... ) {
case label : ...
- ret = e1;
- break;
+ return e1;
... default: ...
- ret = e2;
+ return e2;
... }
... when != ret
- return ret;
@@ type T; identifier x; @@
- T x;
... when != x

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: media: davinci_vpfe: Remove unnecessary else after return
Bhaktipriya Shridhar [Thu, 10 Mar 2016 17:36:23 +0000 (23:06 +0530)]
staging: media: davinci_vpfe: Remove unnecessary else after return

This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: media: davinci_vpfe: dm365_ipipe_hw: Remove unnecessary else after return
Bhaktipriya Shridhar [Thu, 10 Mar 2016 17:29:47 +0000 (22:59 +0530)]
staging: media: davinci_vpfe: dm365_ipipe_hw: Remove unnecessary else after return

This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: media: Remove unnecessary goto.
Sandhya Bankar [Sun, 6 Mar 2016 13:24:09 +0000 (18:54 +0530)]
Staging: media: Remove unnecessary goto.

Remove unnecessary goto.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: [media] mn88472: simplify NULL tests
Eva Rachel Retuya [Sat, 27 Feb 2016 12:39:22 +0000 (20:39 +0800)]
staging: [media] mn88472: simplify NULL tests

Replace direct comparisons to NULL i.e. 'x == NULL' with '!x' for
consistency. Coccinelle semantic patch used:

@@
identifier func;
expression x;
statement Z;
@@

x = func(...);

if (
(
+ !
x
- == NULL
|
+ !
- NULL ==
x
)
   ) Z

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: media: omap4iss: Remove unnecessary platform_set_drvdata()
Amitoj Kaur Chawla [Thu, 25 Feb 2016 05:37:47 +0000 (11:07 +0530)]
staging: media: omap4iss: Remove unnecessary platform_set_drvdata()

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.

The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct platform_device *pdev;
@@
- platform_set_drvdata(pdev, NULL);
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8712: Remove function r8712_setptm_cmd and r8712_gettssi_cmd
Bhumika Goyal [Fri, 11 Mar 2016 10:23:57 +0000 (15:53 +0530)]
Staging: rtl8712: Remove function r8712_setptm_cmd and r8712_gettssi_cmd

The function r8712_setptm_cmd and r8712_gettssi_cmd are not used
anywhere in the kernel so remove them. Also, remove their function
prototypes.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: Remove unnecessary else after return
Bhaktipriya Shridhar [Thu, 10 Mar 2016 16:50:25 +0000 (22:20 +0530)]
staging: rtl8712: Remove unnecessary else after return

This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8712: Avoid multiple assignments.
Sandhya Bankar [Sun, 6 Mar 2016 10:03:31 +0000 (15:33 +0530)]
Staging: rtl8712: Avoid multiple assignments.

Avoid multiple assignments.This isssue is found by checkpatch.pl script.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: Remove the unnecessary parantheses
G Pooja Shamili [Sun, 6 Mar 2016 09:42:30 +0000 (15:12 +0530)]
staging: rtl8712: Remove the unnecessary parantheses

The unnecessary parantheses on the right side of assignments were removed,
as in most cases (expect for ==, >=, <=, !=), they are futile.

This was done using Coccinelle, the semantic patch being:

@@
expression E1,E2,E3;
binary operator bin_op = {==,>=,<=,!=};
@@

E1 =
(
  (
   E2 bin_op E3
  )
|
-(
E2
-)
)
;

Signed-off-by: G Pooja Shamili <poojashamili@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: rtl871x_mp_ioctl: Remove exceptional & on function name
Amitoj Kaur Chawla [Sun, 6 Mar 2016 00:44:43 +0000 (06:14 +0530)]
staging: rtl8712: rtl871x_mp_ioctl: Remove exceptional & on function name

In this file, function names are otherwise used as pointers without
&.

The Coccinelle semantic patch that is used to make this change is as
follows:

// <smpl>
@r@
identifier f;
@@
f(...) { ... }
@@
identifier r.f;
@@
- &f
+ f
@m@
type T;
identifier f;
@@
T f(...);
@@
identifier m.f;
@@
- &f
+ f
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers: staging: rtl8712: Change form of NULL comparisons
Bhaktipriya Shridhar [Sat, 5 Mar 2016 21:21:42 +0000 (02:51 +0530)]
drivers: staging: rtl8712: Change form of NULL comparisons

Change null comparisons of the form x == NULL to !x.
This was done using 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: Make return of 0 explicit
Bhaktipriya Shridhar [Thu, 25 Feb 2016 10:47:33 +0000 (16:17 +0530)]
staging: rtl8712: Make return of 0 explicit

Delete unnecessary local variable whose value is always 0 and
return 0 as the result.

The following Coccinelle script was used:

@@
identifier ret; expression E;
type T;
@@
(
- T ret;
|
- T ret = 0;
)

... when != \(ret=E
\|ret--\|ret++\|--ret\|++ret\|ret-=E\|ret+=E\|ret|=E\|ret&=E\)
(
?-ret = 0;
)
... when != \(ret=E
\|ret--\|ret++\|--ret\|++ret\|ret-=E\|ret+=E\|ret|=E\|ret&=E\)
(
return
- ret
+ 0
;
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8712: Clean up tests if NULL returned on failure
Bhumika Goyal [Wed, 24 Feb 2016 10:39:31 +0000 (16:09 +0530)]
Staging: rtl8712: Clean up tests if NULL returned on failure

Some functions like kmalloc/usb_alloc_urb/kmalloc_array returns NULL as
their return value on failure. !x is generally preferred over x==NULL
or NULL==x so make use of !x if the value returned on failure
by these functions is NULL.
Done using coccinelle:

@@
expression e;
statement S;
@@
e = \(kmalloc\|devm_kzalloc\|kmalloc_array
     \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(...);
- if(e==NULL)
+ if(!e)
  S

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: Remove unnecessary parantheses
Bhaktipriya Shridhar [Mon, 22 Feb 2016 17:09:00 +0000 (22:39 +0530)]
staging: rtl8712: Remove unnecessary parantheses

Removed parantheses on the right hand side of assignments as they are
not needed.

This was done with Coccinelle:

@@ expression a, b; @@

a =
- (
b
- )
;

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: Simplify return
Bhaktipriya Shridhar [Mon, 22 Feb 2016 13:29:45 +0000 (18:59 +0530)]
staging: rtl8712: Simplify return

Simplified the multiline check to a single return statement.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: Remove exceptional & on function name
Amitoj Kaur Chawla [Sun, 21 Feb 2016 14:23:27 +0000 (19:53 +0530)]
staging: rtl8712: Remove exceptional & on function name

Remove exceptional '&' operator in front of a function name.

The Coccinelle semantic patch that is used to make this change is as
follows:

// <smpl>
@r@
identifier f;
@@
f(...) { ... }
@@
identifier r.f;
@@
- &f
+ f
@m@
type T;
identifier f;
@@
T f(...);
@@
identifier m.f;
@@
- &f
+ f
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: Remove unnecessary cast on void pointer
Bhaktipriya Shridhar [Sun, 21 Feb 2016 07:26:16 +0000 (12:56 +0530)]
staging: rtl8712: Remove unnecessary cast on void pointer

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8712: Remove cast on void pointer
Bhaktipriya Shridhar [Sun, 21 Feb 2016 07:21:32 +0000 (12:51 +0530)]
staging: rtl8712: Remove cast on void pointer

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: ste_rmi4: simplify NULL tests
Eva Rachel Retuya [Sat, 27 Feb 2016 12:39:23 +0000 (20:39 +0800)]
staging: ste_rmi4: simplify NULL tests

Replace direct comparisons to NULL i.e. 'x == NULL' with '!x' for
consistency. Coccinelle semantic patch used:

@@
identifier func;
expression x;
statement Z;
@@

x = func(...);

if (
(
+ !
x
- == NULL
|
+ !
- NULL ==
x
)
   ) Z

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: ste_rmi4: Add space around '/'
Dilek Uzulmez [Mon, 22 Feb 2016 23:01:07 +0000 (01:01 +0200)]
Staging: ste_rmi4: Add space around '/'

Add space around operator '/'. Problem found using checkpatch.pl
CHECK: spaces preferred around that '/' (ctx:VxV)

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: octeon: Fix braces in condition statement
Laura Garcia Liebana [Sat, 27 Feb 2016 23:47:09 +0000 (00:47 +0100)]
staging: octeon: Fix braces in condition statement

Braces should be used on all arms of the if statement. 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: octeon: Remove multiple blank lines
Laura Garcia Liebana [Sat, 27 Feb 2016 23:46:29 +0000 (00:46 +0100)]
staging: octeon: Remove multiple blank lines

Avoid the use of multiple blank lines. 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: octeon: Fix lines over 80 characters
Laura Garcia Liebana [Sat, 27 Feb 2016 23:45:13 +0000 (00:45 +0100)]
staging: octeon: Fix lines over 80 characters

The lines should be adjusted to 80 characters. 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: octeon: Remove blank lines after open brace
Laura Garcia Liebana [Sat, 27 Feb 2016 23:44:37 +0000 (00:44 +0100)]
staging: octeon: Remove blank lines after open brace

Blank lines are not necessary after an open brace. 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: octeon: Fix block comments
Laura Garcia Liebana [Sat, 27 Feb 2016 23:43:52 +0000 (00:43 +0100)]
staging: octeon: Fix block comments

Remove commented source code. 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: octeon: Remove comparison to NULL
Laura Garcia Liebana [Sat, 27 Feb 2016 23:43:12 +0000 (00:43 +0100)]
staging: octeon: Remove comparison to NULL

Comparison to NULL should be avoided in conditions. Chackpatch detected
these issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: octeon: Insert blank line after struct declaration
Laura Garcia Liebana [Sat, 27 Feb 2016 23:42:43 +0000 (00:42 +0100)]
staging: octeon: Insert blank line after struct declaration

Blank line is inserted after a struct declaration. 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: octeon: Move logical operators on the correct line
Laura Garcia Liebana [Sat, 27 Feb 2016 23:41:39 +0000 (00:41 +0100)]
staging: octeon: Move logical operators on the correct line

Logical continuations should be on the previous line. 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: octeon: Convert create_singlethread_workqueue()
Bhaktipriya Shridhar [Sat, 27 Feb 2016 17:51:47 +0000 (23:21 +0530)]
staging: octeon: Convert create_singlethread_workqueue()

With conccurency managed workqueues, use of dedicated workqueues can
be replaced by system_wq. Drop cvm_oct_poll_queue by using system_wq.

There are multiple work items per cvm_oct_poll_queue (viz.
cvm_oct_rx_refill_work, port_periodic_work) and different
cvm_oct_poll_queues need not be be ordered. Hence, concurrency
can be increased by switching to system_wq.

All work items are sync canceled in cvm_oct_remove() so it
is guaranteed that no work is in flight by the time exit path runs.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: slicoss: changes comparisons to NULL in slicoss.c
Ben Marsh [Tue, 1 Mar 2016 10:29:38 +0000 (11:29 +0100)]
Staging: slicoss: changes comparisons to NULL in slicoss.c

This is a patch to slicoss.c to change the style of NULL comparisons in
order to remove checkpatch.pl warnings.

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: slicoss: removes unnecessary blank lines in slicoss.c
Ben Marsh [Tue, 1 Mar 2016 10:22:48 +0000 (11:22 +0100)]
Staging: slicoss: removes unnecessary blank lines in slicoss.c

This is a patch to slicoss.c to remove unnecessary blank lines as found
by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: slicoss: change memory allocation style in slicoss.c
Ben Marsh [Tue, 1 Mar 2016 10:06:13 +0000 (11:06 +0100)]
Staging: slicoss: change memory allocation style in slicoss.c

This is a patch to slicoss.c to change the memory allocation style in
slicoss.c as found by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: slicoss: changes the style of memory allocation in slicoss.c
Ben Marsh [Tue, 1 Mar 2016 09:55:35 +0000 (10:55 +0100)]
Staging: slicoss: changes the style of memory allocation in slicoss.c

This is a patch to slicoss.c to change the memory allocation style as
identified by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: slicoss: changes memory allocation style in slicoss.c
Ben Marsh [Mon, 29 Feb 2016 11:37:34 +0000 (12:37 +0100)]
Staging: slicoss: changes memory allocation style in slicoss.c

This is a patch to slicoss.c that changes the memory allocation style as
identified by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: slicoss: memory allocation style change in slicoss.c
Ben Marsh [Mon, 29 Feb 2016 11:33:30 +0000 (12:33 +0100)]
Staging: slicoss: memory allocation style change in slicoss.c

This is a patch to slicoss.c to change the memory allocation style as
identified by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: slicoss: Eliminate commented out code
Janani Ravichandran [Sun, 21 Feb 2016 21:31:44 +0000 (16:31 -0500)]
staging: slicoss: Eliminate commented out code

Remove commented out code to reduce code clutter.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192u: ieee80211_crypt: Remove unnecessary else after return
Bhaktipriya Shridhar [Thu, 10 Mar 2016 17:17:22 +0000 (22:47 +0530)]
staging: rtl8192u: ieee80211_crypt: Remove unnecessary else after return

This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8192u: Replace random_ether_addr with eth_random_addr
Bhumika Goyal [Tue, 1 Mar 2016 19:44:57 +0000 (01:14 +0530)]
Staging: rtl8192u: Replace random_ether_addr with eth_random_addr

The macro random_ether_addr is calling the function eth_random_addr.
Therefore, the call to random_ether_addr can be replaced with
eth_random_addr.
Remove the wrapper function ieee80211_randomize_cell and replace its
call with eth_random_addr as it is wrapping random_ether_addr.
Done using coccinelle:

@@
expression addr;
@@
- random_ether_addr(addr);
+ eth_random_addr(addr);

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8192u: Replace memset with eth_broadcast_addr
Bhumika Goyal [Tue, 1 Mar 2016 18:48:31 +0000 (00:18 +0530)]
Staging: rtl8192u: Replace memset with eth_broadcast_addr

Use eth_broadcast_addr to assign the broadcast address to the given
address array instead of memset when the second argument is a broacast
address 0xff. ETH_ALEN is a macro with value 6, so 6 is treated as
ETH_ALEN if it is the third argument of memset.

Done using coccinelle.
@@
expression e;
@@
- memset(e,\(0xff\|0xFF\|255\),\(ETH_ALEN\|6\));
+ eth_broadcast_addr(e);

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192u: ieee80211: Remove unused variables
Bhaktipriya Shridhar [Sun, 28 Feb 2016 12:18:36 +0000 (17:48 +0530)]
staging: rtl8192u: ieee80211: Remove unused variables

The pointer *skb2 is declared 'globally' inside  ifdef NOT_YET.
It's used nowhere in the directory.
Another pointer *skb2 is declared 'locally', again inside another ifdef NOT_YET
in the function ieee80211_rx_frame_mgmt.
Hence, skb2 stays unused and has been removed.

This was done using Coccinelle:

@@ type T; identifier i; constant c; @@
-T i;
<... when != i
-i = c;
...>

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8192u: Remove debug messages
Bhumika Goyal [Wed, 24 Feb 2016 17:16:00 +0000 (22:46 +0530)]
Staging: rtl8192u: Remove debug messages

As kmalloc generates a backtrace on failure so there is no need of
these debug messages when kmalloc fails. Also remove unwanted {} around if
block after removal of these messages.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8192u: Clean up tests if NULL returned on failure
Bhumika Goyal [Wed, 24 Feb 2016 10:17:35 +0000 (15:47 +0530)]
Staging: rtl8192u: Clean up tests if NULL returned on failure

Some functions return Null as their return value on failure. !x is
generally preferred over x==NULL or NULL==x. So make use of !x if
the value returned on failure is NULL.
Done using coccinelle:
@@
expression e;
statement S;
@@
e = \(kmalloc\|devm_kzalloc\|kmalloc_array
     \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(...);
- if(e==NULL)
+ if(!e)
  S

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192u: ieee802111: Drop Useless Initialization
Bhaktipriya Shridhar [Tue, 23 Feb 2016 21:27:57 +0000 (02:57 +0530)]
staging: rtl8192u: ieee802111: Drop Useless Initialization

Removed initialisation of a varible if it is immediately reassigned.
Changes were made using Coccinelle.
@bad@
identifier i;
position p;
@@

i =@p <+...i...+>;

@@
type T;
constant C;
expression e;
identifier i;
position p != bad.p;
@@
T i
- = C
;
i =@p e;

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192u: ieee80211: Use macro DIV_ROUND_UP
Bhaktipriya Shridhar [Sun, 21 Feb 2016 10:13:00 +0000 (15:43 +0530)]
staging: rtl8192u: ieee80211: Use macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: goldfish: audio: fix compiliation on arm
Greg Hackmann [Fri, 26 Feb 2016 19:00:18 +0000 (19:00 +0000)]
staging: goldfish: audio: fix compiliation on arm

We do actually need slab.h, by luck we get it on other platforms but not
always on ARM. Include it properly.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: goldfish: audio: add devicetree bindings
Greg Hackmann [Fri, 26 Feb 2016 19:00:03 +0000 (19:00 +0000)]
staging: goldfish: audio: add devicetree bindings

Introduce devicetree bindings to the Goldfish staging audio driver.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192e: rtllib_crypt_tkip: Remove unnecessary else after return
Bhaktipriya Shridhar [Thu, 10 Mar 2016 17:13:34 +0000 (22:43 +0530)]
staging: rtl8192e: rtllib_crypt_tkip: Remove unnecessary else after return

This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8192e: Replace random_ether_addr with eth_random_addr
Bhumika Goyal [Tue, 1 Mar 2016 19:42:03 +0000 (01:12 +0530)]
Staging: rtl8192e: Replace random_ether_addr with eth_random_addr

The macro random_ether_addr is calling the function eth_random_addr.
Therefore, the call to random_ether_addr can be replaced with
eth_random_addr.
Remove the wrapper function rtllib_randomize_cell and replace its
call with eth_random_addr as it is wrapping random_ether_addr.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192e: Drop cast on void pointer
Janani Ravichandran [Thu, 25 Feb 2016 19:56:33 +0000 (14:56 -0500)]
staging: rtl8192e: Drop cast on void pointer

Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void *e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192e: rtl8192e: Remove create_workqueue()
Amitoj Kaur Chawla [Thu, 25 Feb 2016 03:53:31 +0000 (09:23 +0530)]
staging: rtl8192e: rtl8192e: Remove create_workqueue()

With conccurency managed workqueues, use of dedicated workqueues can
be replaced by system_wq. Drop priv_wq by using system_wq.

Since there are multiple work items per priv but they do not need
to be ordered, increase of concurrency by switching to system_wq
should not break anything.

All work items are sync canceled on so it is guaranteed that
no work is running when rtl92e_suspend function is called.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers: staging: rtl8192e: rtllib_rx.c: Fix blank lines before a close brace
Tapan Prakash T [Wed, 24 Feb 2016 17:36:12 +0000 (23:06 +0530)]
drivers: staging: rtl8192e: rtllib_rx.c: Fix blank lines before a close brace

Fixed checkpatch.pl issue 'Blank lines aren't necessary before a close
brace'

Signed-off-by: Tapan Prakash T <tapanprakasht@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers: staging: rtl8192e: rtllib_rx.c: Fix code indent for conditional statement
Tapan Prakash T [Wed, 24 Feb 2016 17:17:47 +0000 (22:47 +0530)]
drivers: staging: rtl8192e: rtllib_rx.c: Fix code indent for conditional statement

Fixed checkpatch.pl warning 'suspect code indent for conditional
statements'

Signed-off-by: Tapan Prakash T <tapanprakasht@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192e: Prefer using macro DIV_ROUND_UP
Bhaktipriya Shridhar [Tue, 8 Mar 2016 17:59:37 +0000 (23:29 +0530)]
staging: rtl8192e: Prefer using macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8192e: Remove create_workqueue()
Amitoj Kaur Chawla [Sat, 20 Feb 2016 10:06:26 +0000 (15:36 +0530)]
staging: rtl8192e: Remove create_workqueue()

With conccurency managed workqueues, use of dedicated workqueues can
be replaced by system_wq. Drop wq by using system_wq.

Since there are multiple work items per rtllib but they do not need to
be ordered, increase of concurrency by switching to system_wq should
not break anything.

All work items are sync canceled on rtllib_stop_protocol() so it is
guaranteed that no work is running when rtl92e_disable/reset/restart
functions are called.

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: wilc1000: Possible unnecessary 'out of memory' message
Anchal Jain [Fri, 11 Mar 2016 14:19:50 +0000 (19:49 +0530)]
staging: wilc1000: Possible unnecessary 'out of memory' message

Remove unnnecessary debug message.
Problem detected by checkpatch.

Signed-off-by: Anchal Jain <anchalj109@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: use mutex instead of semaphore sem_cfg_values
Chaehyun Lim [Tue, 8 Mar 2016 01:04:32 +0000 (10:04 +0900)]
staging: wilc1000: use mutex instead of semaphore sem_cfg_values

This patch replaces struct semaphore sem_cfg_values with struct mutex
cfg_values_lock. It is better to use mutex than semaphore.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: Use list_{next/prev}_entry instead of list_entry
Bhumika Goyal [Sun, 6 Mar 2016 14:56:58 +0000 (20:26 +0530)]
Staging: lustre: Use list_{next/prev}_entry instead of list_entry

This patch replace list_entry with list_{next/prev}_entry as it makes
the code more clear to read.
Done using coccinelle:

@@
expression e1;
identifier e3;
type t;
@@
(
- list_entry(e1->e3.next,t,e3)
+ list_next_entry(e1,e3)
|
- list_entry(e1->e3.prev,t,e3)
+ list_prev_entry(e1,e3)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: lnet: Use list_first_entry_or_null
Bhumika Goyal [Sun, 6 Mar 2016 14:38:44 +0000 (20:08 +0530)]
Staging: lustre: lnet: Use list_first_entry_or_null

This patch replaces list_empty and list_entry with
list_first_entry_or_null.
Done using coccinelle:

@@
expression e1,e2;
statement S;
@@
- if(!list_empty(...)){
  e2=
- list_entry(e1.next,
+ list_first_entry_or_null(&e1,
  ...);
+ if(e2){
...
}

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: hal: Remove useless return variables
Bhaktipriya Shridhar [Thu, 25 Feb 2016 12:04:43 +0000 (17:34 +0530)]
staging: rtl8723au: hal: Remove useless return variables

This patch removes unnecessary return variables and compresses the
return logic.
The coccinelle script that finds and fixes this issue is:
@@ type T; identifier i,f; constant C; @@
- T i;
...when != i
when strict
( return -C;
|
- i =
+ return
f(...);
- return i;
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8723au: Remove debug messages
Bhumika Goyal [Wed, 24 Feb 2016 17:04:31 +0000 (22:34 +0530)]
Staging: rtl8723au: Remove debug messages

As kmalloc generates a backtrace on failure so there is no need of these
debug messages when kmalloc fails. Also remove unwanted {} around if block
after removal of these messages.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8723au: Clean up tests if NULL returned on failure
Bhumika Goyal [Wed, 24 Feb 2016 10:23:57 +0000 (15:53 +0530)]
Staging: rtl8723au: Clean up tests if NULL returned on failure

Some functions like kmalloc/usb_alloc_urb returns Null as their return
value on failure. !x is generally preferred over x==NULL or NULL==x. So
make use of !x if the value returned on failure by these functions is NULL.
Done using coccinelle:

@@
expression e;
statement S;
@@
e = \(kmalloc\|devm_kzalloc\|kmalloc_array
     \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(...);
- if(e==NULL)
+ if(!e)
  S

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: Remove unnecessary parantheses
Bhaktipriya Shridhar [Mon, 22 Feb 2016 17:07:00 +0000 (22:37 +0530)]
staging: rtl8723au: Remove unnecessary parantheses

Removed parantheses on the right hand side of assignments as they are
not needed.

This was done with Coccinelle:

@@ expression a, b; @@

a =
- (
b
- )
;

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: core: rtw_recv: use list_first_entry()
Geliang Tang [Tue, 1 Mar 2016 15:35:33 +0000 (23:35 +0800)]
staging: rtl8723au: core: rtw_recv: use list_first_entry()

Use list_first_entry() instead of container_of() 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: core: rtw_xmit: use list_first_entry_or_null()
Geliang Tang [Tue, 1 Mar 2016 15:35:32 +0000 (23:35 +0800)]
staging: rtl8723au: core: rtw_xmit: use list_first_entry_or_null()

Use list_first_entry_or_null() instead of list_empty() + container_of()
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: core: rtw_recv: use list_first_entry_or_null()
Geliang Tang [Tue, 1 Mar 2016 15:35:31 +0000 (23:35 +0800)]
staging: rtl8723au: core: rtw_recv: use list_first_entry_or_null()

Use list_first_entry_or_null() instead of list_empty() + container_of()
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 agoRevert "staging: comedi: drivers: Remove unneeded NULL check before kfree()"
Greg Kroah-Hartman [Fri, 11 Mar 2016 03:35:54 +0000 (19:35 -0800)]
Revert "staging: comedi: drivers: Remove unneeded NULL check before kfree()"

This reverts commit 3545bee9b8ec00ba733e17363f494c8761fb5e49.

It's not correct.

Reported-by: Hartley Sweeten <HartleyS@visionengravers.com>
Cc: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_pcidio.c: Prefer using macro DIV_ROUND_UP
Bhaktipriya Shridhar [Wed, 9 Mar 2016 19:04:44 +0000 (00:34 +0530)]
staging: comedi: ni_pcidio.c: Prefer using macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt282x: Prefer using macro DIV_ROUND_UP
Bhaktipriya Shridhar [Wed, 9 Mar 2016 18:54:49 +0000 (00:24 +0530)]
staging: comedi: dt282x: Prefer using macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: rtd520: Prefer using macro DIV_ROUND_UP
Bhaktipriya Shridhar [Wed, 9 Mar 2016 18:49:38 +0000 (00:19 +0530)]
staging: comedi: rtd520: Prefer using macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: drivers: ni_mio_common: Prefer using macro DIV_ROUND_UP
Bhaktipriya Shridhar [Wed, 9 Mar 2016 18:35:16 +0000 (00:05 +0530)]
staging: comedi: drivers: ni_mio_common: Prefer using macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: drivers: amplc_pci230: Prefer using macro DIV_ROUND_UP
Bhaktipriya Shridhar [Wed, 9 Mar 2016 18:33:49 +0000 (00:03 +0530)]
staging: comedi: drivers: amplc_pci230: Prefer using macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: comedi: Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).
Sandhya Bankar [Sun, 6 Mar 2016 07:05:29 +0000 (12:35 +0530)]
Staging: comedi: Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).

Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: drivers: gsc_hpdi: Remove use of deprecated pci API
Amitoj Kaur Chawla [Sun, 6 Mar 2016 00:21:52 +0000 (05:51 +0530)]
staging: comedi: drivers: gsc_hpdi: Remove use of deprecated pci API

Replace pci_[alloc|free]_consistent occurences with
dma_[alloc|free]_coherent.

The Coccinelle semantic patch that was used to make some of these
changes is as follows:
@deprecated@
idexpression id;
position p;
@@

(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@bad1@
idexpression id;
position deprecated.p;
@@
...when != &id->dev
   when != pci_get_drvdata ( id )
   when != pci_enable_device ( id )
(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@depends on !bad1@
idexpression id;
expression direction;
position deprecated.p;
@@

(
- pci_dma_supported@p ( id,
+ dma_supported ( &id->dev,
...
+ , GFP_KERNEL
  )
|
- pci_alloc_consistent@p ( id,
+ dma_alloc_coherent ( &id->dev,
...
+ , GFP_KERNEL
  )
)

gsc_hpdi_auto_attach does not affect interrupt status but contains a
call to comedi_alloc_devpriv() which calls kzalloc with GFP_KERNEL flag.
Thus, there seems to be no danger that dma_alloc_coherent can be called
with interrupts turned off, and GFP_KERNEL can be used.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visornic: Remove unnecessary else after return
Bhaktipriya Shridhar [Thu, 10 Mar 2016 17:39:14 +0000 (23:09 +0530)]
staging: unisys: visornic: Remove unnecessary else after return

This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: clean up visorchannel_clear
David Kershner [Wed, 9 Mar 2016 02:28:28 +0000 (21:28 -0500)]
staging: unisys: visorbus: clean up visorchannel_clear

Goto label was ambiguous change to out_free_page to signify that
we will always go through the path even on success.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Timothy Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: cleanup gotos in visorchannel_create_guts
David Kershner [Wed, 9 Mar 2016 02:28:27 +0000 (21:28 -0500)]
staging: unisys: visorbus: cleanup gotos in visorchannel_create_guts

Away label is ambiguous change to it err_destroy_channel to make it
clear this is an error path.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Timothy Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: most: Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddre...
Sandhya Bankar [Sun, 6 Mar 2016 10:20:35 +0000 (15:50 +0530)]
Staging: most: Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddress & USB_DIR_IN).

Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddress & USB_DIR_IN) to check if the endpoint has IN direction.
This correction is based on following semantic patch,

@@
struct usb_endpoint_descriptor *endpoint;
expression E;
@@

(
- endpoint->bEndpointAddress & USB_DIR_IN
+ usb_endpoint_dir_in(endpoint)
|
- endpoint->bEndpointAddress == USB_DIR_IN
+ usb_endpoint_dir_in(endpoint)
|
- (endpoint->bEndpointAddress & E) == USB_DIR_IN
+ usb_endpoint_dir_in(endpoint)
)

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: most: Use list_first_entry instead of list_entry
Bhumika Goyal [Sun, 6 Mar 2016 15:36:47 +0000 (21:06 +0530)]
Staging: most: Use list_first_entry instead of list_entry

This patch replaces list_entry with list_first_entry as it makes the
code more clear.
Done using coccinelle:

@@
expression e;
@@
(
- list_entry(e->next,
+ list_first_entry(e,
  ...)
|
- list_entry(e->prev,
+ list_last_entry(e,
  ...)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorinput: convert pr_err() to dev_err()
Eva Rachel Retuya [Sat, 5 Mar 2016 15:16:17 +0000 (23:16 +0800)]
staging: unisys: visorinput: convert pr_err() to dev_err()

Replace pr_err() calls with respective dev_err() counterpart.
Semantic patch used to detect and apply the transformation:

@r exists@
identifier f,s,i;
position p;
@@

f(...,struct s *i,...) {
  <+...
  pr_err@p(...)
  ...+>
}

@s@
identifier r.s, dev;
@@

struct s {
...
struct device dev;
...
};

@t@
identifier r.i, s.dev;
expression fmt;
position r.p;
@@

- pr_err@p(
+ dev_err(&i->dev,
fmt, ...);

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: most: Replace pr_err with dev_err
Bhumika Goyal [Sat, 5 Mar 2016 13:46:40 +0000 (19:16 +0530)]
Staging: most: Replace pr_err with dev_err

All devm functions has a device structure as the first argument which is
required by dev_{err,info,dbg} printing functions.
This patch converts pr_err to dev_err as dev_* is preferred after calls
to devm functions.

Done using coccinelle:

@r1 exists@
expression e,e1;
identifier f =~ "^devm_";
identifier g =~ "^pcim_";
identifier h =~ "^dmam_";
@@
e=\(f\|g\|h\)(e1,...);
<+...
(
- pr_info(
+ dev_info(e1,
   ...);
|
- pr_err(
+ dev_err(e1,
  ...);
|
- pr_debug(
+ dev_dbg(e1,
  ...);
)
...+>

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>