drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
Subsystems (2)
PATCH 1/1 drm/amdgpu: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
The rcu_assign_pointer() ensures that the initialization of a structure is carried out before storing a pointer to that structre. It is always safe to use RCU_INIT_POINTER() to NULL a pointer, instead of rcu_assign_pointer().
This results in slightly smaller/faster code.
The following semantic patch was used:
<smpl>
@@
@@
- rcu_assign_pointer
+ RCU_INIT_POINTER
(..., NULL)
</smpl>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +1 -1
@@ -198,7 +198,7 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)/* There is always exactly one thread signaling this fence slot */ fence =rcu_dereference_protected (*ptr,1 ); -rcu_assign_pointer (*ptr,NULL ); +RCU_INIT_POINTER (*ptr,NULL );BUG_ON (!fence);
Signature · 1 line
1.9.1
Am 30.04.2016 um 21:00 schrieb Muhammad Falak R Wani:
Quoted 5 lines
The
rcu_assign_pointer()ensures that the initialization of a structure is carried out before storing a pointer to that structre. It is always safe to useRCU_INIT_POINTER()to NULL a pointer, instead ofrcu_assign_pointer().
This results in slightly smaller/faster code.
Thanks for the detailed explanation, I was already wondering what the difference is between the two.
Quoted 7 lines
The following semantic patch was used:
<smpl>@@
@@
Quoted 7 lines
-
rcu_assign_pointer
+RCU_INIT_POINTER
(..., NULL)</smpl>
Signed-off-by Muhammad Falak R Wani <[email protected]>
Regards,
Christian.
Quoted 17 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +1
-1@@ -198,7 +198,7 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)/* There is always exactly one thread signaling this fence slot */ fence =rcu_dereference_protected (*ptr,1 ); -rcu_assign_pointer (*ptr,NULL ); +RCU_INIT_POINTER (*ptr,NULL );BUG_ON (!fence);
Alex Deucher
AppliedQuoted 23 lines · Christian König
Am 30.04.2016 um 21:00 schrieb Muhammad Falak R Wani:
Quoted 6 lines
The
rcu_assign_pointer()ensures that the initialization of a structure is carried out before storing a pointer to that structre. It is always safe to useRCU_INIT_POINTER()to NULL a pointer, instead ofrcu_assign_pointer().
This results in slightly smaller/faster code.Thanks for the detailed explanation, I was already wondering what the difference is between the two.
Quoted 11 lines
The following semantic patch was used:
<smpl>@@
@@-
rcu_assign_pointer
+RCU_INIT_POINTER
(..., NULL)
Quoted 6 lines
Quoted 3 lines
</smpl>
Signed-off-by Muhammad Falak R Wani <[email protected]>Reviewed-by Christian König <[email protected]>
Applied. thanks!
Alex
Quoted 19 lines
Regards,
Christian.Quoted 15 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0
-0@@ -198,7 +198,7 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)/* There is always exactly one thread signaling this fence slot */
fence = rcu_dereference_protected(*ptr, 1);drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +1
-1-rcu_assign_pointer (*ptr,NULL ); +RCU_INIT_POINTER (*ptr,NULL );
Quoted 8 lines
Quoted 2 lines
BUG_ON(!fence);_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel