Skip to contentSkip to conversation

watchdog: wdat_wdt: fix get_timeleft call for wdat_wdt

PATCH In review Bryan Tan 2 participants 2 messages Apr 10, 2019 Watchdog device drivers

lore
Share & tools
lore

Bryan Tan

author
#0 lore raw

PATCH 1/1 watchdog: wdat_wdt: fix get_timeleft call for wdat_wdt

The get_timeleft call for wdat_wdt was using ACPI_WDAT_GET_COUNTDOWN when running an action on the device, which would return the configured countdown, instead of ACPI_WDAT_GET_CURRENT_COUNTDOWN, which returns the time left before the watchdog will fire. This change corrects that.

---
 drivers/watchdog/wdat_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/wdat_wdt.c +1 -1
index 56ad196..387892f 100644
@@ -287,7 +287,7 @@ static unsigned int wdat_wdt_get_timeleft(struct watchdog_device *wdd)
 	struct wdat_wdt *wdat = to_wdat_wdt(wdd);
 	u32 periods = 0;
 
-	wdat_wdt_run_action(wdat, ACPI_WDAT_GET_COUNTDOWN, 0, &periods);
+	wdat_wdt_run_action(wdat, ACPI_WDAT_GET_CURRENT_COUNTDOWN, 0, &periods);
 	return periods * wdat->period / 1000;
 }
 
Signature · 1 line
2.6.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Bryan Tan

The get_timeleft call for wdat_wdt was using ACPI_WDAT_GET_COUNTDOWN when running an action on the device, which would return the configured countdown, instead of ACPI_WDAT_GET_CURRENT_COUNTDOWN, which returns the time left before the watchdog will fire. This change corrects that.

Quoted 18 lines
---
  drivers/watchdog/wdat_wdt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/wdat_wdt.c +1 -1
index 56ad196..387892f 100644
@@ -287,7 +287,7 @@ static unsigned int wdat_wdt_get_timeleft(struct watchdog_device *wdd)
  	struct wdat_wdt *wdat = to_wdat_wdt(wdd);
  	u32 periods = 0;
 
-	wdat_wdt_run_action(wdat, ACPI_WDAT_GET_COUNTDOWN, 0, &periods);
+	wdat_wdt_run_action(wdat, ACPI_WDAT_GET_CURRENT_COUNTDOWN, 0, &periods);
  	return periods * wdat->period / 1000;
  }