[PATCH] watchdog: use assign_bit() where applicable

From: Peng Fan (OSS)

Date: Fri Sep 18 2026 - 11:21:43 EST


From: Peng Fan <peng.fan@xxxxxxx>

Convert open-coded if/else with set_bit/clear_bit and their
non-atomic __set_bit/__clear_bit variants to the assign_bit/__assign_bit
API.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
---
drivers/watchdog/watchdog_core.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index 38c1e63a8e2c..2948fe52e093 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -314,10 +314,7 @@ static int ___watchdog_register_device(struct watchdog_device *wdd)

/* Module parameter to force watchdog policy on reboot. */
if (stop_on_reboot != -1) {
- if (stop_on_reboot)
- set_bit(WDOG_STOP_ON_REBOOT, &wdd->status);
- else
- clear_bit(WDOG_STOP_ON_REBOOT, &wdd->status);
+ assign_bit(WDOG_STOP_ON_REBOOT, &wdd->status, stop_on_reboot);
}

if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status)) {
--
2.51.0