diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-12-15 15:41:05 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-01-08 15:13:38 +0000 |
commit | 01b3e68bb18d1a37f013ffac41423faa7c00958f (patch) | |
tree | 5efdfee8f830db10d9700631d914f93da401d514 /scripts | |
parent | 5f8e93c3e262ab518c9e8f9a5bb2b391b3d64be9 (diff) | |
download | qemu-01b3e68bb18d1a37f013ffac41423faa7c00958f.zip qemu-01b3e68bb18d1a37f013ffac41423faa7c00958f.tar.gz qemu-01b3e68bb18d1a37f013ffac41423faa7c00958f.tar.bz2 |
scripts/coccinelle: New script to remove unnecessary timer_del() calls
Now that timer_free() implicitly calls timer_del(), sequences
timer_del(mytimer);
timer_free(mytimer);
can be simplified to just
timer_free(mytimer);
Add a Coccinelle script to do this transformation.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20201215154107.3255-3-peter.maydell@linaro.org
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/coccinelle/timer-del-timer-free.cocci | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/coccinelle/timer-del-timer-free.cocci b/scripts/coccinelle/timer-del-timer-free.cocci new file mode 100644 index 0000000..c3cfd42 --- /dev/null +++ b/scripts/coccinelle/timer-del-timer-free.cocci @@ -0,0 +1,18 @@ +// Remove superfluous timer_del() calls +// +// Copyright Linaro Limited 2020 +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch --macro-file scripts/cocci-macro-file.h \ +// --sp-file scripts/coccinelle/timer-del-timer-free.cocci \ +// --in-place --dir . +// +// The timer_free() function now implicitly calls timer_del() +// for you, so calls to timer_del() immediately before the +// timer_free() of the same timer can be deleted. + +@@ +expression T; +@@ +-timer_del(T); + timer_free(T); |