From nobody Sun Feb 8 19:56:11 2026 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F26C2EBBBC for ; Fri, 19 Dec 2025 20:42:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766176977; cv=none; b=FKNfDsYRzY8WkR6lbACkYD+qeEOuu4RLUn0w7L6qxlzXWA/Bgupmf9nOBrdeHsBZ6u5VBtuTlDkTKebqqhCqeSN5o9gNsT56eBv3gw67CAqemmHFOZ0fmU1Y4mtyDDAXWQCYFzKCiNj0A0JrsaUHfCfR2OuBmTyei8RAGmC+NGY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766176977; c=relaxed/simple; bh=vTjbz2xExaZcXaw1+mkLdNF+efUVXmDz+X4wv9kkqgY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=r2a5SW09dJYuEU5aw1xojk0IqDZ82FpQDr2lk5cgik4EOOlDgsHzTeIqZ3jmNbtfTeoJiL/WGO1y1GkpNnKUCmla+q1lZp1C8pAUGjVhiO63qqtfV8gn6WjVSslMhaG1XPFKh7KL9aZbCKWn0kgjJ72zPQTQ+2bQA/T82wvKHGQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BAbPsiwL; arc=none smtp.client-ip=209.85.208.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BAbPsiwL" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-37a2dced861so31145801fa.1 for ; Fri, 19 Dec 2025 12:42:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766176973; x=1766781773; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=en6xvapY2fXeBfC2thntt566iYBzoKRkgHyWoO2aSq4=; b=BAbPsiwLPADpAqFu7pl4OyaEl9DRn2f/PKJ9qILK5v6L7Y7o7Is/jwUQPTz8mRlBuj vgwEUri6f5aKKyE/sSM/K8HJWedTYVCWB9E0qsTDYxKT8XGIQGOdGwbULENZ6HLzwTG5 oja39qVwyg9/fGawweoXD91blyJpFf9xswZZ+EotXOTsx/0Ce+CP8O/Zoig9KoR871+c qMOB4Yyb6IGxIXpY4weFlATSRt1qEvHxeSL08wmKG2elMec5g0RWiFBHQJ4awL9dcyAV hXEQjTtxP4tiIrKnEkvfp6uyA/C44NTvwWNmMNDl3FVVSRtSuqIl0QtRNHYp6lj7RoYT 6Haw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766176973; x=1766781773; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=en6xvapY2fXeBfC2thntt566iYBzoKRkgHyWoO2aSq4=; b=YxWhfv0wIjtTubWDzct9ZNDuXM9uYU7NHIiRWXR9ns+tJ5ivIjwYM3ScPGv2P5oHNe rWPH+Lwyqh4QCUPV/9IR5ciQyVkkzHkJJv8VuBYNbwdCDc5xmriphuyk0crVoCe356iM uJIr/w0M+ge940rH9QxYqlWpUM4UkmiYICol6mYkHSDIM97xJOm5RYz2L9ceUV73b4l4 brXGU8wiei8VI6+0tU9Wortu57MaALQC9hKTAexpfOFZmo43Wf+QveOOkOT079Aw2/kO iYf28M78BQXw9mMJjF2h7Qp38hGK11M/7tPUqL1MtdDzsAwAruS7y1hvNysVdMnntFL+ 0l1Q== X-Forwarded-Encrypted: i=1; AJvYcCXcuQfCqyI1h8dqNPzI3ErQaQnAfhXYmWkz2IDSs4ASV+C1DNvlDBz5am1Axn26LQ5Ycz3cNCftjpL6cEU=@vger.kernel.org X-Gm-Message-State: AOJu0YxryU6ofAHgchY09el6Eb4OMbN82ZN+qr7thjzj/gQLjdCxt7aP hrQgff5pniQ9Sl/nZ5bpuXlXXAbwh6LWFxT/GzRjzYBfnoC2BRp1Udl13fTSYA== X-Gm-Gg: AY/fxX5tE+PKQQWnUEFMbYW8NWxXVNymoSq/zBP+YECwLzn93XyJ0YNuthsZjVnAAQA whPxpAfzpqxsnBXB9gTQwP7I/CzyN9G9birApjwaVlSj+GKbpctkivFKr3XvmbVSUZqjoIV5Oak 8cC+xvzwTBgzDFgaQ4I/3dSePLn9bYZ/6F1hHzcf0mfyea1BHZ4YBifnGuGa/TifhSEzZzTAPdk +C//bWG54YybtAzPaAzJIwbABDrA1Zu5gzZv//VfqHGJmHBjhtEXtN/EOV2pQSbz8zqnwqDbd9V lSzk+hi+XPQb9f2JyPCJTQ2mBDXrTevkpiU1OODOSjrelblvNsj9TraviPb32BctoUryvejPBak M5/6/IGkvSI8UVWzc79j/dOOGpp5SouCH9rXT0qViwXaia0bI2xnThh323pHvwaQaGs/ORuA76T A+5h6nasFg31J7PqECiugXH/Iy7hHYfjKITtDngMwl9Z83g9FcwUvrKjo5hT3T9zy6jgal8c/oR B2S7A== X-Google-Smtp-Source: AGHT+IFzwpgzTN4hBZG4gSXH4+VcAksaplIJ1PAIf7gkxFw0pR9MDQcDDYZX3n4Zbrpr36Dginq5ow== X-Received: by 2002:a05:651c:2205:b0:37e:508f:81d4 with SMTP id 38308e7fff4ca-3812081e778mr12955881fa.10.1766176972870; Fri, 19 Dec 2025 12:42:52 -0800 (PST) Received: from LT-5CG5341NQ4.nordic.imtech.com (37-33-132-227.bb.dnainternet.fi. [37.33.132.227]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3812251affbsm7727511fa.17.2025.12.19.12.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Dec 2025 12:42:52 -0800 (PST) From: Kari Argillander Date: Fri, 19 Dec 2025 22:42:38 +0200 Subject: [PATCH] watchdog: Make API functions const correct 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: quoted-printable Message-Id: <20251219-watchdog-improvements-v1-1-9711c519474a@gmail.com> X-B4-Tracking: v=1; b=H4sIAL24RWkC/x3MTQqAIBBA4avErBMa+6G6SrQwm2wWaahUEN49a fkt3nshkGcKMBYveLo4sLMZWBagd2UNCV6zQVayRYmDuFXU++qM4OP07qKDbAxCyQ6behl0jwS 5PT1t/PzfaU7pA2+dZ2pnAAAA X-Change-ID: 20251219-watchdog-improvements-a26143b9c81e To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Kari Argillander X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766176970; l=4481; i=kari.argillander@gmail.com; s=20251219; h=from:subject:message-id; bh=vTjbz2xExaZcXaw1+mkLdNF+efUVXmDz+X4wv9kkqgY=; b=ETbI5Q1EuZXzibeKxX5ix/gBoOYvT7sw6ae/rIyloc3+rC622Pm/Xz9vzFPW8/f2J+MDO6xcN ZiVyIT5Zd80Aw+Ikpj87f8LYcyJhNjKcFwFKtu6TVGWOr1txi/Q5Vun X-Developer-Key: i=kari.argillander@gmail.com; a=ed25519; pk=RwSxyhTpE3z4sywdDbIkC3q33ZQLNyhYWxT44iTY6r4= Many watchdog API functions do not modify the watchdog_device nor device. Mark their arguments as const to reflect this and improve const-correctness of the API. No functional change intended. Signed-off-by: Kari Argillander Reviewed-by: Guenter Roeck --- Documentation/watchdog/watchdog-kernel-api.rst | 2 +- drivers/watchdog/watchdog_core.c | 3 ++- include/linux/watchdog.h | 12 +++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Documentation/watchdog/watchdog-kernel-api.rst b/Documentation= /watchdog/watchdog-kernel-api.rst index 243231fe4c0a..5649c54cf6fb 100644 --- a/Documentation/watchdog/watchdog-kernel-api.rst +++ b/Documentation/watchdog/watchdog-kernel-api.rst @@ -293,7 +293,7 @@ To initialize the timeout field, the following function= can be used:: =20 extern int watchdog_init_timeout(struct watchdog_device *wdd, unsigned int timeout_parm, - struct device *dev); + const struct device *dev); =20 The watchdog_init_timeout function allows you to initialize the timeout fi= eld using the module timeout parameter or by retrieving the timeout-sec proper= ty from diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_c= ore.c index 6152dba4b52c..8300520688d0 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c @@ -117,7 +117,8 @@ static void watchdog_check_min_max_timeout(struct watch= dog_device *wdd) * bounds. */ int watchdog_init_timeout(struct watchdog_device *wdd, - unsigned int timeout_parm, struct device *dev) + unsigned int timeout_parm, + const struct device *dev) { const char *dev_str =3D wdd->parent ? dev_name(wdd->parent) : (const char *)wdd->info->identity; diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 8c60687a3e55..62cdd26fd025 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h @@ -129,7 +129,7 @@ struct watchdog_device { #define WATCHDOG_NOWAYOUT_INIT_STATUS (WATCHDOG_NOWAYOUT << WDOG_NO_WAY_OU= T) =20 /* Use the following function to check whether or not the watchdog is acti= ve */ -static inline bool watchdog_active(struct watchdog_device *wdd) +static inline bool watchdog_active(const struct watchdog_device *wdd) { return test_bit(WDOG_ACTIVE, &wdd->status); } @@ -138,7 +138,7 @@ static inline bool watchdog_active(struct watchdog_devi= ce *wdd) * Use the following function to check whether or not the hardware watchdog * is running */ -static inline bool watchdog_hw_running(struct watchdog_device *wdd) +static inline bool watchdog_hw_running(const struct watchdog_device *wdd) { return test_bit(WDOG_HW_RUNNING, &wdd->status); } @@ -169,7 +169,8 @@ static inline void watchdog_stop_ping_on_suspend(struct= watchdog_device *wdd) } =20 /* Use the following function to check if a timeout value is invalid */ -static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, u= nsigned int t) +static inline bool watchdog_timeout_invalid(const struct watchdog_device *= wdd, + unsigned int t) { /* * The timeout is invalid if @@ -188,7 +189,7 @@ static inline bool watchdog_timeout_invalid(struct watc= hdog_device *wdd, unsigne } =20 /* Use the following function to check if a pretimeout value is invalid */ -static inline bool watchdog_pretimeout_invalid(struct watchdog_device *wdd, +static inline bool watchdog_pretimeout_invalid(const struct watchdog_devic= e *wdd, unsigned int t) { return t && wdd->timeout && t >=3D wdd->timeout; @@ -218,7 +219,8 @@ static inline void watchdog_notify_pretimeout(struct wa= tchdog_device *wdd) /* drivers/watchdog/watchdog_core.c */ void watchdog_set_restart_priority(struct watchdog_device *wdd, int priori= ty); extern int watchdog_init_timeout(struct watchdog_device *wdd, - unsigned int timeout_parm, struct device *dev); + unsigned int timeout_parm, + const struct device *dev); extern int watchdog_register_device(struct watchdog_device *); extern void watchdog_unregister_device(struct watchdog_device *); int watchdog_dev_suspend(struct watchdog_device *wdd); --- base-commit: cc3aa43b44bdb43dfbac0fcb51c56594a11338a8 change-id: 20251219-watchdog-improvements-a26143b9c81e Best regards, --=20 Kari Argillander