From patchwork Wed Nov 23 20:18:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 25194 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3009197wrr; Wed, 23 Nov 2022 12:22:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf7FXkZkf2ns/2o7vSVXrs0HJRVhzH/LRBKrzj4LlbDTVIVqJTLj23of9a9AzSxqrbyhDgxJ X-Received: by 2002:a17:906:2552:b0:7ad:917b:61ec with SMTP id j18-20020a170906255200b007ad917b61ecmr11440058ejb.513.1669234964713; Wed, 23 Nov 2022 12:22:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669234964; cv=none; d=google.com; s=arc-20160816; b=Y2AjGWQGECFx33nRjNvqc+LFTmzt7fQvhPzy+U8vD9rwF0pYm6B11yMW/x88d9frOY x1ZfAD5C2UZczs6jTutaV65VbpyGwcycbc5Wn6WHIpB8wdMMVZgzfClbgm+Q896YU2wB Pus76Iisq+YJOlfA/1+xKSf/s0+M48oKNyX/FgplVRp06IJinRcRwpv3GBdTgqMbqmZC KWr/gu2EqHSeQm38Eao/mrC1YWubeqjISSM11mvOlNjwcd/0/2Ppm7eIK3w7GTnF7G9M jy5n9afMyTjyn9dDZJINNwWFUdTQoWuYSCVo49HlHbIW8s10+9LhtjIStufs94sk5Q92 XlHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=9aovE9SsY83ZBBgWbgO0H2UxzRJSCD39AJ6NU6FG1LY=; b=RTCX8hcZ1jAA1AeXt+q50ddMyPhOO5cf1qnog9PQYTq+t6/0nWOAWBnNY+3XKHcmz8 GoKzKGL4ulOtxrcF3nmwloEoVH47dYV8jk+escG8Mc/Atf/xjR6qQBW3QP5zqjzAWkxm vbZAY+1zpwFgMUz9ymD81UeIFkWVfNj2+IEe9YQo0sPYgHtUL65GykBGhrE77zuDxhY4 z4YJ3ykDHt/oOPXpOzp0Qa9Sv+MaxUwzAKJ912wZ73tLuaVcwwUhBN73AfN6eNpeLH2A LjGOfmXjC1TB5aU1ZjxUWicUGXyAv0lnSt5wp07WemA7wou6eqMKIX09RnSEfhUqAOBe ohmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="ap/DBinm"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qc24-20020a170906d8b800b007ae8a4b03d7si12242544ejb.973.2022.11.23.12.22.20; Wed, 23 Nov 2022 12:22:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="ap/DBinm"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239796AbiKWUVc (ORCPT + 99 others); Wed, 23 Nov 2022 15:21:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239403AbiKWUUf (ORCPT ); Wed, 23 Nov 2022 15:20:35 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EED97BF5AF; Wed, 23 Nov 2022 12:18:54 -0800 (PST) Message-ID: <20221123201624.954785441@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669234724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=9aovE9SsY83ZBBgWbgO0H2UxzRJSCD39AJ6NU6FG1LY=; b=ap/DBinmESrU5PswQAz1fTDCTpjoban93gqTgfXUWnTbp8XWAhpO72DbRtjnNva4DBwNOb CnLdVcgK4/TtbLESHnQi2GKu8nIxRqul2jXQpqjiGqwZbfVpDdeL1aY8x6YwtIaPCqnffG wYXfFTzorCV9JTe74qqlMfAoIZf2ukwIFh0AQdEYxeBkebPl0KMtIXKir/B9bMdARWilTK ZSWWnQbRZauVzwd1CoGAX5MLnPfhQIyc68Q+6UCNXvxW0WIZPYvvbm8X/WkasvD2oBZ/cI T0Fha2YjLLe421KfwwjXDU8vJT6BbmK1Vsu87Xx3Eia+wru7LVPAxEPT7rwVtg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669234724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=9aovE9SsY83ZBBgWbgO0H2UxzRJSCD39AJ6NU6FG1LY=; b=rGvZGpizAO3Cf9dY+7n2noKeNPiOVblL+DuS0Y0BANN1X2CFnzbwW+MuPusJxc0++c9u8T VJFOGDipEaiGB9DA== From: Thomas Gleixner To: LKML Cc: Linus Torvalds , Steven Rostedt , Anna-Maria Behnsen , Peter Zijlstra , Stephen Boyd , Guenter Roeck , Andrew Morton , Julia Lawall , Arnd Bergmann , Viresh Kumar , Marc Zyngier , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, Jacob Keller Subject: [patch V3 09/17] timers: Rename del_timer_sync() to timer_delete_sync() References: <20221123201306.823305113@linutronix.de> MIME-Version: 1.0 Date: Wed, 23 Nov 2022 21:18:44 +0100 (CET) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750319722525752359?= X-GMAIL-MSGID: =?utf-8?q?1750319722525752359?= The timer related functions do not have a strict timer_ prefixed namespace which is really annoying. Rename del_timer_sync() to timer_delete_sync() and provide del_timer_sync() as a wrapper. Document that del_timer_sync() is not for new code. Signed-off-by: Thomas Gleixner Reviewed-by: Steven Rostedt (Google) Reviewed-by: Jacob Keller Tested-by: Guenter Roeck --- include/linux/timer.h | 15 ++++++++++++++- kernel/time/timer.c | 18 +++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -183,7 +183,20 @@ extern int timer_reduce(struct timer_lis extern void add_timer(struct timer_list *timer); extern int try_to_del_timer_sync(struct timer_list *timer); -extern int del_timer_sync(struct timer_list *timer); +extern int timer_delete_sync(struct timer_list *timer); + +/** + * del_timer_sync - Delete a pending timer and wait for a running callback + * @timer: The timer to be deleted + * + * See timer_delete_sync() for detailed explanation. + * + * Do not use in new code. Use timer_delete_sync() instead. + */ +static inline int del_timer_sync(struct timer_list *timer) +{ + return timer_delete_sync(timer); +} extern void init_timers(void); struct hrtimer; --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1083,7 +1083,7 @@ static inline int /* * We are trying to schedule the timer on the new base. * However we can't change timer's base while it is running, - * otherwise del_timer_sync() can't detect that the timer's + * otherwise timer_delete_sync() can't detect that the timer's * handler yet has not finished. This also guarantees that the * timer is serialized wrt itself. */ @@ -1261,7 +1261,7 @@ EXPORT_SYMBOL_GPL(add_timer_on); * @timer: The timer to be deactivated * * The function only deactivates a pending timer, but contrary to - * del_timer_sync() it does not take into account whether the timer's + * timer_delete_sync() it does not take into account whether the timer's * callback function is concurrently executed on a different CPU or not. * It neither prevents rearming of the timer. If @timer can be rearmed * concurrently then the return value of this function is meaningless. @@ -1397,7 +1397,7 @@ static inline void del_timer_wait_runnin #endif /** - * del_timer_sync - Deactivate a timer and wait for the handler to finish. + * timer_delete_sync - Deactivate a timer and wait for the handler to finish. * @timer: The timer to be deactivated * * Synchronization rules: Callers must prevent restarting of the timer, @@ -1419,10 +1419,10 @@ static inline void del_timer_wait_runnin * spin_lock_irq(somelock); * * spin_lock(somelock); - * del_timer_sync(mytimer); + * timer_delete_sync(mytimer); * while (base->running_timer == mytimer); * - * Now del_timer_sync() will never return and never release somelock. + * Now timer_delete_sync() will never return and never release somelock. * The interrupt on the other CPU is waiting to grab somelock but it has * interrupted the softirq that CPU0 is waiting to finish. * @@ -1435,7 +1435,7 @@ static inline void del_timer_wait_runnin * * %0 - The timer was not pending * * %1 - The timer was pending and deactivated */ -int del_timer_sync(struct timer_list *timer) +int timer_delete_sync(struct timer_list *timer) { int ret; @@ -1475,7 +1475,7 @@ int del_timer_sync(struct timer_list *ti return ret; } -EXPORT_SYMBOL(del_timer_sync); +EXPORT_SYMBOL(timer_delete_sync); static void call_timer_fn(struct timer_list *timer, void (*fn)(struct timer_list *), @@ -1497,8 +1497,8 @@ static void call_timer_fn(struct timer_l #endif /* * Couple the lock chain with the lock chain at - * del_timer_sync() by acquiring the lock_map around the fn() - * call here and in del_timer_sync(). + * timer_delete_sync() by acquiring the lock_map around the fn() + * call here and in timer_delete_sync(). */ lock_map_acquire(&lockdep_map);