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;
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:
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.
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:
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>
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
) {
...
}
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>
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>
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>
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>
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>
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);
...
}
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>
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".
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.
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;
@@