Quentin Lambert [Wed, 18 Mar 2015 13:21:08 +0000 (14:21 +0100)]
Staging: dgnc: release the lock before testing for nullity
The refactoring intrduced in c84a083b995b ("Staging: dgnc: Use goto for spinlock release before return")
inverts the order in which the lock is released and ld is tested for nullity.
This patch restores the execution flow.
Fixes: c84a083b995b ("Staging: dgnc: Use goto for spinlock release before return") Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vaishali Thakkar [Wed, 18 Mar 2015 06:48:38 +0000 (12:18 +0530)]
Staging: rtl8188eu: Remove timer handler macros
After the commit 28af7ea81e16 ("Staging: rtl8188eu:
Eliminate use of _init_timer"), macros
(RTW_TIMER_HDL_ARGS, RTW_TIMER_HDL_NAME,
RTW_DECLARE_TIMER_HDL) are no longer needed. So,
remove them.
Vaishali Thakkar [Wed, 18 Mar 2015 07:00:44 +0000 (12:30 +0530)]
Staging: media: Use module_i2c_driver
Macro module_i2c_driver is used for drivers whose init
and exit paths does only register and unregister to i2c
API. So, here remove some boilerplate code by using
module_i2c_driver.
Oleg Drokin [Sun, 8 Mar 2015 00:24:26 +0000 (19:24 -0500)]
staging/lustre/libcfs: replace deprecated cpus_ calls with cpumask_
This patch continues to further remove deprecated functions, such as
any_online_cpu, for_each_cpu_mask and also cleaning up
usage of NR_CPUS in a few places
Staging: rtl8192u: Rename struct to avoid CamelCase
This patch renames struct DRxPathSel to dynamic_rx_path_sel in order to
keep the notations consistent and to remove the warning:
"CHECK: Avoid CamelCase". Done with coccinelle:
@@ @@
struct
-DRxPathSel
+dynamic_rx_path_sel
{...}
This patch removes the dig_t and DRxPathSel type definitions in order to
avoid the following warning: "WARNING: Do not add new typedefs".
Done with coccinelle and this script:
@r@ type t; identifier id; @@
typedef struct id
{...}
t;
Haneen Mohammed [Mon, 16 Mar 2015 15:41:31 +0000 (18:41 +0300)]
Staging: rtl8712: replace memcpy with ether_addr_copy
This patch replace memcpy with ethe_addr_copy to address the following
warning generated by checkpatch.pl: ""Prefer ether_addr_copy over memcpy
if the Ethernet addresses are __aligned(2)"
Follwoing is the output of pahole for the relevant datastructures:
1- for "iwe.u.ap_addr.sa_data" and "wrqu->ap_addr.sa_data"
Somya Anand [Mon, 16 Mar 2015 14:04:11 +0000 (19:34 +0530)]
Staging: nvec: 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
Somya Anand [Mon, 16 Mar 2015 14:04:09 +0000 (19:34 +0530)]
Staging: goldfish: 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
Somya Anand [Mon, 16 Mar 2015 14:04:08 +0000 (19:34 +0530)]
Staging: gdm72xx: 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
Somya Anand [Mon, 16 Mar 2015 14:04:07 +0000 (19:34 +0530)]
staging: gdm724x: 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
Haneen Mohammed [Fri, 13 Mar 2015 17:51:17 +0000 (20:51 +0300)]
Staging: ft1000: 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>
Haneen Mohammed [Fri, 13 Mar 2015 17:46:57 +0000 (20:46 +0300)]
Staging: media: 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>
Haneen Mohammed [Fri, 13 Mar 2015 17:45:25 +0000 (20:45 +0300)]
Staging: rtl8723au: 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>
Somya Anand [Fri, 13 Mar 2015 19:33:09 +0000 (01:03 +0530)]
Staging: gdm72xx: 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);
...
}
Somya Anand [Fri, 13 Mar 2015 19:33:08 +0000 (01:03 +0530)]
Staging: emxx_udc: 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);
...
}
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);
...
}
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.
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.
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
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.
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>
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>
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);
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:
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.
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.
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>
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".
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;