From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 537664A13A2 for ; Thu, 2 Jul 2026 09:42:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782985336; cv=none; b=POFKQW/vlvzigzince26f9t6LFEvwO9Xk9TRnx/SsKc5YK+fC3rNuxeedkPBzavgupo1Urh9wstpGVEMhcvCfYpzKrbLTjW7ovJMU/sND3yZLaKrd1e2qlo1mfOmMDRVFxrGbO73TDiyRavpNLsB4MnYOLe0mo5sb6QMx7dzEzo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782985336; c=relaxed/simple; bh=Lz2Kn7Jk8oyXgf/iwnBxNdaB4GHx0qtSWKZvnBNfJ7I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SWnQ4y/8Lb3Sxx3obqdrU19mlKaGHDOor2GpWIvHCTsPI0M43+UxVJEjnWzuY4E252EvdzV4CeWhz7SA9KBTZ9LqoL386yNWRnO7GFzYO5ginz2vgXfh/9LPuxx9LIuzReMxLdFax84w47rTf+Fejus0N88yztpr4XPVcAc4Atw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=x5rCkYql; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cekPAfwY; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="x5rCkYql"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cekPAfwY" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh_=28Schneider_Electric=29?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1782985333; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jxl4BF/T9DW0yi93O442fMoOaRhZSpCfaXV8jnZ8tpE=; b=x5rCkYqldXRyf58WE2Mx5/Zf/8HMkkkE5mCPKyrj38nqvCMMNMZcXqIj/4LNsX4Eb+EF0d oW7O4O6/PMcPKFrotczcv8NYGExZA6fYt7k2E4s4pdS0h4LzvH6Y31It9eTYAibRQRrdcY CDm0RIhNm12Mj8LzXPZqxFYvuOFe1NE6sSXgqmLK537fWHTWo5RLjuUngFKoBg0K9DOKvJ Hkab7LeL5rj+px+/Tuk/thFN8BJYGSezvPSz5DCqoccXGBJYPCXyo49DGBxpSiFeK0MHtL OZIBrdWbxscoiNmDRyH+fiOEUyHiRg2VeTJcIQV7SiWhzRIMEcY/JXhXbjajEQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1782985333; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jxl4BF/T9DW0yi93O442fMoOaRhZSpCfaXV8jnZ8tpE=; b=cekPAfwYawtwTdCawD42AjjBY4ib4tEPjaFceq01d6CJB+8sd7NkLHUU6BJTPaeqEm77ii XirX49A3Id8fYCBA== Date: Thu, 02 Jul 2026 11:42:00 +0200 Subject: [PATCH 3/8] hrtimer: Move hrtimer_update_function() to hrtimer.c 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="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20260702-hrtimer-header-dependencies-v1-3-c50b19bda473@linutronix.de> References: <20260702-hrtimer-header-dependencies-v1-0-c50b19bda473@linutronix.de> In-Reply-To: <20260702-hrtimer-header-dependencies-v1-0-c50b19bda473@linutronix.de> To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh_=28Schneider_Electric=29?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1782985330; l=2841; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=Lz2Kn7Jk8oyXgf/iwnBxNdaB4GHx0qtSWKZvnBNfJ7I=; b=lwykaF+jTwtD02JIXxGA+YXjTSsGb7j87EeDd1dOaqWwJWzU8PniPTVCTz5V2p55tSfcCVysR pWWYsv6EL1RCTQWMWa/Hd/baqfHQCJl+7Sa/Djz0Ci3dLW98bXjKX2O X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The usage of the timer base forces hrtimer.h to also expose the base structure definitions. Move the function to hrtimer.c to avoid this. Signed-off-by: Thomas Weißschuh (Schneider Electric) --- include/linux/hrtimer.h | 24 ++---------------------- kernel/time/hrtimer.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 7bf154cf3079..81ab9849e83b 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -287,28 +287,8 @@ static inline bool hrtimer_is_queued(struct hrtimer *timer) return READ_ONCE(timer->is_queued); } -/** - * hrtimer_update_function - Update the timer's callback function - * @timer: Timer to update - * @function: New callback function - * - * Only safe to call if the timer is not enqueued. Can be called in the callback function if the - * timer is not enqueued at the same time (see the comments above HRTIMER_STATE_ENQUEUED). - */ -static inline void hrtimer_update_function(struct hrtimer *timer, - enum hrtimer_restart (*function)(struct hrtimer *)) -{ -#ifdef CONFIG_PROVE_LOCKING - guard(raw_spinlock_irqsave)(&timer->base->cpu_base->lock); - - if (WARN_ON_ONCE(hrtimer_is_queued(timer))) - return; - - if (WARN_ON_ONCE(!function)) - return; -#endif - ACCESS_PRIVATE(timer, function) = function; -} +void hrtimer_update_function(struct hrtimer *timer, + enum hrtimer_restart (*function)(struct hrtimer *)); /* Forward a hrtimer so it expires after now: */ extern u64 diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 313dcea127fe..31d09bc84ed7 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1039,6 +1039,30 @@ static inline void unlock_hrtimer_base(const struct hrtimer *timer, unsigned lon raw_spin_unlock_irqrestore(&timer->base->cpu_base->lock, *flags); } +/** + * hrtimer_update_function - Update the timer's callback function + * @timer: Timer to update + * @function: New callback function + * + * Only safe to call if the timer is not enqueued. Can be called in the callback function if the + * timer is not enqueued at the same time (see the comments above HRTIMER_STATE_ENQUEUED). + */ +void hrtimer_update_function(struct hrtimer *timer, + enum hrtimer_restart (*function)(struct hrtimer *)) +{ +#ifdef CONFIG_PROVE_LOCKING + guard(raw_spinlock_irqsave)(&timer->base->cpu_base->lock); + + if (WARN_ON_ONCE(hrtimer_is_queued(timer))) + return; + + if (WARN_ON_ONCE(!function)) + return; +#endif + ACCESS_PRIVATE(timer, function) = function; +} +EXPORT_SYMBOL_GPL(hrtimer_update_function); + /** * hrtimer_forward() - forward the timer expiry * @timer: hrtimer to forward -- 2.55.0