OSDN Git Service

uclinux-h8/linux.git
9 years agoStaging: ft1000: Iterate list using list_for_each_entry
Somya Anand [Fri, 13 Mar 2015 19:33:07 +0000 (01:03 +0530)]
Staging: ft1000: Iterate list using list_for_each_entry

Code using doubly linked list is iterated generally  using list_empty and
list_entry functions, but it can be better written using list_for_each_entry
macro.

This patch replaces the while loop containing list_empty and list_entry with
list_for_each_entry and list_for_each_entry_safe. list_for_each_entry is a
macro which is used to iterate over a list of given type. So while loop used to
iterate over a list can be replaced with list_for_each_entry macro. However, if
list_del is used in the loop, then list_for_each_entry_safe is a better choice.
This transformation is done by using the following coccinelle script.

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

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

@ rule2  @
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: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: i2o: Move assignment out of if statement
Somya Anand [Fri, 13 Mar 2015 17:23:11 +0000 (22:53 +0530)]
Staging: i2o: Move assignment out of if statement

Checkpatch.pl suggest to avoid assignment in if statement.

This patch moves assignments out of the if statement and place
it before the if statement. This is done using following coccinelle
script.

@@
expression E1;
identifier p;
statement S;
@@
- if ((p = E1))
+ p = E1;
+ if (p)
S

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: fbtft: Remove unnecessary print messages
Vatika Harlalka [Fri, 13 Mar 2015 04:36:24 +0000 (10:06 +0530)]
Staging: fbtft: Remove unnecessary print messages

These print functions are called at the beginning
of the function and do not indicate any abnormal condition.

Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Simplify if condition
Ksenija Stanojevic [Thu, 12 Mar 2015 16:29:35 +0000 (17:29 +0100)]
Staging: rtl8192u: Simplify if condition

This patch removes macro true from if condition since variable
priv->ieee80211->LinkDetectInfo.bBusyTraffic is already of type bool.

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rts5208: Use module_pci_driver
Vaishali Thakkar [Thu, 12 Mar 2015 12:06:15 +0000 (17:36 +0530)]
Staging: rts5208: Use module_pci_driver

Macro module_pci_driver is used for drivers whose init
and exit paths does only register and unregister to pci
API. So, here remove some boilerplate code by using
module_pci_driver. Also, change driver to rtsx_driver,
to avoid implicitly redefining driver_init.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: ft1000: Use module_pcmcia_driver
Vaishali Thakkar [Thu, 12 Mar 2015 11:58:54 +0000 (17:28 +0530)]
Staging: ft1000: Use module_pcmcia_driver

Macro module_pcmcia_driver is used for drivers whose init
and exit paths does only register and unregister to pcmcia
API. So, here remove some boilerplate code by using
module_pcmcia_driver.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8723au: remove intialization of static ints
Supriya Karanth [Thu, 12 Mar 2015 04:26:20 +0000 (13:26 +0900)]
staging: rtl8723au: remove intialization of static ints

static ints are initialized to 0 by the compiler.
Explicit initialization is not necessary.

Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL

changes made using coccinelle script:
@@
type T;
identifier var;
@@
static T var
- =0
;

Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: i2o: remove intialization of static ints
Supriya Karanth [Thu, 12 Mar 2015 04:26:18 +0000 (13:26 +0900)]
staging: i2o: remove intialization of static ints

static ints are initialized to 0 by the compiler.
Explicit initialization is not necessary.

Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL

changes made using coccinelle script:
@@
type T;
identifier var;
@@
static T var
- =0
;

Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: dgap: Use setup_timer to combine initialization
Somya Anand [Wed, 11 Mar 2015 11:32:14 +0000 (17:02 +0530)]
Staging: dgap: Use setup_timer to combine initialization

The function setup_timer combines the initialization of a timer with the
initialization of the timer's function and data fields.

So, this patch combines the multiline code for timer initialization using the function
setup_timer. This issue is identified via coccinelle script.

@@
expression E1, E2, E3;
type T;
@@
- init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+ setup_timer(&E1, E2, 0);
)

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: use !x instead of x == NULL
Somya Anand [Mon, 16 Mar 2015 14:04:10 +0000 (19:34 +0530)]
Staging: iio: use !x instead of x == NULL

Functions like devm_kzalloc, kmalloc_array, devm_ioremap,
usb_alloc_urb, alloc_netdev return NULL as a return value on failure.
Generally, When NULL represents failure, !x is commonly used.

This patch cleans up the tests on the results of these functions, thereby
using !x instead of x == NULL or NULL == x. This is done via following
coccinelle script:
@prob_7@
identifier x;
statement S;
@@

(
 x = devm_kzalloc(...);
|
 x = usb_alloc_urb(...);
|
 x = kmalloc_array(...);
|
 x = devm_ioremap(...);
|
 x = alloc_netdev(...);
)
 ...
- if(NULL == x)
+ if(!x)
        S
Further we have used isomorphism characteristics of coccinelle to
indicate x == NULL and NULL == x are equivalent. This is done via
following iso script.

Expression
@ is_null @ expression X; @@
X == NULL <=> NULL == X

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: Use braces on all arms of if statement
Cristina Opriceana [Sat, 14 Mar 2015 18:54:04 +0000 (20:54 +0200)]
Staging: iio: Use braces on all arms of if statement

Add braces to improve consistency when using if statements.
Found by checkpatch.pl:
"CHECK: braces {} should be used on all arms of this statement".

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: Alignment should match open parenthesis
Cristina Opriceana [Sat, 14 Mar 2015 18:53:37 +0000 (20:53 +0200)]
Staging: iio: Alignment should match open parenthesis

This patch arranges multiple-line parameters in accordance with
the parameter above them to improve coding style.
Found by checkpatch.pl

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: Do not use multiple blank lines
Cristina Opriceana [Sat, 14 Mar 2015 18:51:29 +0000 (20:51 +0200)]
Staging: iio: Do not use multiple blank lines

This patch removes unnecessary blank lines between functions.
Found by checkpatch.pl:
"CHECK: Please don't use multiple blank lines".

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: Prefer using the BIT macro
Cristina Opriceana [Sat, 14 Mar 2015 18:51:12 +0000 (20:51 +0200)]
Staging: iio: Prefer using the BIT macro

This patch replaces bit shifting on 1 with the BIT(x) macro
as it's extensively used by other function in this driver.

This was done with coccinelle:
@@ int g; @@

-(1 << g)
+BIT(g)

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: Remove explicit comparison to NULL
Cristina Opriceana [Sat, 14 Mar 2015 18:50:48 +0000 (20:50 +0200)]
Staging: iio: Remove explicit comparison to NULL

This patch simplifies pointer comparison to NULL and makes code
easier to read. Warning found by checkpatch.pl.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: Remove space after type cast
Cristina Opriceana [Sat, 14 Mar 2015 18:50:23 +0000 (20:50 +0200)]
Staging: iio: Remove space after type cast

This patch removes unnecessary space after type casts.
Warning found by checkpatch.pl.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: Simplify return logic
Cristina Opriceana [Thu, 12 Mar 2015 17:10:31 +0000 (19:10 +0200)]
Staging: iio: Simplify return logic

This patch removes the conditional return of the ade77*_probe functions
based on the return values of iio_device_register as the latter
returns 0 or ret, the same as the checked values.

Warning found by coccinelle.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: Remove parentheses around right side an assignment
Haneen Mohammed [Fri, 13 Mar 2015 17:47:22 +0000 (20:47 +0300)]
Staging: iio: Remove parentheses around right side an assignment

Parentheses are not needed around the right hand side of an assignment.
This patch remove parenthese of such occurenses. Issue was detected and
solved using the following coccinelle script:

@rule1@
identifier x, y, z;
expression E1, E2;
@@

(
x = (y == z);
|
x = (E1 == E2);
|
 x =
-(
...
-)
 ;
)

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: iio: ade7758: Remove braces on a single statement if
Taiane Coelho Ramos [Fri, 13 Mar 2015 19:22:44 +0000 (16:22 -0300)]
Staging: iio: ade7758: Remove braces on a single statement if

This patch fixes the checkpatch.pl warning:

WARNING: braces {} are not necessary for single
statement blocks

Signed-off-by: Taiane Coelho Ramos <exhora.tat@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8188eu: Remove parentheses around right side an assignment
Haneen Mohammed [Fri, 13 Mar 2015 16:55:55 +0000 (19:55 +0300)]
Staging: rtl8188eu: Remove parentheses around right side an assignment

Parentheses are not needed around the right hand side of an assignment.
This patch remove parenthese of such occurenses. Issue was detected and
solved using the following coccinelle script:

@rule1@
identifier x, y, z;
expression E1, E2;
@@

(
x = (y == z);
|
x = (E1 == E2);
|
 x =
-(
...
-)
 ;
)

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8188eu: remove break after return
Supriya Karanth [Fri, 13 Mar 2015 07:58:40 +0000 (16:58 +0900)]
staging: rtl8188eu: remove break after return

Remove "break" statement after a "return" statement as
it does not get executed.

Found by checkpatch.pl - break is not useful after a goto
or return

Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8188eu: remove intialization of static ints
Supriya Karanth [Thu, 12 Mar 2015 04:26:19 +0000 (13:26 +0900)]
staging: rtl8188eu: remove intialization of static ints

static ints are initialized to 0 by the compiler.
Explicit initialization is not necessary.

Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL

changes made using coccinelle script:
@@
type T;
identifier var;
@@
static T var
- =0
;

Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8188eu: Eliminate use of _init_timer
Vaishali Thakkar [Wed, 11 Mar 2015 06:11:24 +0000 (11:41 +0530)]
Staging: rtl8188eu: Eliminate use of _init_timer

This patch introduces the use of API function setup_timer
instead of driver specific function init_timer as it is
the preferred and standard way to set and setup the timer.
To be compatible with the changes, argument types of
referenced functions are changed. Also, definition of
function _init_timer is removed as it is no longer needed
after this change.

Here, these cases are handled using Coccinelle and
semantic patch used for this is as follows:

@@ expression x, y; identifier a, b;@@

- _init_timer (&x, y, a, b);
+ setup_timer (&x, a, (unsigned long)b);

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8188eu: Eliminate use of _set_timer
Vaishali Thakkar [Wed, 11 Mar 2015 06:11:07 +0000 (11:41 +0530)]
Staging: rtl8188eu: Eliminate use of _set_timer

This patch introduces the use of API function mod_timer
instead of driver specific function _set_timer as it is
a more efficient and standard way to update the expire
field of an active timer. Also, definition of function
_set_timer is removed as it is no longer needed after
this change.

Here, these cases are handled using Coccinelle and
semantic patch used for this is as follows:

@@ expression x; expression y;@@

- _set_timer (&x, y);
+ mod_timer (&x, jiffies + msecs_to_jiffies (y));

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agodrivers: staging: rtl8188eu: core: rtw_security: Fix misspelled word
Ioana Ciornei [Mon, 9 Mar 2015 13:43:25 +0000 (15:43 +0200)]
drivers: staging: rtl8188eu: core: rtw_security: Fix misspelled word

This patch fixes the checkpatch.pl warning:

WARNING: 'halfs' may be misspelled - perhaps 'halves'?

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8188eu: use %pM specifier instead of passing direct values
Mike Krinkin [Sun, 8 Mar 2015 17:14:07 +0000 (20:14 +0300)]
staging: rtl8188eu: use %pM specifier instead of passing direct values

The patch converts code to use %pM specifier instead of pushing
each byte via stack.

Signed-off-by: Mike Krinkin <krinkin.m.u@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192e: Bool tests don't need comparisons
Cristina Opriceana [Fri, 13 Mar 2015 19:19:24 +0000 (21:19 +0200)]
Staging: rtl8192e: Bool tests don't need comparisons

This patch removes comparisons to true/false values on bool variables.
Warning found by coccinelle:
"WARNING: Comparison to bool".

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8192e: remove break after return
Supriya Karanth [Fri, 13 Mar 2015 07:58:41 +0000 (16:58 +0900)]
staging: rtl8192e: remove break after return

Remove "break" statement after a "return" statement as
it does not get executed.

Found by checkpatch.pl - break is not useful after a goto
or return

Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192e: Remove unnecessary variables
Cristina Opriceana [Thu, 12 Mar 2015 02:22:38 +0000 (04:22 +0200)]
Staging: rtl8192e: Remove unnecessary variables

This patch removes unnecessary intermediary variables in return lines
and uses actual values.
Found by coccinelle using this semantic patch:

@@ type T; expression expr; identifier r; @@

-T r = expr;
... when != r
    when strict
-return r;
+return expr;

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192e: Eliminate use of MSECS macro
Vaishali Thakkar [Wed, 11 Mar 2015 08:21:36 +0000 (13:51 +0530)]
Staging: rtl8192e: Eliminate use of MSECS macro

Use msecs_to_jiffies instead of driver specific macro
MSECS. This is done using Coccinelle and semantic
patch used for this is as follows:

@@expression t;@@

- MSECS(t)
+ msecs_to_jiffies(t)

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192e: Remove unnecessary macro
Cristina Opriceana [Wed, 11 Mar 2015 01:06:30 +0000 (03:06 +0200)]
Staging: rtl8192e: Remove unnecessary macro

This patch removes the RTLLIB_PRINT_STR macro definition because it's
only defined in the header and it's never referenced. It also removes
PRINTABLE and MAX_STR_LEN, which were defined as helpers for the first
one.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8192e: remove unused functions
Sudip Mukherjee [Tue, 10 Mar 2015 09:44:58 +0000 (15:14 +0530)]
staging: rtl8192e: remove unused functions

removed some functions which were not being used anywhere.
build tested and also verified by git grep that there is no other
reference to these functions.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8192u: remove return from end of void function
Supriya Karanth [Sun, 15 Mar 2015 03:42:52 +0000 (12:42 +0900)]
staging: rtl8192u: remove return from end of void function

This patch removes the return statement at the end of a void
function as it is not necessary.

found by checkpatch.pl: WARNING: void function return statements
are not generally useful

changes made using coccinelle script:

@@
@@

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

Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Remove parentheses around right side an assignment
Haneen Mohammed [Fri, 13 Mar 2015 17:50:52 +0000 (20:50 +0300)]
Staging: rtl8192u: Remove parentheses around right side an assignment

Parentheses are not needed around the right hand side of an assignment.
This patch remove parenthese of such occurenses. Issue was detected and
solved using the following coccinelle script:

@rule1@
identifier x, y, z;
expression E1, E2;
@@

(
x = (y == z);
|
x = (E1 == E2);
|
 x =
-(
...
-)
 ;
)

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Bool tests don't need comparisons
Cristina Opriceana [Fri, 13 Mar 2015 19:21:31 +0000 (21:21 +0200)]
Staging: rtl8192u: Bool tests don't need comparisons

This patch removes explicit true/false comparations to bool variables.
Warning found by coccinelle:
"WARNING: Comparison to bool"

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8192u: remove break after return
Supriya Karanth [Fri, 13 Mar 2015 07:58:42 +0000 (16:58 +0900)]
staging: rtl8192u: remove break after return

Remove "break" statement after a "return" statement as
it does not get executed.

Found by checkpatch.pl - break is not useful after a goto
or return

Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Remove unnecessary struct and typedef
Cristina Opriceana [Thu, 12 Mar 2015 02:30:04 +0000 (04:30 +0200)]
Staging: rtl8192u: Remove unnecessary struct and typedef

This patch removes the _bss_ht struct and the associated type definition
because it is not used and it also introduces the warning:
"WARNING: do not add new typedefs".

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Remove unnecessary variable
Cristina Opriceana [Thu, 12 Mar 2015 02:21:29 +0000 (04:21 +0200)]
Staging: rtl8192u: Remove unnecessary variable

This patch detects the cases in which a variable is not modified through
the code and it is used as a return value. The variable is detected and
removed by coccinelle using the following semantic patch:

@@ type T; expression expr; identifier r; constant c; @@

-T r = expr;
... when != r
    when strict
-return r;
+return expr;

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Combine initialization using setup_timer
Somya Anand [Wed, 11 Mar 2015 11:32:16 +0000 (17:02 +0530)]
Staging: rtl8192u: Combine initialization using setup_timer

The function setup_timer combines the initialization of a timer with the
initialization of the timer's function and data fields.

So, this patch combines the multiline code for timer initialization using the function
setup_timer. This issue is identified via coccinelle script.

@@
expression E1, E2, E3;
type T;
@@
- init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+ setup_timer(&E1, E2, 0);
)

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Review phrase and fix spelling errors
Cristina Opriceana [Wed, 11 Mar 2015 00:51:35 +0000 (02:51 +0200)]
Staging: rtl8192u: Review phrase and fix spelling errors

This patch removes some serious spelling errors and adds small
improvements to the phrases in order to make them easier to understand.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Fix do not use // c99 comments.
Dilek Uzulmez [Fri, 6 Mar 2015 14:18:31 +0000 (16:18 +0200)]
Staging: rtl8192u: Fix do not use // c99 comments.

This patch fixes checkpatch.pl issues with "do not use // C99 comments" errors in ieee80211_rx.c

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Added #include <linux/uaccess.h> instead of <asm/uaccess.h>
Dilek Uzulmez [Fri, 6 Mar 2015 14:08:10 +0000 (16:08 +0200)]
Staging: rtl8192u: Added #include <linux/uaccess.h> instead of <asm/uaccess.h>

The following patch fixes the checkpatch.pl warning:
WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Convert use of __constant_<foo> to <foo>
Vaishali Thakkar [Fri, 6 Mar 2015 13:22:28 +0000 (18:52 +0530)]
Staging: rtl8192u: Convert use of __constant_<foo> to <foo>

Using functions of the form __constant_<foo> isn't preferred
outside of include/uapi/ as using the function without
__constant_ is identical when the argument is a constant.
So, this patch replaces __constant_htons with htons.

This is done using Coccinelle and semantic patch used for
this is as follows:

@@identifier x;@@

(
- __constant_htons(x)
+ htons(x)
|
- __constant_htonl(x)
+ htonl(x)
|
- __constant_ntohs(x)
+ htons(x)
|
- __constant_ntohl(x)
+ htonl(x)
)

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8712: Replace __constant_cpu_to_le16
Dilek Uzulmez [Fri, 6 Mar 2015 12:14:58 +0000 (14:14 +0200)]
Staging: rtl8712: Replace __constant_cpu_to_le16

This fixes the following checkpatch.pl warning:
WARNING: __constant_cpu_to_le16 should be cpu_to_le16

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8712: fix potential null pointer dereference
Matteo Semenzato [Wed, 11 Mar 2015 13:31:14 +0000 (14:31 +0100)]
Staging: rtl8712: fix potential null pointer dereference

Check if kmalloc succeded before using the pointer in memcpy.

Signed-off-by: Matteo Semenzato <mattew8898@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8712: remove else after return statement
Haneen Mohammed [Wed, 11 Mar 2015 22:08:32 +0000 (01:08 +0300)]
Staging: rtl8712: remove else after return statement

else after return generally is not useful. This patch removes else after return
statement. Issue addressed by checkpatch.pl.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8712: Eliminate use of _cancel_timer
Vaishali Thakkar [Fri, 6 Mar 2015 10:53:51 +0000 (16:23 +0530)]
Staging: rtl8712: Eliminate use of _cancel_timer

Use timer API function del_timer_sync instead of driver
specific function _cancel_timer as besides deactivating
a timer, it also ensures that the timer is stopped on all
CPUs before the driver exists. Also, variables
timer_cancelled and bool are removed as they are no longer
needed.

@a@
expression x;
identifier y;
@@

- _cancel_timer (&x, &y);
+ del_timer_sync (&x);

@@type T; identifier a.y;@@

- T y;
...when != y

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8712: Eliminate use of _cancel_timer_ex
Vaishali Thakkar [Fri, 6 Mar 2015 10:53:35 +0000 (16:23 +0530)]
Staging: rtl8712: Eliminate use of _cancel_timer_ex

Use timer API function del_timer_sync instead of driver
specific function _cancel_timer_ex as besides deactivating
a timer, it ensures that the timer is stopped on all
CPUs before the driver exists. Also, definition of function
_cancel_timer_ex is removed as it is no longer needed after
this change.

This is done using Coccinelle and semantic patch used for
this is as follows:

@@ expression x; @@

- _cancel_timer_ex (&x);
+ del_timer_sync (&x);

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: skein: Remove do-while(0) from single statement macros
Vatika Harlalka [Sat, 14 Mar 2015 10:19:30 +0000 (15:49 +0530)]
Staging: skein: Remove do-while(0) from single statement macros

Remove unneeded do-while(0) loop from single statement macros.

Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: remove break after return
Supriya Karanth [Fri, 13 Mar 2015 12:00:20 +0000 (21:00 +0900)]
staging: comedi: remove break after return

Remove "break" statement after a "return" statement as
it does not get executed.

Deadcode found by coccinelle --debug option

Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: comedi: Remove parentheses around right side assignment
Haneen Mohammed [Fri, 13 Mar 2015 11:29:30 +0000 (14:29 +0300)]
Staging: comedi: Remove parentheses around right side assignment

Parentheses are not needed around the right hand side of an assignment.
This patch remove parenthese of such occurences. Issue was detected and
solved using the following coccinelle script:

@rule1@
identifier x, y, z;
expression E1, E2;
@@

(
x = (y == z);
|
x = (E1 == E2);
|
 x =
-(
...
-)
 ;
)

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: comedi: Use function setup_timer for combining initialization
Somya Anand [Wed, 11 Mar 2015 11:32:13 +0000 (17:02 +0530)]
Staging: comedi: Use function setup_timer for combining initialization

The function setup_timer combines the initialization of a timer with the
initialization of the timer's function and data fields.

So, this patch combines the multiline code for timer initialization using the function
setup_timer. This issue is identified via coccinelle script.

@@
expression E1, E2, E3;
type T;
@@
- init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+ setup_timer(&E1, E2, 0);
)

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: remove parantheses from return statements
Supriya Karanth [Sat, 14 Mar 2015 12:55:11 +0000 (21:55 +0900)]
staging: sm750fb: remove parantheses from return statements

found by checkpatch.pl :ERROR: return is not a function,
parentheses are not required

changes made using coccinelle script:

@@
expression e,e1;
@@
(
return (e / e1);
|
return
-(
e
-)
;
)

Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: sm750fb: Add space after ','
Somya Anand [Thu, 12 Mar 2015 16:18:45 +0000 (21:48 +0530)]
Staging: sm750fb: Add space after ','

This patch adds space after ',' for the better readability of
code. This issue is detected by checkpatch.pl

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: remove intialization of static ints
Supriya Karanth [Thu, 12 Mar 2015 04:26:21 +0000 (13:26 +0900)]
staging: sm750fb: remove intialization of static ints

static ints are initialized to 0 by the compiler.
Explicit initialization is not necessary.

Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL

changes made using coccinelle script:
@@
type T;
identifier var;
@@
static T var
- =0
;

Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750fb: Add void to function definition with no arguments
Supriya Karanth [Wed, 11 Mar 2015 16:11:00 +0000 (01:11 +0900)]
staging: sm750fb: Add void to function definition with no arguments

Found by checkpatch.pl - ERROR: Bad function definition

A function with no arguments allows for variadic arguments. Add
void in between the empty parentheses to indicate that the function
takes no arguments.

changes made using coccinelle script:
@@
type T;
identifier f;
@@
T f(
+void
 ) {
...
}

Signed-off-by: Supriya Karanth <iskaranth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: sm750: Fix switch-case indentation
Ioana Ciornei [Wed, 11 Mar 2015 02:35:04 +0000 (04:35 +0200)]
staging: sm750: Fix switch-case indentation

Remove switch cases indentation in order to follow the Linux coding style.

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: goldfish: remove extra parentheses around function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:09:10 +0000 (19:09 +0200)]
staging: goldfish: remove extra parentheses around function arguments

Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: fbtft_device.c: remove extra parentheses around function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:08:40 +0000 (19:08 +0200)]
staging: fbtft: fbtft_device.c: remove extra parentheses around function arguments

Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: fbtft-io.c: remove extra parentheses around function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:08:15 +0000 (19:08 +0200)]
staging: fbtft: fbtft-io.c: remove extra parentheses around function arguments

Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: fb_st7735r.c: remove extra parentheses around function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:07:01 +0000 (19:07 +0200)]
staging: fbtft: fb_st7735r.c: remove extra parentheses around function arguments

Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: fb_s6d02a1.c: remove extra parentheses around function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:06:24 +0000 (19:06 +0200)]
staging: fbtft: fb_s6d02a1.c: remove extra parentheses around function arguments

Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: fb_hx8353d.c: remove extra parentheses around function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:05:52 +0000 (19:05 +0200)]
staging: fbtft: fb_hx8353d.c: remove extra parentheses around function arguments

Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: fb_hx8340bn.c: remove extra parentheses around function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:05:27 +0000 (19:05 +0200)]
staging: fbtft: fb_hx8340bn.c: remove extra parentheses around function arguments

Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fbtft: fb_agm1264k-fl.c: remove extra parentheses around function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:04:35 +0000 (19:04 +0200)]
staging: fbtft: fb_agm1264k-fl.c: remove extra parentheses around function arguments

Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: ft1000: ft1000-usb: ft1000_hw.c: adjust function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:04:09 +0000 (19:04 +0200)]
staging: ft1000: ft1000-usb: ft1000_hw.c: adjust function arguments

Handles the following issues:

Removing extra parentheses around function arguments,
Removing unnecessary pointer to pointer casts.

Issues were detected using the following coccinelle script:

@@
expression e;
type t;
identifier f;
@@

f(...,
-(t *)
e
,...)

@@
expression e;
identifier f;
@@

f(...,
&
-(
e
-)
,...)

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Parentheses removal were left to the script. However, there were some
cases that were handled manually. In addition, handling pointer casts
were done manually too because not all replacements generated by the
script were suitable. When pointer casts on function arguments were
in the form:
    <func>(...,(<type> *)&<expression>,...)

the replacements were discarded due to compilation warnings.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: ft1000: ft1000-usb: ft1000_download.c: adjust function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:03:18 +0000 (19:03 +0200)]
staging: ft1000: ft1000-usb: ft1000_download.c: adjust function arguments

Handles the following issues:

Removing extra parentheses around function arguments,
Removing unnecessary pointer to pointer cast.

Issues were detected using the following coccinelle script:

@@
expression e;
type t;
identifier f;
@@

f(...,
-(t *)
e
,...)

@@
expression e;
identifier f;
@@

f(...,
&
-(
e
-)
,...)

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Parentheses removal were left to the script. However, handling pointer
casts were done manually because not all replacements generated by the
script were suitable. In general, the following cases were discarded:

pointer casts in macros,
pointer casts on function arguments in the form of:
    <func>(...,(<type> *)&<expression>,...)

since both cases generated compilation warnings.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: ft1000: ft1000-usb: adjust function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:02:29 +0000 (19:02 +0200)]
staging: ft1000: ft1000-usb: adjust function arguments

Handles the following issues:

Removing extra parentheses around function arguments,
Removing unnecessary pointer to pointer cast.

Issues were detected using the following coccinelle script:

@@
expression e;
type t;
identifier f;
@@

f(...,
-(t *)
e
,...)

@@
expression e;
identifier f;
@@

f(...,
&
-(
e
-)
,...)

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Parentheses removal were left to the script. However, handling pointer
casts were done manually because not all replacements generated by the
script were suitable. In general, the following cases were discarded:

pointer casts in macros,
pointer casts on function arguments in the form of:
    <func>(...,(<type> *)&<expression>,...)

since both cases generated compilation warnings.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: ft1000: ft1000-pcmcia: adjust function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:01:41 +0000 (19:01 +0200)]
staging: ft1000: ft1000-pcmcia: adjust function arguments

Handles the following issues:

Removing extra parentheses around function arguments,
Removing unnecessary pointer to potinter cast.

Issues were detected using the following coccinelle
script:

@@
expression e;
type t;
identifier f;
@@

f(...,
-(t *)
e
,...)

@@
expression e;
identifier f;
@@

f(...,
&
-(
e
-)
,...)

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Parentheses removal were left to the script. However, handling pointer
casts were done manually because not all replacements generated by the
script were suitable. In general, the following cases were discarded:

pointer casts in macros,
pointer casts on function arguments in the form of:
<func>(...,(<type> *)&<expression>,...)

since both cases generated compilation warnings.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: ft1000: adjust function arguments
Aya Mahfouz [Tue, 10 Mar 2015 17:00:53 +0000 (19:00 +0200)]
staging: ft1000: adjust function arguments

Handles the following issues:

Removing extra parentheses around function arguments,
Removing unnecessary pointer to pointer cast.

Issues detected and resolved using the following coccinelle
script:

@@
expression e;
type t;
identifier f;
@@

f(...,
-(t *)
e
,...)

@@
expression e;
identifier f;
@@

f(...,
&
-(
e
-)
,...)

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: mt29f_spinand: remove pointer to pointer cast in function argument
Aya Mahfouz [Tue, 10 Mar 2015 16:58:00 +0000 (18:58 +0200)]
staging: mt29f_spinand: remove pointer to pointer cast in function argument

Removes unnecessary pointer to pointer cast on function arguments.
It is worth noting that buf is already a u8 pointer.
Issue detected and resolved using the following coccinelle script:

@@
expression e;
type t;
identifier f;
@@

f(...,
-(t *)
e
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: media: lirc: remove pointer to pointer cast on function arguments
Aya Mahfouz [Tue, 10 Mar 2015 16:57:25 +0000 (18:57 +0200)]
staging: media: lirc: remove pointer to pointer cast on function arguments

Removes pointer to pointer cast on function arguments. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
type t;
identifier f;
@@

f(...,
-(t *)
e
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: media: lirc: fix multiple issues with function arguments
Aya Mahfouz [Tue, 10 Mar 2015 16:56:37 +0000 (18:56 +0200)]
staging: media: lirc: fix multiple issues with function arguments

Handles the following issues:

Removing extra parentheses around function arguments,
Removing unnecessary pointer to pointer casts.

Issues detected and resolved using the following coccinelle
script:

@@
expression e;
type t;
identifier f;
@@

f(...,
-(t *)
e
,...)

@@
expression e;
identifier f;
@@

f(...,
&
-(
e
-)
,...)

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: media: lirc: remove unnecessary cast on function argument
Aya Mahfouz [Tue, 10 Mar 2015 16:55:27 +0000 (18:55 +0200)]
staging: media: lirc: remove unnecessary cast on function argument

Removes pointer to pointer cast on a function argument. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
type t;
identifier f;
@@

f(...,
-(t *)
e
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: media: lirc: lirc_imon.c: remove extra parentheses around function arguments
Aya Mahfouz [Tue, 10 Mar 2015 16:54:51 +0000 (18:54 +0200)]
staging: media: lirc: lirc_imon.c: remove extra parentheses around function arguments

Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
identifier f;
@@

f(...,
&
-(
e
-)
,...)

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: fwserial: remove extra parentheses around function arguments
Aya Mahfouz [Tue, 10 Mar 2015 16:53:54 +0000 (18:53 +0200)]
staging: fwserial: remove extra parentheses around function arguments

Removes extra parentheses around function arguments. Issue
detected and resolved using the following coccinelle script:

@@
expression e;
identifier f;
@@

f(...,
-(
e
-)
,...);

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: Remove space to improve code style.
Vatika Harlalka [Tue, 10 Mar 2015 12:26:12 +0000 (17:56 +0530)]
Staging: lustre: Remove space to improve code style.

Remove space to improve code style and follow kernel
conventions.

Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: Use setup_timer to combine initialization
Somya Anand [Wed, 11 Mar 2015 11:32:15 +0000 (17:02 +0530)]
Staging: lustre: Use setup_timer to combine initialization

The function setup_timer combines the initialization of a timer with the
initialization of the timer's function and data fields.

So, this patch combines the multiline code for timer initialization using the function
setup_timer. This issue is identified via coccinelle script.

@@
expression E1, E2, E3;
type T;
@@
- init_timer(&E1);
...
(
- E1.function = E2;
...
- E1.data = (T)E3;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.data = (T)E3;
...
- E1.function = E2;
+ setup_timer(&E1, E2, (T)E3);
|
- E1.function = E2;
+ setup_timer(&E1, E2, 0);
)

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: Iterate list using list_for_each_entry
Somya Anand [Fri, 13 Mar 2015 19:33:10 +0000 (01:03 +0530)]
Staging: lustre: Iterate list using list_for_each_entry

Code using doubly linked list is iterated generally  using list_empty and
list_entry functions, but it can be better written using list_for_each_entry
macro.

This patch replaces the while loop containing list_empty and list_entry with
list_for_each_entry and list_for_each_entry_safe. list_for_each_entry is a
macro which is used to iterate over a list of given type. So while loop used to
iterate over a list can be replaced with list_for_each_entry macro. However, if
list_del is used in the loop, then list_for_each_entry_safe is a better choice.
This transformation is done by using the following coccinelle script.

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

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

@ rule2  @
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: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: Remove parentheses around right side an assignment
Haneen Mohammed [Fri, 13 Mar 2015 17:48:53 +0000 (20:48 +0300)]
Staging: lustre: Remove parentheses around right side an assignment

Parentheses are not needed around the right hand side of an assignment.
This patch remove parenthese of such occurenses. Issue was detected and
solved using the following coccinelle script:

@rule1@
identifier x, y, z;
expression E1, E2;
@@

(
x = (y == z);
|
x = (E1 == E2);
|
 x =
-(
...
-)
 ;
)

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Replace printk() with netdev_dbg()
Cristina Opriceana [Mon, 9 Mar 2015 18:39:24 +0000 (20:39 +0200)]
Staging: rtl8192u: Replace printk() with netdev_dbg()

This patch replaces the printk() function with netdev_dbg() in order to
fix the following: "WARNING: printk() should include KERN_ facility level"
and "WARNING: line over 80 characters".

Issue found by checkpatch.pl

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Add function to improve code quality
Cristina Opriceana [Mon, 9 Mar 2015 18:38:48 +0000 (20:38 +0200)]
Staging: rtl8192u: Add function to improve code quality

This patch introduces a new function for the authentication response
error check in the  ieee80211_rx_frame_softmac() function to fix the
indentation problem. It also adds the iotAction variable in the new
function to fix the "more than 80 characters per line" warning.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8188eu: Remove unneeded return statement
Somya Anand [Mon, 9 Mar 2015 13:48:25 +0000 (19:18 +0530)]
Staging: rtl8188eu: Remove unneeded return statement

This patch removes unnecessary return statement from a void
function and hence make it more compatible.

This issue is identified by checkpatch.pl

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8188eu: Remove redundant local variable
Somya Anand [Mon, 9 Mar 2015 13:48:24 +0000 (19:18 +0530)]
Staging: rtl8188eu: Remove redundant local variable

This patch removes a redundant variable "val" and adds
inline return statements. It also adds a default case
to the switch statement which returns 0 to keep the logic
intact.

It also removes a redundant variable "inx" and adds inline
return statements.

This issue is identified by the following coccinelle script.
@@
expression ret;
identifier f;
@@

-ret =
+return
     f(...);
-return ret;

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: vt6655: Fixes the checkpatch.pl warning
Himani Agrawal [Mon, 9 Mar 2015 14:09:50 +0000 (19:39 +0530)]
staging: vt6655: Fixes the checkpatch.pl warning

warning fixed:

WARNING: line over 80 characters

The function call containing several variables is broken to make it fit
in 80 characters.

Signed-off-by: Himani Agrawal <himani93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: wlan-ng: Use kzalloc instead of kmalloc.
Navya Sri Nizamkari [Tue, 10 Mar 2015 12:25:40 +0000 (17:55 +0530)]
staging: wlan-ng: Use kzalloc instead of kmalloc.

This patch uses kzalloc instead of kmalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8192u: Use kzalloc instead of kmalloc.
Navya Sri Nizamkari [Tue, 10 Mar 2015 12:26:58 +0000 (17:56 +0530)]
staging: rtl8192u: Use kzalloc instead of kmalloc.

This patch uses kzalloc instead of kmalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8192e: Use kzalloc instead of kmalloc.
Navya Sri Nizamkari [Tue, 10 Mar 2015 12:28:07 +0000 (17:58 +0530)]
staging: rtl8192e: Use kzalloc instead of kmalloc.

This patch uses kzalloc instead of kmalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8188eu: Use kcalloc instead of kzalloc.
Navya Sri Nizamkari [Tue, 10 Mar 2015 11:57:27 +0000 (17:27 +0530)]
staging: rtl8188eu: Use kcalloc instead of kzalloc.

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: rtl8188eu: Use kcalloc instead of kzalloc
Navya Sri Nizamkari [Tue, 10 Mar 2015 11:59:27 +0000 (17:29 +0530)]
staging: rtl8188eu: Use kcalloc instead of kzalloc

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: iio: Use kcalloc instead of kzalloc.
Navya Sri Nizamkari [Tue, 10 Mar 2015 12:02:50 +0000 (17:32 +0530)]
staging: iio: Use kcalloc instead of kzalloc.

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: iio: Use kcalloc instead of kzalloc
Navya Sri Nizamkari [Tue, 10 Mar 2015 12:04:29 +0000 (17:34 +0530)]
staging: iio: Use kcalloc instead of kzalloc

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: media: Use kcalloc instead of kzalloc.
Navya Sri Nizamkari [Tue, 10 Mar 2015 12:05:57 +0000 (17:35 +0530)]
staging: media: Use kcalloc instead of kzalloc.

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: media: Use kcalloc instead of kzalloc
Navya Sri Nizamkari [Tue, 10 Mar 2015 12:07:28 +0000 (17:37 +0530)]
staging: media: Use kcalloc instead of kzalloc

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: unisys: Use kcalloc instead of kzalloc.
Navya Sri Nizamkari [Tue, 10 Mar 2015 12:08:52 +0000 (17:38 +0530)]
staging: unisys: Use kcalloc instead of kzalloc.

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rtl8192u: Use __packed instead of __attribute__((packed))
Cristina Opriceana [Mon, 9 Mar 2015 21:08:00 +0000 (23:08 +0200)]
Staging: rtl8192u: Use __packed instead of __attribute__((packed))

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

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: fix space issue in workitem.c
Greg Kroah-Hartman [Fri, 13 Mar 2015 08:54:57 +0000 (09:54 +0100)]
Staging: lustre: fix space issue in workitem.c

This patch fixes a space issue in the workitem.c file

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: dgnc: Use goto for spinlock release before return
Quentin Lambert [Wed, 11 Mar 2015 14:22:01 +0000 (15:22 +0100)]
Staging: dgnc: Use goto for spinlock release before return

spin_unlock_irqrestore() is called at several
different places before exiting. This patch uses a goto statement
to factorize these calls.

Coccinelle was used to generate this patch.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: dgnc: Use goto for error handling
Quentin Lambert [Wed, 11 Mar 2015 14:22:00 +0000 (15:22 +0100)]
Staging: dgnc: Use goto for error handling

This patch introduces goto statments for error handling
and in cases where a lock needs to be released.

A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr)

@candidates exists@
identifier f, label;
statement s;
position p1, p2, p3;
@@

  f@p1(...) {
  ...when any

    if@p2(...) {
    ...when any
      s

      return@p3 ...;
    }
  ...when any
  }

@good1 exists@
identifier candidates.f, candidates.label;
statement candidates.s;
position candidates.p1, candidates.p2;
@@

  f@p1(...) {
  ...when any

    if(...) {
    ...when any
      s
      return ...;
    }
    ...when any

    if@p2(...) {...}
  ...when any
 }

@depends on good1@
identifier candidates.f, candidates.label;
position candidates.p1, candidates.p3;
@@

   f@p1(...) {
   ...when any
*  return@p3 ...;
  }

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: dgnc: Remove redundant parentheses
Somya Anand [Wed, 11 Mar 2015 11:32:12 +0000 (17:02 +0530)]
Staging: dgnc: Remove redundant parentheses

This patch removes the redundant parentheses inorder to make code
simplified. While doing this, the precedence order of the operation
is taken into consideration to keep the logic of the code intact.

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>