Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: bd9576: Drop "always-running" property

The always-running (from linux,wdt-gpio.yaml) is abused by the BD9576
watchdog driver. It's defined meaning is "the watchdog is always running
and can not be stopped". The BD9576 watchdog driver has implemented it
as "start watchdog when loading the module and prevent it from being
stopped".

Furthermore, the implementation does not set the WDOG_HW_RUNNING when
enabling the watchdog due to the "always-running" at module loading.
This will end up resulting a watchdog timeout if the device is not
opened.

The culprit was pointed out by Guenter, discussion can be found from
https://lore.kernel.org/lkml/4fa3a64b-60fb-4e5e-8785-0f14da37eea2@roeck-us.net/

Drop the invalid "always-running" handling.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Fixes: b237bcac557a ("wdt: Support wdt on ROHM BD9576MUF and BD9573MUF")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/ZhPAt76yaJMersXf@fedora
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Matti Vaittinen and committed by
Wim Van Sebroeck
e3b3afd3 56e23c6d

+1 -11
+1 -11
drivers/watchdog/bd9576_wdt.c
··· 29 29 struct gpio_desc *gpiod_en; 30 30 struct device *dev; 31 31 struct regmap *regmap; 32 - bool always_running; 33 32 struct watchdog_device wdd; 34 33 }; 35 34 ··· 61 62 { 62 63 struct bd9576_wdt_priv *priv = watchdog_get_drvdata(wdd); 63 64 64 - if (!priv->always_running) 65 - bd9576_wdt_disable(priv); 66 - else 67 - set_bit(WDOG_HW_RUNNING, &wdd->status); 65 + bd9576_wdt_disable(priv); 68 66 69 67 return 0; 70 68 } ··· 260 264 if (ret) 261 265 return ret; 262 266 263 - priv->always_running = device_property_read_bool(dev->parent, 264 - "always-running"); 265 - 266 267 watchdog_set_drvdata(&priv->wdd, priv); 267 268 268 269 priv->wdd.info = &bd957x_wdt_ident; ··· 273 280 watchdog_set_nowayout(&priv->wdd, nowayout); 274 281 275 282 watchdog_stop_on_reboot(&priv->wdd); 276 - 277 - if (priv->always_running) 278 - bd9576_wdt_start(&priv->wdd); 279 283 280 284 return devm_watchdog_register_device(dev, &priv->wdd); 281 285 }