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.7 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 D9315C2BB40 for ; Mon, 14 Dec 2020 20:32:47 +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 7ACBC2226A for ; Mon, 14 Dec 2020 20:32:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7ACBC2226A 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]:42032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kouWU-0006ew-D6 for qemu-devel@archiver.kernel.org; Mon, 14 Dec 2020 15:32:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kouUk-0004zl-VR for qemu-devel@nongnu.org; Mon, 14 Dec 2020 15:30:58 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:52055) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kouUi-0007ca-D0 for qemu-devel@nongnu.org; Mon, 14 Dec 2020 15:30:58 -0500 Received: by mail-wm1-x344.google.com with SMTP id v14so14959091wml.1 for ; Mon, 14 Dec 2020 12:30:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=21KnFkdAMVkSF+cDRYsDtvMiTW+sOKxoFovUdhz8oFk=; b=HyoF9ZygFpv3Vr4Lrw80gfm6wFsO371gKij+OqyV4Votevvm1/MTXzv5VmDuXuiVNg 67z3EZyrlPhIMHAgc3AvwfUPg1gZcy3qwHWIJZdydvExhyJz3OaT6Fmzp2lwcsaa2qMF hcfjpVUmUUZRD+eEsWInsPyoFLAuLa4GofMLaIPy70I4vOn8DSMgiLeisLszi7G2tlKF QVnjVz9igDZm2rL3qM4Zc2GZn0NmUvbkfzWag64h1LKGhOnegBESUDuAJ9MPtJeq6uvC BYvwSLcxAVwVfWKFTz6mHMmQXqzBLapUiV1DDbLww0RgYL/l2CgPxQMx33ai7xrIzf8g Zesg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=21KnFkdAMVkSF+cDRYsDtvMiTW+sOKxoFovUdhz8oFk=; b=iDqw2FksLe0YEuJGJdvfn22LmJ8FjzTabEYbImburuxsYXBeXPNpwZut3crVRJv8Sq WhQr8IHu1dmpJmDgzUG4SOEyobZSv0lGrSzEIzZZe1YPhW7EpOxtxGTilOdPe4CD1R2I jwUSa3yk6Xf7iGvkCN3AI/HasOlLvYXAxlPXgnbVxg7Kd2EaC+5JDUymRZBXWqsLlec8 lU6N2Wm0NM3L0O36y5ylA2j62Nt1OUY8lXwbw0C7hPeP3hlcOiFEsaQ23oardj8/17f/ /yUDroD+sTZp6sfxShJTAdHFiNRLKPlX9W3J+MEEalFdZXc1hVyRtT1E9HAToJme6KpS 6XUw== X-Gm-Message-State: AOAM5333zkMAOwaLm6t5KkMPUSDnkYIpVODWJFp5ANk42EvHy97KWIc/ /aly5FJHcPme5tZnF3wnqndpXZKk82r2Pg== X-Google-Smtp-Source: ABdhPJzgQ2e0cFREZH1NzZ3l81olXPlc9xcwlU+hO4wXjgUnXl2IXr32MplAOBBk/7E5n5DhEP2j9w== X-Received: by 2002:a1c:2c83:: with SMTP id s125mr29720858wms.161.1607977854812; Mon, 14 Dec 2020 12:30:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id b7sm34273589wrv.47.2020.12.14.12.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 12:30:54 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 2/3] scripts/coccinelle: New script to remove unnecessary timer_del() calls Date: Mon, 14 Dec 2020 20:30:49 +0000 Message-Id: <20201214203050.6993-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201214203050.6993-1-peter.maydell@linaro.org> References: <20201214203050.6993-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x344.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: , Cc: Paolo Bonzini , Richard Henderson 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 --- 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