From 6a64769d00af561329c1444f69db25d24d78042c Mon Sep 17 00:00:00 2001 From: Artyom Astafurov Date: Wed, 4 Nov 2026 11:00:25 -0500 Subject: [PATCH] watchdog: apple: set the parent device and honour nowayout The driver never applies the nowayout policy, so a kernel built with CONFIG_WATCHDOG_NOWAYOUT still lets userspace stop the watchdog with a magic close or WDIOS_DISABLECARD. Apply the Kconfig setting. wdd.parent is also unset, so the watchdog class device has no "device" link in sysfs, a "watchdog" device tree alias on the node is ignored, and the core logs the identity string instead of the device name. Set it to the platform device. This applies to every Apple SoC using the driver. Nothing changes in a kernel built without CONFIG_WATCHDOG_NOWAYOUT beyond the sysfs link and the log prefix. Assisted-by: LLM Signed-off-by: Artyom Astafurov --- drivers/watchdog/apple_wdt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/watchdog/apple_wdt.c b/drivers/watchdog/apple_wdt.c index f533953294f62..46a00a7993a6e 100644 --- a/drivers/watchdog/apple_wdt.c +++ b/drivers/watchdog/apple_wdt.c @@ -178,6 +178,7 @@ static int apple_wdt_probe(struct platform_device *pdev) platform_set_drvdata(pdev, wdt); + wdt->wdd.parent = dev; wdt->wdd.ops = &apple_wdt_ops; wdt->wdd.info = &apple_wdt_info; wdt->wdd.max_hw_heartbeat_ms = U32_MAX / wdt->clk_rate * 1000; @@ -187,6 +188,7 @@ static int apple_wdt_probe(struct platform_device *pdev) if (wdt_ctrl & APPLE_WDT_CTRL_RESET_EN) set_bit(WDOG_HW_RUNNING, &wdt->wdd.status); + watchdog_set_nowayout(&wdt->wdd, WATCHDOG_NOWAYOUT); watchdog_init_timeout(&wdt->wdd, 0, dev); apple_wdt_set_timeout(&wdt->wdd, wdt->wdd.timeout); watchdog_stop_on_unregister(&wdt->wdd);