From d0684c8a9354953efdea214b437445c00743cf49 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Sun, 28 Feb 2016 13:12:17 -0800 Subject: watchdog: Make stop function optional Not all hardware watchdogs can be stopped. The driver for such watchdogs would typically only set the WATCHDOG_HW_RUNNING flag in its stop function. Make the stop function optional and set WATCHDOG_HW_RUNNING in the watchdog core if it is not provided. Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/watchdog_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/watchdog/watchdog_core.c') diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c index d9b3c9c023c4..c1658fe73d58 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c @@ -199,7 +199,7 @@ static int __watchdog_register_device(struct watchdog_device *wdd) return -EINVAL; /* Mandatory operations need to be supported */ - if (wdd->ops->start == NULL || wdd->ops->stop == NULL) + if (!wdd->ops->start || (!wdd->ops->stop && !wdd->max_hw_heartbeat_ms)) return -EINVAL; watchdog_check_min_max_timeout(wdd); -- cgit