From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AB9B1F9A99; Tue, 17 Dec 2024 17:33:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.134.164.104 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734456810; cv=none; b=qG/dAVqqYJ+bcu0BwLNVE8tKk2botf+7/tPs1CQ3CJ7Ktcf5o8VgRPjiPE7/dctBuRX/JMGR05RnQpI2y4+EHlHdwtJnwEGErMU6ctmvwUvM7KY77W86ewOi0zv+XcssWlHRLnDGG6Ot5DmLcTtAKUOS2w2RxgN1kEcAaF348DM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734456810; c=relaxed/simple; bh=hUI124COUPuTuBzVlqt9m3OtX7cmjQ7JUH8JgbG9mRQ=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=uBK0UaO6II+ZVUKJbMHNj+fVIKxWCOm5IiiekewXQ5o3DW0DSn2CB3LgTXt6I9rnj5K7wOibtcoGPesxA7XMebG55nlKFmVe3F9sK8ITNm0+Z85w9fCYOjqh4W2X5dzYBjH50kpl7o4bh1lav1J3bbKWtbfBH5GMd0DwjoUrufE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr; spf=pass smtp.mailfrom=inria.fr; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b=EaNS0yuh; arc=none smtp.client-ip=192.134.164.104 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="EaNS0yuh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=04pTIo5ApWySSg1irLecWsNtdqZYhiDphbsaLsL2++E=; b=EaNS0yuhC4s6iN6WnIrnfVVUKM6YqvVWkIbgcSrxq8z6qdZxbvXYN/B4 9evJrozXCky5ezt+egWk2fvFzCjCGhd/6dlOUNDuVRw1L3nJUFrUuyJTW ezsZJHG7RK8qkYyuGARiZzCMp891lCLljEEn1C5atxdbFGiHm+3aLIRi2 4=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=julia.lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.12,242,1728943200"; d="scan'208";a="104581457" Received: from 231.85.89.92.rev.sfr.net (HELO hadrien) ([92.89.85.231]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2024 18:33:20 +0100 Date: Tue, 17 Dec 2024 18:33:18 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Alexander Gordeev cc: Easwar Hariharan , Pablo Neira Ayuso , Jozsef Kadlecsik , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Julia Lawall , Nicolas Palix , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Ofir Bitton , Oded Gabbay , Lucas De Marchi , =?ISO-8859-15?Q?Thomas_Hellstr=F6m?= , Rodrigo Vivi , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jeroen de Borst , Praveen Kaligineedi , Shailend Chand , Andrew Lunn , James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" , =?ISO-8859-15?Q?Roger_Pau_Monn=E9?= , Jens Axboe , Kalle Valo , Jeff Johnson , Catalin Marinas , Andrew Morton , Jack Wang , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Greg Kroah-Hartman , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Xiubo Li , Ilya Dryomov , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Jaroslav Kysela , Takashi Iwai , Louis Peens , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Madhavan Srinivasan , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, cocci@inria.fr, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-scsi@vger.kernel.org, xen-devel@lists.xenproject.org, linux-block@vger.kernel.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-mm@kvack.org, linux-bluetooth@vger.kernel.org, linux-staging@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, ceph-devel@vger.kernel.org, live-patching@vger.kernel.org, linux-sound@vger.kernel.org, oss-drivers@corigine.com, linuxppc-dev@lists.ozlabs.org, Anna-Maria Behnsen Subject: Re: [PATCH v3 02/19] coccinelle: misc: Add secs_to_jiffies script In-Reply-To: Message-ID: References: <20241210-converge-secs-to-jiffies-v3-0-ddfefd7e9f2a@linux.microsoft.com> <20241210-converge-secs-to-jiffies-v3-2-ddfefd7e9f2a@linux.microsoft.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Tue, 17 Dec 2024, Alexander Gordeev wrote: > On Tue, Dec 10, 2024 at 10:02:33PM +0000, Easwar Hariharan wrote: > > Hi Easwar, > > > This script finds and suggests conversions of timeout patterns that > > result in seconds-denominated timeouts to use the new secs_to_jiffies() > > API in include/linux/jiffies.h for better readability. > > > > Suggested-by: Anna-Maria Behnsen > > Signed-off-by: Easwar Hariharan > > --- > > scripts/coccinelle/misc/secs_to_jiffies.cocci | 22 ++++++++++++++++++++++ > > 1 file changed, 22 insertions(+) > > > > diff --git a/scripts/coccinelle/misc/secs_to_jiffies.cocci b/scripts/coccinelle/misc/secs_to_jiffies.cocci > > new file mode 100644 > > index 0000000000000000000000000000000000000000..8bbb2884ea5db939c63fd4513cf5ca8c977aa8cb > > --- /dev/null > > +++ b/scripts/coccinelle/misc/secs_to_jiffies.cocci > > @@ -0,0 +1,22 @@ > > +// SPDX-License-Identifier: GPL-2.0-only > > +/// > > +/// Find usages of: > > +/// - msecs_to_jiffies(value*1000) > > +/// - msecs_to_jiffies(value*MSEC_PER_SEC) > > +/// > > +// Confidence: High > > +// Copyright: (C) 2024 Easwar Hariharan, Microsoft > > +// Keywords: secs, seconds, jiffies > > +// > > + > > +virtual patch > > + > > +@depends on patch@ constant C; @@ > > + > > +- msecs_to_jiffies(C * 1000) > > ++ secs_to_jiffies(C) > > + > > +@depends on patch@ constant C; @@ > > + > > +- msecs_to_jiffies(C * MSEC_PER_SEC) > > ++ secs_to_jiffies(C) > > If you used this script only, then it did not seem to recognize line arch/s390/mm/cmm.c:207 > > mod_timer(&cmm_timer, jiffies + msecs_to_jiffies(cmm_timeout_seconds * MSEC_PER_SEC)); There is the requirement that C is a constant, and cmm_timeout_seconds is not considered to be a constant, ie it is not all capital letters. Indeed, it doesn't seem to be a constant at all. I don't know if the requirement of being a comstant is really necessary. julia > > Thanks! >