From patchwork Tue Nov 22 17:44:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 24485 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2353466wrr; Tue, 22 Nov 2022 09:47:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf5GSo9iXWnioe1AaOkdeAI1Uth8WxpDz1WbzbB5X6oGtN5Wi6EU3F3nt1Yf2g3AVLsl2aWH X-Received: by 2002:a17:902:cf4b:b0:186:7a1d:b6ee with SMTP id e11-20020a170902cf4b00b001867a1db6eemr9819128plg.67.1669139255356; Tue, 22 Nov 2022 09:47:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669139255; cv=none; d=google.com; s=arc-20160816; b=YxbpThszRtbYraigSbEONVY5EQ/BbMP4TiDMVpPoZ2AwJGO/JOA9VYYVvZKPGDdzTF h2sMZLXM/AX5s+/whOzWrVQ7VQKP4FAT7NGkPP+6H22a/AyEQ5bPKhmiZX38YuuIJ+Ef SejzadbKL2jV3veSo2GBAKDtbq8ThyI1ub9HStR317za/8I6ff3rCtmGxh+ksGBqo6PH HIjB6HgN8h1Yj6hijjCNdDqeJ2vN7aNhsPRG5+zhAO59k7Pue4PL3fT3zADAsTlAcxL7 NSYqbQ5M5Jus4q+yujbogqclmV396akntBHFOw9JHWmdZ66OAa8zwn5jwR2EopQuokt3 QhaQ== 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=loWOeteSDfXqDwCwhR8PkMj0fJ4Wcn9TP/qRmPXVBa4=; b=SIbruogDBf2OZszcwPmIgPFQTARJYguwHGP4LtDJb+a87sJxB8lGC3kzlzp+AKlT+g FWfyy8RBFN47i5eT459XqHevEPA7KAE85v+liYmUZKcp+XwoSbQoDwji3ufdk3pV2TpJ Y5WhOH15v3mEaE4xhT5DGcEpandmbLXNX1Wa1s0qSd/uuAjr+3sj70WqPDYER2v+KrFL b8LLjMO/sMjdEUu8+UjQ/32NXgu1tV24i+lhTiw8o+tndaa7VXv6Rhn0KRvdxfWKpK17 r/OcZlzH+AGw7vFyzSXyDyYTu8Yi8fN9Kh2sDqbhumO5zcp/C8M8f0meYS8sIhBFc3+m PbMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0hGO5Wk0; dkim=neutral (no key) header.i=@linutronix.de header.b=kzKXKPXw; 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 j7-20020a170903024700b001836e510540si15772828plh.114.2022.11.22.09.47.21; Tue, 22 Nov 2022 09:47:35 -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=0hGO5Wk0; dkim=neutral (no key) header.i=@linutronix.de header.b=kzKXKPXw; 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 S233498AbiKVRp4 (ORCPT + 99 others); Tue, 22 Nov 2022 12:45:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234425AbiKVRp3 (ORCPT ); Tue, 22 Nov 2022 12:45:29 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A90347AF7A; Tue, 22 Nov 2022 09:45:00 -0800 (PST) Message-ID: <20221122173648.619071341@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669139099; 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=loWOeteSDfXqDwCwhR8PkMj0fJ4Wcn9TP/qRmPXVBa4=; b=0hGO5Wk0pIFm1S0qXeQ7PdXOz5PGq9RcqJf+EmVCFF9bex2AVxb7gkfQnxHICeUi7/Ofuh 48V9LXYVsWvLvrvtLAc0iwSq/iSlDCxv91iy9EKhkMlJsVs5rEkw8/mNfElda3OynSfpol LI8lc6naiyJ1JLUj0ip9QTVlns8m+Ac4IZW7XvnECZ6oE45BuisMRZyJRaEwaMadBWEPDc 2lgqKklCAGeS+HNbHTasKvZQ7hypSXUsAmYEOPBviKCesT1hq21R5jefyA8lK78lPHXWaV 8VS1tyDeFLdoLFs3Rj3jvJ3ij/YuZ3PJ3ksst1VziEqbsO9wSs1odqw2PynWjw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669139099; 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=loWOeteSDfXqDwCwhR8PkMj0fJ4Wcn9TP/qRmPXVBa4=; b=kzKXKPXw/BGYqj/wvLmudmM7Vc295HgkEEBR1suH31GOdddL+BaN6HBZIeYF6GHCSfOgG7 6M9XpNmCuBPLjoAQ== 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 Subject: [patch V2 09/17] timers: Rename del_timer_sync() to timer_delete_sync() References: <20221122171312.191765396@linutronix.de> MIME-Version: 1.0 Date: Tue, 22 Nov 2022 18:44:58 +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?1750219364150369053?= X-GMAIL-MSGID: =?utf-8?q?1750219364150369053?= 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) 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. */ @@ -1257,7 +1257,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 timers + * timer_delete_sync() it does not take into account whether the timers * 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. @@ -1393,7 +1393,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, @@ -1415,10 +1415,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. * @@ -1431,7 +1431,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; @@ -1471,7 +1471,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 *), @@ -1493,8 +1493,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);