]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
8 years agostaging: lustre: osc: Use list_for_each_entry_safe
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:06:51 +0000 (01:36 +0530)]
staging: lustre: osc: Use list_for_each_entry_safe

Doubly linked lists which are  iterated  using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.

This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.

This was done with Coccinelle.

@@
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@

T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: lnet: api-ni: Use list_for_each_entry_safe
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:05:29 +0000 (01:35 +0530)]
staging: lustre: lnet: api-ni: Use list_for_each_entry_safe

Doubly linked lists which are  iterated  using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.

This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.

This was done with Coccinelle.

@@
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@

T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: lnet: peer: Use list_for_each_entry_safe
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:03:46 +0000 (01:33 +0530)]
staging: lustre: lnet: peer: Use list_for_each_entry_safe

Doubly linked lists which are  iterated  using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.

This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.

This was done with Coccinelle.

@@
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@

T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: lnet: config: Use list_for_each_entry_safe
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:03:03 +0000 (01:33 +0530)]
staging: lustre: lnet: config: Use list_for_each_entry_safe

Doubly linked lists which are  iterated  using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.

This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.

This was done with Coccinelle.

@@
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@

T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: lnet: router: Use list_for_each_entry_safe
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:02:13 +0000 (01:32 +0530)]
staging: lustre: lnet: router: Use list_for_each_entry_safe

Doubly linked lists which are  iterated  using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.

This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.

This was done with Coccinelle.

@@
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@

T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: lnet: conrpc: Use list_for_each_entry_safe
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:01:20 +0000 (01:31 +0530)]
staging: lustre: lnet: conrpc: Use list_for_each_entry_safe

Doubly linked lists which are  iterated  using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.

This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.

This was done with Coccinelle.

@@
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@

T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: lnet: lib-move: Use list_for_each_entry_safe
Bhaktipriya Shridhar [Fri, 11 Mar 2016 20:00:15 +0000 (01:30 +0530)]
staging: lustre: lnet: lib-move: Use list_for_each_entry_safe

Doubly linked lists which are  iterated  using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.

This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.

This was done with Coccinelle.

@@
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@

T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: obdclass: Use list_for_each_entry_safe
Bhaktipriya Shridhar [Fri, 11 Mar 2016 19:59:21 +0000 (01:29 +0530)]
staging: lustre: obdclass: Use list_for_each_entry_safe

Doubly linked lists which are  iterated  using list_empty
and list_entry macros have been replaced with list_for_each_entry_safe
macro.
This makes the iteration simpler and more readable.

This patch replaces the while loop containing list_empty and list_entry
with list_for_each_entry_safe.

This was done with Coccinelle.

@@
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@

T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: addac: Remove unnecessary else after return
Bhaktipriya Shridhar [Thu, 10 Mar 2016 17:11:53 +0000 (22:41 +0530)]
staging: iio: addac: 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: iio: Fixed block comments warning
Georgiana Chelu [Mon, 7 Mar 2016 08:31:54 +0000 (10:31 +0200)]
Staging: iio: Fixed block comments warning

Fixed the following warning:
WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: iio: ade7854: Remove unnecessary goto.
Sandhya Bankar [Sun, 6 Mar 2016 13:21:55 +0000 (18:51 +0530)]
Staging: iio: ade7854: 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: iio: ade7758_core: Remove unnecessary goto.
Sandhya Bankar [Sun, 6 Mar 2016 13:18:47 +0000 (18:48 +0530)]
Staging: iio: ade7758_core: 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: iio: ade7754: Remove unnecessary goto.
Sandhya Bankar [Sun, 6 Mar 2016 13:14:59 +0000 (18:44 +0530)]
Staging: iio: ade7754: 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: iio: adc: Replace of_iomap() with devm_ioremap_resource()
Amitoj Kaur Chawla [Mon, 29 Feb 2016 07:33:46 +0000 (13:03 +0530)]
staging: iio: adc: Replace of_iomap() with devm_ioremap_resource()

The adc driver uses of_iomap() which doesn't request the resource and
isn't device managed so error handling is needed. of_iomap() is mainly
used in cases where there is no driver or struct device so a switch to
devm_ functions is required.

This patch switches to use devm_ioremap_resource() instead which
automatically requests the resource and is freed when the driver
detaches.

Removed the error handling to unmap I/O registers i.e.
iounmap() in probe and remove functions of this driver and
consequently removed an unnecessary label.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: ade7854: use devm_iio_device_register
Alison Schofield [Sun, 28 Feb 2016 08:22:50 +0000 (00:22 -0800)]
staging: iio: ade7854: use devm_iio_device_register

Replace iio_device_register with the device managed version.
This change is safe because it does not change the order of
any device removal actions. Unregistering the device was the
only removal action. The newly emptied .remove functions are
deleted.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: adt7316: remove useless initialization
Alison Schofield [Wed, 24 Feb 2016 06:18:50 +0000 (22:18 -0800)]
staging: iio: adt7316: remove useless initialization

Remove the initialization of a variable that is immediately
reassigned.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: iio: light: tsl2x7x: remove useless initialization
Alison Schofield [Wed, 24 Feb 2016 06:18:01 +0000 (22:18 -0800)]
staging: iio: light: tsl2x7x: remove useless initialization

Remove the initialization of a variable that is immediately
reassigned.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8723au: Remove unused functions and prototype
Bhumika Goyal [Fri, 11 Mar 2016 06:58:50 +0000 (12:28 +0530)]
Staging: rtl8723au: Remove unused functions and prototype

The functions rtw_ap_inform_ch_switch23a, rtw_acl_remove_sta23a and
rtw_acl_add_sta23a are not used anywhere in the kernel. So remove their
definition and prototype.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agotaging: rtl8723au: Remove empty function odm_Init_RSSIForDM23a
Bhumika Goyal [Fri, 11 Mar 2016 06:58:51 +0000 (12:28 +0530)]
taging: rtl8723au: Remove empty function odm_Init_RSSIForDM23a

The function odm_Init_RSSIForDM23a is empty and therefore there is no use
of keeping it. Also, remove its prototype.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: hal: Remove unnecessary function and its call
Bhaktipriya Shridhar [Thu, 10 Mar 2016 18:01:22 +0000 (23:31 +0530)]
staging: rtl8723au: hal: Remove unnecessary function and its call

The function odm_DynamicBBPowerSaving23a on being called, simply returns
back. The function hasn't been mentioned in the TODO and doesn't have FIXME
code around. Hence, odm_DynamicBBPowerSaving23a and its calls have been
removed.

This was done using Coccinelle.

@@
identifier f;
@@

void f(...) {

-return;

}

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: core: Remove unnecessary else after return
Bhaktipriya Shridhar [Thu, 10 Mar 2016 17:00:07 +0000 (22:30 +0530)]
staging: rtl8723au: core: 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: rtl8723au: hal: Use macro DIV_ROUND_UP
Bhaktipriya Shridhar [Tue, 8 Mar 2016 17:58:13 +0000 (23:28 +0530)]
staging: rtl8723au: hal: 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: rtl8723au: core: rtw_security: Change form of NULL comparisons
Bhaktipriya Shridhar [Sat, 5 Mar 2016 21:19:46 +0000 (02:49 +0530)]
staging: rtl8723au: core: rtw_security: 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: rtl8723au: core: rtw_sta_mgt: Change form of NULL comparisons
Bhaktipriya Shridhar [Sat, 5 Mar 2016 21:17:23 +0000 (02:47 +0530)]
staging: rtl8723au: core: rtw_sta_mgt: 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 agodrivers: staging: rtl8723au: remove unneeded null test
Cihangir Akturk [Fri, 4 Mar 2016 13:43:10 +0000 (15:43 +0200)]
drivers: staging: rtl8723au: remove unneeded null test

null test on pnetwork removed, because the iterator variable
list_for_each_entry_safe cannot be null.

This commit fixes the following error reported by coccinelle:

drivers/staging/rtl8723au/core/rtw_mlme.c:1621:7-15: ERROR: iterator
variable bound on line 1620 cannot be NULL

Signed-off-by: Cihangir Akturk <cakturk@gmail.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 macro
Bhaktipriya Shridhar [Tue, 1 Mar 2016 17:33:30 +0000 (23:03 +0530)]
staging: rtl8723au: hal: Remove Unused macro

PlatformIndicateBTACLData is an unused macro. Hence, removed.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: fix static checker warning
Geliang Tang [Tue, 1 Mar 2016 15:22:23 +0000 (23:22 +0800)]
staging: rtl8723au: fix static checker warning

Fix the following static checker warning:

 drivers/staging/rtl8723au/core/rtw_sta_mgt.c:365 rtw_get_stainfo23a()
 error: potential NULL dereference 'psta'.

Fixes: e280d71("staging: rtl8723au: use list_for_each_entry*()")
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8723au: Remove print statements and debug messages
Bhumika Goyal [Sun, 28 Feb 2016 17:25:29 +0000 (22:55 +0530)]
Staging: rtl8723au: Remove print statements and debug messages

The  memory allocation functions generates a call stack containing
all the context information on failure, so print statements and debug
messages can be removed on failure of these functions. Also remove
unwanted {} around if block after removal of these messages.
Done using coccinelle:

@@
expression e;
@@

e=\(kmalloc\|kmalloc\|kmalloc_array\|alloc_netdev\|kzalloc\|
   devm_kzalloc\|devm_ioremap\)(...);
...
if(!e){
- \(DBG_8723A\|printk\|pr_err\|CERROR\|DBG_88E\)(...);
...when any
}

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8723au: Eliminate commented out code
Janani Ravichandran [Sun, 28 Feb 2016 18:39:13 +0000 (13:39 -0500)]
staging: rtl8723au: Eliminate commented out code

Reduce code clutter by removing commented out code.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8723au: Use min macro instead of ternary operator
Bhumika Goyal [Fri, 26 Feb 2016 10:04:30 +0000 (15:34 +0530)]
Staging: rtl8723au: Use min macro instead of ternary operator

This patch replaces ternary operator with macro min as it shorter and
thus increases code readability. Macro min return 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: rtl8723au: core: Remove CamelCase
Janani Ravichandran [Thu, 25 Feb 2016 19:02:56 +0000 (14:02 -0500)]
staging: rtl8723au: core: Remove CamelCase

Remove CamelCase on the variable FunctionContext.

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

Void pointers don't need to 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: fsl-mc: Replace pr_err with dev_err
Bhumika Goyal [Fri, 4 Mar 2016 13:45:55 +0000 (19:15 +0530)]
Staging: fsl-mc: Replace pr_err with dev_err

This patch replaces pr_err calls with dev_err when the device structure
is available as dev_* prints identifying information about the struct device.
Done using coccinelle:

@r exists@
identifier f, s;
identifier x;
position p;
@@
f(...,struct s *x,...) {
<+...
when != x == NULL
\(pr_err@p\|pr_debug@p\|pr_info\)(...);
...+>
}

@r2@
identifier fld2;
identifier r.s;
@@

struct s {
        ...
        struct device *fld2;
        ...
};

@@
identifier r.x,r2.fld2;
position r.p;
@@

(
-pr_err@p
+dev_err
   (
+ &x->fld2,
...)
|
- pr_debug@p
+ dev_dbg
   (
+ &x->fld2,
...)
|
- pr_info@p
+ dev_info
   (
+ &x->fld2,
...)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: fsl-mc: Replace pr_debug with dev_dbg
Bhumika Goyal [Fri, 4 Mar 2016 13:44:52 +0000 (19:14 +0530)]
Staging: fsl-mc: Replace pr_debug with dev_dbg

This patch replaces pr_debug calls with dev_dbg when the device structure
is available as dev_* prints identifying information about the struct
device.
Done using coccinelle:

@r exists@
identifier f, s;
identifier x;
position p;
@@
f(...,struct s *x,...) {
<+...
when != x == NULL
\(pr_err@p\|pr_debug@p\|pr_info\)(...);
...+>
}

@r2@
identifier fld2;
identifier r.s;
@@

struct s {
        ...
        struct device *fld2;
        ...
};

@@
identifier r.x,r2.fld2;
position r.p;
@@

(
-pr_err@p
+dev_err
   (
+ &x->fld2,
...)
|
- pr_debug@p
+ dev_dbg
   (
+ &x->fld2,
...)
|
- pr_info@p
+ dev_info
   (
+ &x->fld2,
...)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: bus: Eliminate double function call
Bhaktipriya Shridhar [Sun, 28 Feb 2016 18:28:05 +0000 (23:58 +0530)]
staging: fsl-mc: bus: Eliminate double function call

A call to irq_find_matching_host was already made and the result
has been stored in mc_msi_domain. mc_msi_domain is again reassigned
using the same function call which is redundant.

irq_find_matching_host returns/locates a domain for a given fwnode.
The domain is identified using device node and bus_token(if several
domains have same device node but different purposes they can be
distinguished using bus-specific token).
http://www.bricktou.com/include/linux/irqdomain_irq_find_matching_host_en.html

Also, of_property_read_bool finds and reads a boolean from a property
device node from which the property value is to be read. It doesn't
alter the device node.
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-February/083698.html

Since, both  the function calls have the same device node and bus_token,
the return values shall be the same. Hence, the second call has been
removed.

This was done using Coccinelle:

@r@
idexpression *x;
identifier f;
position p1,p2;
@@

x@p1 = f(...)
... when != x
(
x@p2 = f(...)
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

if (p1[0].line == p2[0].line):
  cocci.include_match(False)

@@
idexpression *x;
identifier f;
position r.p1,r.p2;
@@

*x@p1 = f(...)
...
*x@p2 = f(...)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fsl-mc: Drop unneeded void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 19:46:11 +0000 (14:46 -0500)]
staging: fsl-mc: 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: android: ashmem.c: Convert macros page_range_{subsumes/subsumed_by/in}_range...
Bhumika Goyal [Fri, 11 Mar 2016 14:03:05 +0000 (19:33 +0530)]
Staging: android: ashmem.c: Convert macros page_range_{subsumes/subsumed_by/in}_range to static inline function

Convert macros page_range_{subsumes/subsumed_by/in}_range to static
inline function as static inline functions are preferred over macros.
The change can be done as the arguments at all call sites have the same
type. Also, all three macro have same type of arguments and return
values so they can converted using a common semantic patch.

@r@
identifier f;
expression e;
@@
#define f(...) e

@r2@
identifier r.f;
identifier range,start,end;
expression r.e;
@@
- #define f(range,start,end) e
+ static inline int f(struct ashmem_range *range, size_t start, size_t end)
+{
+ return e;
+}

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: android: ashmem.c: Redefine macros as static inline functions
Bhumika Goyal [Fri, 11 Mar 2016 14:03:04 +0000 (19:33 +0530)]
Staging: android: ashmem.c: Redefine macros as static inline functions

Convert macros page_in_range and range_before_page into static inline
functions as static inline functions are preferred over macros. The
change can be done as the arguments at all call sites have the same type.
Also, both the macros have same type of arguments and return
values.
Done using coccinelle:

@r@
identifier f;
expression e;
@@
#define f(...) e

@r1@
identifier r.f;
identifier range,page;
expression r.e;
@@
- #define f(range,page) e
+ static inline int f(struct ashmem_range *range, size_t page)
+ {
+ return e;
+ }

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: android: Use devm_kcalloc instead of devm_kzalloc
Amitoj Kaur Chawla [Thu, 25 Feb 2016 14:51:20 +0000 (20:21 +0530)]
staging: android: Use devm_kcalloc instead of devm_kzalloc

Replace devm_kzalloc with devm_kcalloc to ensure there are no integer
overflows from the multiplication of a number * sizeof.

The following Coccinelle semantic patch was used to make this change:
//<smpl>
@@
expression dev,E1,E2,E3;
@@
- devm_kzalloc(dev,E1*sizeof(E2),E3)
+ devm_kcalloc(dev,E1,sizeof(E2),E3)
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: android: Replace min_t/max_t with min/max
Amitoj Kaur Chawla [Thu, 25 Feb 2016 02:48:52 +0000 (08:18 +0530)]
staging: android: Replace min_t/max_t with min/max

Replace min_t/max_t with min/max when both variables are of the same
type.

The Coccinelle semantic patch used to make this change is as follows:
@@
type T;
T a,b;
@@
- min_t(T, a, b)
+ min(a, b)
@@
type T;
T a,b;
@@
- max_t(T, a, b)
+ max(a, b)

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: android: ion: tegra: Replace IS_ERR_OR_NULL with IS_ERR
Amitoj Kaur Chawla [Thu, 25 Feb 2016 14:22:27 +0000 (19:52 +0530)]
staging: android: ion: tegra: Replace IS_ERR_OR_NULL with IS_ERR

Replace IS_ERR_OR_NULL test with an IS_ERR test since
ion_device_create() function returns a valid device or a -PTR_ERR
only as evidenced by the comment on the function prototype.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: android: ion: tegra: Use devm_kcalloc instead of devm_kzalloc
Amitoj Kaur Chawla [Thu, 25 Feb 2016 13:55:04 +0000 (19:25 +0530)]
staging: android: ion: tegra: Use devm_kcalloc instead of devm_kzalloc

Replace devm_kzalloc with devm_kcalloc to ensure there are no integer
overflows from the multiplication of a number * sizeof.

The following Coccinelle semantic patch was used to make this change:
//<smpl>
@@
expression dev,E1,E3;
type T;
@@
- devm_kzalloc(dev,E1*sizeof(T),E3)
+ devm_kcalloc(dev,E1,sizeof(T),E3)
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: android: ion: hisilicon: Remove useless return variables
Bhaktipriya Shridhar [Thu, 25 Feb 2016 11:54:17 +0000 (17:24 +0530)]
staging: android: ion: hisilicon: 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: android: change memory allocation style in ion_carveout_heap.c
Ben Marsh [Wed, 24 Feb 2016 12:42:18 +0000 (13:42 +0100)]
Staging: android: change memory allocation style in ion_carveout_heap.c

This is a patch for ion_carveout_heap.c that changes the memory
allocation style in order to remove a checkpatch.pl warning.

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: Android: align code with open parenthesis in ion_carveout_heap.c
Ben Marsh [Wed, 24 Feb 2016 12:35:50 +0000 (13:35 +0100)]
Staging: Android: align code with open parenthesis in ion_carveout_heap.c

This is a patch to ion_carveout_heap.c that alligns code with open
parenthesis to remove a checkpatch.pl warning.

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: Android: change memory allocation style in ion_carveout_heap.c
Ben Marsh [Wed, 24 Feb 2016 12:26:16 +0000 (13:26 +0100)]
Staging: Android: change memory allocation style in ion_carveout_heap.c

This is a patch to ion_carveout_heap.c to change the memory allocation
style in order to remove a checkpatch.pl warning.

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging/android/ion : fix a race condition in the ion driver
EunTaik Lee [Wed, 24 Feb 2016 04:38:06 +0000 (04:38 +0000)]
staging/android/ion : fix a race condition in the ion driver

There is a use-after-free problem in the ion driver.
This is caused by a race condition in the ion_ioctl()
function.

A handle has ref count of 1 and two tasks on different
cpus calls ION_IOC_FREE simultaneously.

cpu 0                                   cpu 1
-------------------------------------------------------
ion_handle_get_by_id()
(ref == 2)
                            ion_handle_get_by_id()
                            (ref == 3)

ion_free()
(ref == 2)

ion_handle_put()
(ref == 1)

                            ion_free()
                            (ref == 0 so ion_handle_destroy() is
                            called
                            and the handle is freed.)

                            ion_handle_put() is called and it
                            decreases the slub's next free pointer

The problem is detected as an unaligned access in the
spin lock functions since it uses load exclusive
 instruction. In some cases it corrupts the slub's
free pointer which causes a mis-aligned access to the
next free pointer.(kmalloc returns a pointer like
ffffc0745b4580aa). And it causes lots of other
hard-to-debug problems.

This symptom is caused since the first member in the
ion_handle structure is the reference count and the
ion driver decrements the reference after it has been
freed.

To fix this problem client->lock mutex is extended
to protect all the codes that uses the handle.

Signed-off-by: Eun Taik Lee <eun.taik.lee@samsung.com>
Reviewed-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: emxx_udc: Return NULL instead of 0.
Sandhya Bankar [Sun, 6 Mar 2016 10:36:18 +0000 (16:06 +0530)]
Staging: emxx_udc: Return NULL instead of 0.

Return NULL instead of 0 from nbu2ss_ep_alloc_request(),if req pointer is NULL.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: netlogic: Replace pr_* with netdev_*
Amitoj Kaur Chawla [Mon, 7 Mar 2016 15:39:30 +0000 (21:09 +0530)]
staging: netlogic: Replace pr_* with netdev_*

Replace generic pr_info and pr_err with netdev_info and netdev_err
respectively for net devices.

Found using Coccinelle. The semantic patch used to find this is as
follows:
//<smpl>
@@
expression e;
identifier f,i;
position p;
@@
f(...,struct net_device *i,...) {
...
(
-  pr_debug@p (e)
+  netdev_dbg(i, e)
|
- pr_err@p (e)
+ netdev_err(i, e)
|
- pr_info@p (e)
+ netdev_info(i, e)
)
...
}
@@
expression e;
identifier f,i;
position p;
@@

f(...) {
...
struct net_device *n;
...
(
-  pr_debug@p (e)
+  netdev_dbg(n, e)
|
- pr_err@p (e)
+ netdev_err(n, e)
|
- pr_info@p (e)
+ netdev_info(n, e)
)
...
}
@a@
identifier s,x;
@@
struct s {
 ...
struct net_device *x;
 ...
};

@b depends on a@
expression e;
identifier f,i,a.s,a.x;
position p;
@@

f ( ..., struct s *i, ...) {
  ...
(
-  pr_debug@p (e)
+  netdev_dbg(i->x, e)
|
- pr_err@p (e)
+ netdev_err(i->x, e)
|
- pr_info@p (e)
+ netdev_info(i->x, e)
)
  ...
}

@c depends on a@
expression e;
identifier f,i,a.s,a.x;
position p;
@@

f (...) {
  ...
struct s *i = ...;
  ...
(
-  pr_debug@p (e)
+  netdev_dbg(i->x, e)
|
- pr_err@p (e)
+ netdev_err(i->x, e)
|
- pr_info@p (e)
+ netdev_info(i->x, e)
)
  ...
}
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: netlogic: Drop unneeded void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 19:09:22 +0000 (14:09 -0500)]
staging: netlogic: 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: netlogic: Simplify use of devm_ioremap_resource
Amitoj Kaur Chawla [Tue, 23 Feb 2016 16:42:16 +0000 (22:12 +0530)]
staging: netlogic: Simplify use of devm_ioremap_resource

Remove unneeded error handling on the result of a call to
platform_get_resource when the value is passed to
devm_ioremap_resource.

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

// <smpl>
@@
expression pdev,res,n,e,e1;
expression ret != 0;
identifier l;
@@

- res = platform_get_resource(pdev, IORESOURCE_MEM, n);
  ... when != res
- if (res == NULL) { ... \(goto l;\|return ret;\) }
  ... when != res
+ res = platform_get_resource(pdev, IORESOURCE_MEM, n);
  e = devm_ioremap_resource(e1, res);
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: gdm72xx: Remove gdm72xx driver
Shraddha Barke [Sat, 5 Mar 2016 19:25:31 +0000 (00:55 +0530)]
Staging: gdm72xx: Remove gdm72xx driver

Remove support for gdm72xx driver from the kernel since Wimax is dead.
[1] http://www.networkworld.com/article/2220370/4g/wimax-is-dead.html
[2] http://www.androidcentral.com/sprint-confirms-wimax-shutdown-november-6-2015

Chrome OS can distribute this driver alongside their library.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: skein: threefish_block: Use rol64
Joe Perches [Thu, 10 Mar 2016 11:43:22 +0000 (03:43 -0800)]
staging: skein: threefish_block: Use rol64

Use the inline instead of direct code to improve readability
and shorten the code a little.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: xgifb: remove useless blank lines
Ben Marsh [Fri, 11 Mar 2016 19:40:40 +0000 (20:40 +0100)]
Staging: xgifb: remove useless blank lines

This is a patch to XGI_main_26.c that removes useless blanklines as
flagged by checkpatch.pl

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: xgifb: Avoid multiple blank lines
Rehas Sachdeva [Fri, 26 Feb 2016 12:17:51 +0000 (17:47 +0530)]
staging: xgifb: Avoid multiple blank lines

This patch removes the checkpatch.pl warnings regarding multiple blank
lines as single blank line is the preferred coding style.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: wlan-ng: Do not print message if kzalloc() failed.
Sandhya Bankar [Mon, 7 Mar 2016 12:22:37 +0000 (17:52 +0530)]
Staging: wlan-ng: Do not print message if kzalloc() failed.

Do not print message if kzalloc() failed.
kzalloc() has its own messages. So no need to add extra one.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: wlan-ng: Handle error condition.
Sandhya Bankar [Mon, 7 Mar 2016 10:45:59 +0000 (16:15 +0530)]
Staging: wlan-ng: Handle error condition.

Handle error condition.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wlan-ng: simplify NULL tests
Eva Rachel Retuya [Sat, 27 Feb 2016 12:39:25 +0000 (20:39 +0800)]
staging: wlan-ng: 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: wlan-ng: prism2sta.c: Drop unneeded void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 19:33:59 +0000 (14:33 -0500)]
staging: wlan-ng: prism2sta.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: wlan-ng: prism2mgmt.c: Drop void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 19:22:27 +0000 (14:22 -0500)]
staging: wlan-ng: prism2mgmt.c: Drop void pointer cast

Void pointers don't need to 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: wlan-ng: prism2mib.c: Drop void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 19:17:50 +0000 (14:17 -0500)]
staging: wlan-ng: prism2mib.c: Drop void pointer cast

Void pointers don't need to 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: wlan-ng: Drop void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 19:13:24 +0000 (14:13 -0500)]
staging: wlan-ng: 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: wlan-ng: Remove unnecessary macro
Amitoj Kaur Chawla [Wed, 24 Feb 2016 16:25:49 +0000 (21:55 +0530)]
staging: wlan-ng: Remove unnecessary macro

Remove unnecessary macro SUBMIT_URB by replacing it with a direct call
to usb_submit_urb()

This change was made with the help of the following Coccinelle semantic
patch:

//<smpl>
@@
identifier f,g;
@@
* #define f(...) g(...)
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: gs_fpgaboot: drop wrapper function 'finish_driver'
Eva Rachel Retuya [Wed, 2 Mar 2016 14:23:46 +0000 (22:23 +0800)]
staging: gs_fpgaboot: drop wrapper function 'finish_driver'

Remove the function 'finish_driver' since a direct call to
platform_device_unregister() is intuitive enough to signify the original
intention of the function being removed. Coccinelle semantic patch used to
detect this:

@@
identifier wrapper, func;
type T;
@@

*T wrapper(...)
{
(
return func(...);
|
func(...);
)
}

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: cleanup properly
Sudip Mukherjee [Sat, 27 Feb 2016 12:03:35 +0000 (17:33 +0530)]
staging: dgnc: cleanup properly

dgnc_cleanup_module() was called when the module unloaded to do a total
cleanup and it was also called if pci_register_driver() fails. But
dgnc_cleanup_module() will try dgnc_remove_driver_sysfiles() but the
sysfiles will be created only if pci_register_driver() succeeds.
So if pci_register_driver() fails and we try dgnc_cleanup_module() then we
were getting:

[  942.001479] BUG: unable to handle kernel NULL pointer dereference at 00000018
[  942.001482] IP: [<c122c7a8>] sysfs_remove_file_ns+0x8/0x20

with part of the call trace as:

[  942.001544] Call Trace:
[  942.001555]  [<c149acc6>] driver_remove_file+0x16/0x20
[  942.001571]  [<f864a708>] dgnc_remove_driver_sysfiles+0x18/0x40 [dgnc]
[  942.001575]  [<f8643ac7>] dgnc_cleanup_module+0x47/0x260 [dgnc]
[  942.001577]  [<f86cb000>] ? 0xf86cb000
[  942.001580]  [<f86cb1e6>] dgnc_init_module+0x1e6/0x1000 [dgnc]

Lets have a separate cleanup function which will execute
dgnc_remove_driver_sysfiles() depending on the argument passed to it.

Reported-by: Navy Cheng <navych@126.com>
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: unregister pci driver
Sudip Mukherjee [Sat, 27 Feb 2016 12:03:34 +0000 (17:33 +0530)]
staging: dgnc: unregister pci driver

We may choose to load the module without the hardware present. That will
register the pci driver but since probe will not succeed so
dgnc_NumBoards will be 0. Now if we unload the module then the pci
driver stays registered as dgnc_NumBoards is 0. And if we try to load
the module again it fails with the error:
"Driver 'dgnc' is already registered."

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: remove pci_unregister_driver
Sudip Mukherjee [Sat, 27 Feb 2016 12:03:33 +0000 (17:33 +0530)]
staging: dgnc: remove pci_unregister_driver

If pci_register_driver() fails then dgnc_NumBoards can never be more
than zero. dgnc_NumBoards is incremented only at the end of a successful
probe. And moreover if the pci driver has failed to register then we
never need to unregister it. Lets just print the warning, perform the
cleanup and exit with the error code.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: remove unneeded else
Sudip Mukherjee [Sat, 27 Feb 2016 12:03:32 +0000 (17:33 +0530)]
staging: dgnc: remove unneeded else

If pci_enable_device() fails then we can return directly.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: Break line after boolean operator
Rehas Sachdeva [Fri, 26 Feb 2016 15:59:41 +0000 (21:29 +0530)]
staging: dgnc: Break line after boolean operator

The preferred way to break up long math lines is to break after an arthimetic
or boolean operator. This patch fixes the checkpatch.pl warning:
Logical continuations should be on the previous line.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: Fix block comment style
Rehas Sachdeva [Fri, 26 Feb 2016 15:59:20 +0000 (21:29 +0530)]
staging: dgnc: Fix block comment style

This patch fixes the block comment style.
1. The checkpatch.pl warning:
Block comments use a trailing */ on a separate line.
2. '====' separator is unnecessary and should not be used.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: Avoid multiple blank lines
Rehas Sachdeva [Fri, 26 Feb 2016 15:57:16 +0000 (21:27 +0530)]
staging: dgnc: Avoid multiple blank lines

This patch fixes the checkpatch.pl warnings regarding multiple blank
lines as single blank line is the preferred coding style.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: Add spaces around '|' and '<<'
Rehas Sachdeva [Fri, 26 Feb 2016 15:56:43 +0000 (21:26 +0530)]
staging: dgnc: Add spaces around '|' and '<<'

One space on either side of binary and ternary operators is preferred.
This patch fixes the related checkpatch.pl warnings.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: dgnc: delete parentheses around right hand side of assignment
Eva Rachel Retuya [Tue, 23 Feb 2016 16:34:56 +0000 (00:34 +0800)]
staging: dgnc: delete parentheses around right hand side of assignment

Eliminate unneeded parentheses around the right hand side of an
assignment. Coccinelle semantic patch used:
@@
expression e1, e2;
identifier v;
@@

(
 v = (e1 == e2)
|
 v = (e1 != e2)
|
 v = (e1 <= e2)
|
 v = (e1 >= e2)
|
 v =
- (
e1
- )
)

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vme: devices: Replace kzalloc with devm_kzalloc
Amitoj Kaur Chawla [Mon, 22 Feb 2016 20:22:33 +0000 (01:52 +0530)]
staging: vme: devices: 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, 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: fbtft: fb_uc1611.c: Drop void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 18:44:39 +0000 (13:44 -0500)]
staging: fbtft: fb_uc1611.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: fbtft: fb_ra8875.c: Remove unneeded void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 18:39:55 +0000 (13:39 -0500)]
staging: fbtft: fb_ra8875.c: Remove 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: fbtft: fbtft-bus.c: Drop unneeded void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 18:34:28 +0000 (13:34 -0500)]
staging: fbtft: fbtft-bus.c: Drop unneeded void pointer cast

Remove unneeded cast on the void pointer par->txbuf.buf .
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: fbtft: Use devm_kcalloc instead of devm_kzalloc
Amitoj Kaur Chawla [Thu, 25 Feb 2016 13:20:58 +0000 (18:50 +0530)]
staging: fbtft: Use devm_kcalloc instead of devm_kzalloc

Replace devm_kzalloc with devm_kcalloc to ensure there are no integer
overflows from the multiplication of a number * sizeof

The following Coccinelle semantic patch was used to make this change:
//<smpl>
@@
expression dev,E1,E2,E3,E4;
@@

- devm_kzalloc(dev,E1*E2*sizeof(E3),E4)
+ devm_kcalloc(dev,E1*E2,sizeof(E3),E4)
//</smpl>

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

Unnecessary spi_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:
@@
struct spi_device *spi;
@@
- spi_set_drvdata(spi, NULL);
// </smpl>

Due to this removal, variable `spi` was unused so dropped `spi`

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fbtft: replace ternary operator with min macro
Alison Schofield [Wed, 24 Feb 2016 17:20:17 +0000 (09:20 -0800)]
staging: fbtft: replace ternary operator with min macro

Use macro min() to get the minimum of two values for
brevity and readability.

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

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: fbtft: Use kmalloc_array
Bhaktipriya Shridhar [Mon, 22 Feb 2016 17:47:16 +0000 (23:17 +0530)]
staging: fbtft: Use kmalloc_array

Use kmalloc_array instead of kmalloc for arrays to prevent integer
overflows.
This was done using Coccinelle:

@@
expression e1, e2;
constant C;
type t;
@@
(
- kmalloc(
+ kmalloc_array(
e2
- *
+ ,
sizeof(e1), C)
|
- kmalloc(
+ kmalloc_array(
e1
- *
+ ,
sizeof(t), C)
|
- kmalloc(
+ kmalloc_array(
- sizeof(e1)
- *
e2
+ ,
+ sizeof(e1)
, C)
|
- kmalloc(
+ kmalloc_array(
- sizeof(t)
- *
e1
+ ,
+ sizeof(t)
, C)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: nvec: removes an unnecessary cast on a void pointer
Ben Marsh [Thu, 10 Mar 2016 20:24:59 +0000 (21:24 +0100)]
Staging: nvec: removes an unnecessary cast on a void pointer

Patch to nvec_ps2.c to remove an unnecessary cast on a void pointer.

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: nvec: nvec.c: Drop void pointer cast
Janani Ravichandran [Thu, 25 Feb 2016 20:17:38 +0000 (15:17 -0500)]
staging: nvec: nvec.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: nvec: Avoid the use of BUG_ON
Laura Garcia Liebana [Wed, 24 Feb 2016 17:11:07 +0000 (18:11 +0100)]
staging: nvec: Avoid the use of BUG_ON

Prevent a kernel panic by avoiding the use of the BUG_ON macro.
Checkpatch detected this issue.

The BUG_ON macro is not needed as such cases shouldn't happen and they
were introduced for debugging purposes.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: nvec: Remove blank lines before a close brace
Laura Garcia Liebana [Mon, 22 Feb 2016 17:51:23 +0000 (18:51 +0100)]
staging: nvec: Remove blank lines before a close brace

Blank lines aren't necessary before a close brace '}'. 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: rtl8188eu: Remove function rtw_freq2ch
Bhumika Goyal [Fri, 11 Mar 2016 10:23:56 +0000 (15:53 +0530)]
Staging: rtl8188eu: Remove function rtw_freq2ch

Remove function rtw_freq2ch as it is never used anywhere in the kernel.
Also, remove the function prototype.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8188eu: removed unnecessary check in core/rtw_ap.c
Claudiu Beznea [Fri, 11 Mar 2016 10:18:48 +0000 (12:18 +0200)]
Staging: rtl8188eu: removed unnecessary check in core/rtw_ap.c

This patch removes unnecessary "if (true)" check in update_BCNTIM()
from core/rtw_ap.c file. After this remove the code alignment was
necessary.

Signed-off-by: Claudiu Beznea <claudiu.beznea@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: os_dep: Remove unnecessary else after return
Bhaktipriya Shridhar [Thu, 10 Mar 2016 16:54:07 +0000 (22:24 +0530)]
staging: rtl8188eu: os_dep: 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: rtl8188eu: Use !x instead of x==NULL.
Sandhya Bankar [Mon, 7 Mar 2016 12:33:58 +0000 (18:03 +0530)]
Staging: rtl8188eu: Use !x instead of x==NULL.

Use !x instead of x==NULL.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8188eu: rtw_efuse: Do not print message if kzalloc() failed.
Sandhya Bankar [Mon, 7 Mar 2016 12:18:16 +0000 (17:48 +0530)]
Staging: rtl8188eu: rtw_efuse: Do not print message if kzalloc() failed.

Do not print message if kzalloc() failed.
kzalloc() has its own messages. So no need to add extra one.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: rtl8188eu: Do not print message if kzalloc() failed.
Sandhya Bankar [Mon, 7 Mar 2016 12:11:41 +0000 (17:41 +0530)]
Staging: rtl8188eu: Do not print message if kzalloc() failed.

Do not print message if kzalloc() failed.
kzalloc() has its own messages. So no need to add extra one.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agortl8188eu: Add spaces around arithmetic operators
Kyle Kuffermann [Sun, 6 Mar 2016 15:47:15 +0000 (10:47 -0500)]
rtl8188eu: Add spaces around arithmetic operators

This fixes the checkpatch.pl issue: CHECK: spaces preferred around that '+'

Signed-off-by: Kyle Kuffermann <kyle.kuffermann@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: remove PWR_BASEADDR_* macro definitions and "base" member of...
Ivan Safonov [Wed, 2 Mar 2016 08:09:02 +0000 (15:09 +0700)]
staging: rtl8188eu: remove PWR_BASEADDR_* macro definitions and "base" member of wl_pwr_cfg structure

These macros and "base" member of wl_pwr_cfg structure
are used only to produce debug output.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: remove PWR_INTF_*_MSK macro definitions and interface_mask of...
Ivan Safonov [Wed, 2 Mar 2016 08:07:46 +0000 (15:07 +0700)]
staging: rtl8188eu: remove PWR_INTF_*_MSK macro definitions and interface_mask of wl_pwr_cfg structure

This driver is intended only for usb devices.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: remove PWR_FAB_*_MSK macro definitions and fab_msk of wl_pwr_cfg...
Ivan Safonov [Wed, 2 Mar 2016 08:07:09 +0000 (15:07 +0700)]
staging: rtl8188eu: remove PWR_FAB_*_MSK macro definitions and fab_msk of wl_pwr_cfg structure

fab_msk used for marking commands
for devices of a certain manufacturer.

However, always used only PWR_FAB_ALL_MSK value of fab_msk.

Most likely, such mark is useless.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: remove FabVersion member of odm_dm_struct struct
Ivan Safonov [Wed, 2 Mar 2016 08:06:26 +0000 (15:06 +0700)]
staging: rtl8188eu: remove FabVersion member of odm_dm_struct struct

Value of this variable is hardcoded
and used only to produce debug output.
Probably, FabVersion is useless.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: remove chip_type of the adapter structure
Ivan Safonov [Wed, 2 Mar 2016 08:05:47 +0000 (15:05 +0700)]
staging: rtl8188eu: remove chip_type of the adapter structure

chip_type variable is unnecessary here,
because this driver is only for one chip
and it is not used after initialization.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: replace (a == NULL) to (!a) in rtw_drv_init
Ivan Safonov [Wed, 2 Mar 2016 08:04:57 +0000 (15:04 +0700)]
staging: rtl8188eu: replace (a == NULL) to (!a) in rtw_drv_init

It is a checkpatch cleanups:
CHECK: Comparasion to NULL could be written ...

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: remove unnecessary debug output from os_dep/usb_intf.c
Ivan Safonov [Wed, 2 Mar 2016 08:04:19 +0000 (15:04 +0700)]
staging: rtl8188eu: remove unnecessary debug output from os_dep/usb_intf.c

Debug output in rtw_drw_init is excess

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: rtl8188eu: remove unused macros from include/basic_types.h
Ivan Safonov [Wed, 2 Mar 2016 08:01:33 +0000 (15:01 +0700)]
staging: rtl8188eu: remove unused macros from include/basic_types.h

FIELD_OFFSET, READEF1BYTE, READEF2BYTE, READEF4BYTE
WRITEEF1BYTE, WRITEEF2BYTE, WRITEEF4BYTE are removed.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>