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

Configure Feed

Select the types of activity you want to include in your feed.

watchdog: wdat_wdt: Avoid unimplemented get_timeleft

As per the specification the action QUERY_COUNTDOWN_PERIOD is optional.
If the action is not implemented by the physical device the driver would
always report "0" from get_timeleft().
Avoid confusing userspace by only providing get_timeleft() when
implemented by the hardware.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20221221-wdat_wdt-timeleft-v1-1-8e8a314c36cc@weissschuh.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Thomas Weißschuh and committed by
Wim Van Sebroeck
00bdbc9a 98b7a161

+4 -2
+4 -2
drivers/watchdog/wdat_wdt.c
··· 301 301 .identity = "wdat_wdt", 302 302 }; 303 303 304 - static const struct watchdog_ops wdat_wdt_ops = { 304 + static struct watchdog_ops wdat_wdt_ops = { 305 305 .owner = THIS_MODULE, 306 306 .start = wdat_wdt_start, 307 307 .stop = wdat_wdt_stop, 308 308 .ping = wdat_wdt_ping, 309 309 .set_timeout = wdat_wdt_set_timeout, 310 - .get_timeleft = wdat_wdt_get_timeleft, 311 310 }; 312 311 313 312 static int wdat_wdt_probe(struct platform_device *pdev) ··· 434 435 435 436 list_add_tail(&instr->node, instructions); 436 437 } 438 + 439 + if (wdat->instructions[ACPI_WDAT_GET_CURRENT_COUNTDOWN]) 440 + wdat_wdt_ops.get_timeleft = wdat_wdt_get_timeleft; 437 441 438 442 wdat_wdt_boot_status(wdat); 439 443 wdat_wdt_set_running(wdat);