Catégorie : Linux

mwifiex: Use to_delayed_work()

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Introduce the use of to_delayed_work() helper function instead of open coding it with container_of() A simplified version of the Coccinelle semantic patch used to make this change is: // @@ expression a; symbol work; @@ – container_of(a, struct delayed_work, work) + to_delayed_work(a) // Signed-off-by: Amitoj Kaur Chawla Reviewed-by: Julian Calaby …

Lire la suite

drm/udl: Use module_usb_driver

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Macro module_usb_driver is used for drivers whose init and exit paths only register and unregister to usb API. So remove boilerplate code to make code simpler by using module_usb_driver. This change was made with the help of the following Coccinelle semantic patch: // @a@ identifier f, x; @@ -static f(…) …

Lire la suite

Staging: lustre: lov: Pull assignments out of function call

Author: Bhumika Goyal <bhumirks@gmail.com> Assignments in function call arguments are undesirable. So pull such assignments out before function call. Made a coccinelle script to detect such cases: @@ expression fn,b,d; @@ * fn(…,d=b,…); Signed-off-by: Bhumika Goyal Signed-off-by: Greg Kroah-Hartman — drivers/staging/lustre/lustre/lov/lov_merge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)   diff –git a/drivers/staging/lustre/lustre/lov/lov_merge.c …

Lire la suite

staging: rtl8188eu: core: Use put_unaligned_le16

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Introduce the use of function put_unaligned_le16. This is done using the following Coccinelle semantic patch: // @@ identifier tmp; expression ptr; expression y,e; type T; @@ – tmp = cpu_to_le16(y); ? tmp = e @@ type T; identifier tmp; @@ – T tmp; …when != tmp // Corresponding header file …

Lire la suite

x86/microcode: Use kmemdup() rather than duplicating its implementation

Author: Andrzej Hajda <a.hajda@samsung.com> The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci. Signed-off-by: Andrzej Hajda Signed-off-by: Borislav Petkov Cc: Bartlomiej Zolnierkiewicz Cc: Linus Torvalds Cc: Marek Szyprowski Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1455612202-14414-3-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar — arch/x86/kernel/cpu/microcode/amd.c | 4 +— arch/x86/kernel/cpu/microcode/intel.c | 4 +— 2 files changed, 2 insertions(+), 6 …

Lire la suite

staging: rdma: hfi1: Replace kmalloc and memcpy with kmemdup

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Replace kmalloc and memcpy with kmemdup. Found using Coccinelle. The semantic patch used to make this change can be found here: scripts/coccinelle/api/memdup.cocci Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman — drivers/staging/rdma/hfi1/efivar.c | 3 +– 1 file changed, 1 insertion(+), 2 deletions(-)   diff –git a/drivers/staging/rdma/hfi1/efivar.c b/drivers/staging/rdma/hfi1/efivar.c index e569f9f..47dfe25 100644 — …

Lire la suite

stm class: Use a signed return type for stm_find_master_chan

Author: Lucas Tanure <tanure@linux.com> The return type « unsigned int » was used by the stm_find_master_chan function despite of the aspect that it will eventually return a negative error code. Done with the help of Coccinelle. Signed-off-by: Lucas Tanure Signed-off-by: Alexander Shishkin Signed-off-by: Greg Kroah-Hartman — drivers/hwtracing/stm/core.c | 4 ++– 1 file changed, 2 insertions(+), 2 deletions(-) …

Lire la suite

staging: rtl8712: Remove unnecessary ret variable

Author: Joseph Bisch <joseph.bisch@gmail.com> Since the variable ret is set at the beginning of the function and never changes its value, we can just return the value it was set to. Found using coccinelle with misc/returnvar.cocci. Signed-off-by: Joseph Bisch Signed-off-by: Greg Kroah-Hartman — drivers/staging/rtl8712/os_intfs.c | 3 +– 1 file changed, 1 insertion(+), 2 deletions(-)   …

Lire la suite

staging: lustre: obdclass: Use IS_ERR_OR_NULL

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Use macro IS_ERR_OR_NULL in place of tests for NULL and IS_ERR. The Coccinelle semantic patch used to make the change is as follows: // @@ expression e; @@ – e == NULL || IS_ERR(e) + IS_ERR_OR_NULL(e) // Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman — drivers/staging/lustre/lustre/obdclass/kernelcomm.c | 2 +- 1 …

Lire la suite

staging: wilc1000: wilc_wfi_cfgoperations: remove cast on void pointers

Author: Alison Schofield <amsfield22@gmail.com> Remove cast on void pointers. C programming language guarantees the conversion from void pointer to any other pointer type. Coccinelle patch: @r@ expression x; void* e; type T; identifier f; @@ ( *((T *)e) | ((T *)x)[…] | ((T *)x)->f | – (T *) e ) Signed-off-by: Alison Schofield Signed-off-by: Greg …

Lire la suite