summary refs log tree commit diff stats
path: root/scripts/coccinelle/exec_rw_const.cocci
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2020-02-20 10:39:00 +0100
committerPhilippe Mathieu-Daudé <philmd@redhat.com>2020-02-20 14:47:08 +0100
commit18610bfd3e9a91c174e009c0528c9c0dc1ffb888 (patch)
treec4d57ff5a979a762867d6576b1df600b161980da /scripts/coccinelle/exec_rw_const.cocci
parent4b314c1a71e398f428de69ae719967cd9902f61d (diff)
downloadfocaccia-qemu-18610bfd3e9a91c174e009c0528c9c0dc1ffb888.tar.gz
focaccia-qemu-18610bfd3e9a91c174e009c0528c9c0dc1ffb888.zip
hw: Remove unnecessary cast when calling dma_memory_read()
Since its introduction in commit d86a77f8abb, dma_memory_read()
always accepted void pointer argument. Remove the unnecessary
casts.

This commit was produced with the included Coccinelle script
scripts/coccinelle/exec_rw_const.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
v4: Drop parenthesis when removing cast (Eric Blake)
Diffstat (limited to 'scripts/coccinelle/exec_rw_const.cocci')
-rw-r--r--scripts/coccinelle/exec_rw_const.cocci23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/coccinelle/exec_rw_const.cocci b/scripts/coccinelle/exec_rw_const.cocci
new file mode 100644
index 0000000000..7e42682240
--- /dev/null
+++ b/scripts/coccinelle/exec_rw_const.cocci
@@ -0,0 +1,23 @@
+/*
+  Usage:
+
+    spatch \
+           --macro-file scripts/cocci-macro-file.h \
+           --sp-file scripts/coccinelle/exec_rw_const.cocci \
+           --keep-comments \
+           --in-place \
+           --dir .
+*/
+
+// Remove useless cast
+@@
+expression E1, E2, E3, E4;
+type T;
+@@
+(
+- dma_memory_read(E1, E2, (T *)(E3), E4)
++ dma_memory_read(E1, E2, E3, E4)
+|
+- dma_memory_write(E1, E2, (T *)(E3), E4)
++ dma_memory_write(E1, E2, E3, E4)
+)