From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5862C43381 for ; Fri, 8 Jan 2021 15:43:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 215C423888 for ; Fri, 8 Jan 2021 15:43:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 215C423888 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtv2-0004Sn-8b for qemu-devel@archiver.kernel.org; Fri, 08 Jan 2021 10:43:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtof-0004qb-MA for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:41 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:35449) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoe-0002vT-2j for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:41 -0500 Received: by mail-wr1-x434.google.com with SMTP id r3so9441653wrt.2 for ; Fri, 08 Jan 2021 07:36:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/bYzZPH4tKpsMQvtJRcHRyaf4REHsMCcIzPJUmKEZHg=; b=Ncn5h/od/Lwq0s3apIH+SckOpN0F+Tlqdh9iSK3uEjzrCgdV5Z81IXUB+tIrkgQBLS sinFL5lAWR6PSvii/QMMwNOa+GNcnsKzIAsTHyN9asL07utOvIEEupAGflJTih3MAp1f 5NfSFNCiSQNFAwv5DrvjpprzTR9OzU3ZilVsSK47EiIrEoneYEbFFDblUsmEmmtWQets aPuHnxCheHKf5pNWbD/ITuLJ1yOq1MN2Yaaz3mKoYEJPh+pEYj2QxwNzOgxnoG95NJPK +hHldmy2ac/sHR0Dz3gAc9CKCEkGo2KFiBr2RbgPb9oZLPz3B4GSpd7c3LDnqY4kP2Nn z9Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/bYzZPH4tKpsMQvtJRcHRyaf4REHsMCcIzPJUmKEZHg=; b=PlXvtNEUvweL+OYDzGcB8v+GHYwAlstnxLC4NesG4N1+DM9rUh1x9VKq6F9nZu4mS3 7ACDxKh3tZ83cuxnUtpBNkiDeS9FNUOSJgFc9qMCxjR70aV3JbQX9f3ziBUl+iwAHmNf 4sdaqRatTXdmN8yjA9Bj1blhdaldEG11YBijNoBol2sDA9F1oJm1ZkstSvLcGDbrIzzV VDvBc4gbP9y1u9tUuwMI49LSn66dhWGxYrm9ObL+90m50KNIcXIVjUCRPP9nVeL5tt0X bwKHXi5f3EM/6uPYLDl3sGk6JIi5lnXqi+u0RZ+xdI5PdQ5sr/OCf9XgH5ASEPY7g5Ez ZEMw== X-Gm-Message-State: AOAM533ar1xbzQ5bis0r3DJ4bFdE3IW4ZVTb30tIr7PZEH9fjLOYxh73 E0/vgaK8VWD7ccvcIX5NWznQLGprWBvefQ== X-Google-Smtp-Source: ABdhPJy2PM7JEy6qRKzIRnYPQ3jVy09y2MeCN5KHm9uNwKXwXd+ok8wh2I1Ta5q9m9tP9lXj+UHfYQ== X-Received: by 2002:adf:dd92:: with SMTP id x18mr4239280wrl.311.1610120198523; Fri, 08 Jan 2021 07:36:38 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:37 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/23] scripts/coccinelle: New script to remove unnecessary timer_del() calls Date: Fri, 8 Jan 2021 15:36:08 +0000 Message-Id: <20210108153621.3868-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Acked-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20201215154107.3255-3-peter.maydell@linaro.org --- scripts/coccinelle/timer-del-timer-free.cocci | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/coccinelle/timer-del-timer-free.cocci diff --git a/scripts/coccinelle/timer-del-timer-free.cocci b/scripts/coccinelle/timer-del-timer-free.cocci new file mode 100644 index 00000000000..c3cfd428039 --- /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); -- 2.20.1