From patchwork Thu Nov 24 14:16:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 25583 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3427103wrr; Thu, 24 Nov 2022 06:23:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf6VVZhC/qZZpsxfmsXtcSfrJ2x682hCU+/RbGwM4FiiB5mzxs3a3M1g3BFNkphF6Et69Jvk X-Received: by 2002:a63:4081:0:b0:46f:e657:7d25 with SMTP id n123-20020a634081000000b0046fe6577d25mr29757268pga.347.1669299806682; Thu, 24 Nov 2022 06:23:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669299806; cv=none; d=google.com; s=arc-20160816; b=PBD4ThKTwj9ACmafR5zVAmmYjogBh2ID7M/EREMYkajNVE0aLXn0flCi8ee+pSZjdm yElDhEK7pEy/BeHvMw0AHO0VcDSTz9gsk0KPGP48VEi3SFBwqB37uAA1fjoQjkX7q8gz sJ1NTTLVE40zM9FkW35R0ZS/C9jET5jmCJfBUMJ5YI1tiCK5sUGy4pp6JzgVZ3Dk08mj uuNEuHyPcQtBsq/dKBvYCqmCqiXti6xlzMZMYGZu1sYVV0bTYicpDNVy5BFZ4SFUB1gZ S3+vtXAlTg5/Erprd0rWxIMF8cWSATPT++y4i3ynASqwfPonrNKmAHqKVxOfVuNshJUL JRWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=0klFvZRzkAzJUNjtkCTAHP2fEhMgrrwQ/1ZeGmyjOro=; b=rXRI5ER0gmhg6KeUX40ZsY+WxcIXF4Gn1+wZjOOQXpM+0Kdq3g+a2HFvhyeTgEC2dP fDyAcDVhVCc9V6XLuqcCIy1RdwKYrwsjrgdj/llu6SxmSM8RhwLb5XOln598JPUKuRP6 NioqZgeeFgUKpXMosv2jOUL95ku60Pm7+mNvIdl8f3nQds1w9jTLqhE+w2Y00qNPWb4K 0kr/3E4569+ZVIuQXo3ixItsLPlQuI14Y2F2q0XUJbTFRQUuDN14lTnwaWk2EH3OEkwx G62bUNxkMOZ3A+4VZdGcZnafT5mN+9QHiY85UsshCw7QY0+1D1QtObCTXrWj+juRt9UC EZtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Yjh4QClk; 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 n13-20020a63a50d000000b0045b22d763a3si1637065pgf.483.2022.11.24.06.23.13; Thu, 24 Nov 2022 06:23:26 -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=Yjh4QClk; 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 S230307AbiKXOQm (ORCPT + 99 others); Thu, 24 Nov 2022 09:16:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbiKXOQN (ORCPT ); Thu, 24 Nov 2022 09:16:13 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 275DFFCDE5; Thu, 24 Nov 2022 06:16:12 -0800 (PST) Date: Thu, 24 Nov 2022 14:16:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669299370; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0klFvZRzkAzJUNjtkCTAHP2fEhMgrrwQ/1ZeGmyjOro=; b=Yjh4QClkCK0amkkUBzueVtbJDNV5U3SzjCCPDLcL7ZfEbs3iZgt4QmNnDSuYn5QR6NOxr2 9BOK3qVTB23eMsKZODfbgmv4p7w1PYT25CvChLoZJ2+Tc5nU0y4r2tGxG4UO5lIU5UaJIb 6EEse4d3qSB8lBzDs59qMLLw7ATOEqA0GqM+bDAs2kNu+Kps8KkR75YG7yNGIHvPqPukPi W5CUJkPbr63o/DqQNHPNfuMYvZ4yhcvpePEJrnhYy0rwRd0zeAZrO9wzPEE6ob6AkYyEQ7 c491EEXvi2+o44gAWBiOBDWj1zMVEVXC+MK4/rR+ci0GPOGRR0KBKd2DqaVuPQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669299370; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0klFvZRzkAzJUNjtkCTAHP2fEhMgrrwQ/1ZeGmyjOro=; b=3YT4sSUs42u34OkMJSWEWL8oQIq4+V5EbcHdTIVyyOYDyZNJLNiMAbsRlX/z1xoTlx3MUf BfNsk3C0QxcicMDA== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] timers: Rename del_timer_sync() to timer_delete_sync() Cc: Thomas Gleixner , Guenter Roeck , "Steven Rostedt (Google)" , Jacob Keller , "Anna-Maria Behnsen" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221123201624.954785441@linutronix.de> References: <20221123201624.954785441@linutronix.de> MIME-Version: 1.0 Message-ID: <166929936893.4906.6484824433900031971.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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?1750387713914362045?= The following commit has been merged into the timers/core branch of tip: Commit-ID: 9b13df3fb64ee95e2397585404e442afee2c7d4f Gitweb: https://git.kernel.org/tip/9b13df3fb64ee95e2397585404e442afee2c7d4f Author: Thomas Gleixner AuthorDate: Wed, 23 Nov 2022 21:18:44 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 24 Nov 2022 15:09:11 +01:00 timers: Rename del_timer_sync() to timer_delete_sync() 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 Tested-by: Guenter Roeck Reviewed-by: Steven Rostedt (Google) Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/r/20221123201624.954785441@linutronix.de --- include/linux/timer.h | 15 ++++++++++++++- kernel/time/timer.c | 18 +++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/include/linux/timer.h b/include/linux/timer.h index 31b8b60..551fa46 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -183,7 +183,20 @@ extern int timer_reduce(struct timer_list *timer, unsigned long expires); 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; diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 550f0df..60e538b 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1083,7 +1083,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, unsigned int option /* * 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_running(struct timer_list *timer) { } #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_running(struct timer_list *timer) { } * 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_running(struct timer_list *timer) { } * * %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 *timer) 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_list *timer, #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);