evdev: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
Subsystems (2)
PATCH 1/1 evdev: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
The use of "rcu_assign_pointer()" is NULLing out the pointer. According to RCU_INIT_POINTER()'s block comment:
"1. This use of RCU_INIT_POINTER() is NULLing out the pointer"
it is better to use it instead of rcu_assign_pointer() because it has a smaller overhead.
The following Coccinelle semantic patch was used:
@@
@@
- rcu_assign_pointer
+ RCU_INIT_POINTER
(..., NULL)
--- drivers/input/evdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/evdev.c +1 -1
@@ -291,7 +291,7 @@ static int evdev_ungrab(struct evdev *evdev, struct evdev_client *client)if (grab != client)return -EINVAL ; -rcu_assign_pointer (evdev->grab,NULL ); +RCU_INIT_POINTER (evdev->grab,NULL );synchronize_rcu ();input_release_device (&evdev->handle);
Signature · 1 line
1.9.1
Dmitry Torokhov
maintainerHi Andreea,
Quoted 6 lines · Andreea-Cristina Bernat
The use of "
rcu_assign_pointer()" is NULLing out the pointer. According to RCU_INIT_POINTER()'s block comment:
"1. This use ofRCU_INIT_POINTER()is NULLing out the pointer"
it is better to use it instead ofrcu_assign_pointer()because it has a smaller overhead.
Quoted 7 lines
The following Coccinelle semantic patch was used:
@@
@@-
rcu_assign_pointer
+RCU_INIT_POINTER
(..., NULL)
The same objection as here: https://lkml.org/lkml/2014/3/23/96
Thanks.
Signature · 1 line
Dmitry