[PATCH 1/1] watchdog: imx2: Added ioctl options to enable/disable watchdog as wanted by systemd.

From: Tord Andersson
Date: Wed May 28 2014 - 11:00:24 EST


When the current imx2 watchdog driver is used with the systemd watchdog feature,
we get "Failed to enable hardware watchdog: Inappropriate ioctl for device".
This is caused by missing ioctl setoptions to enable the watchdog.
This patch will add WDIOC_SETOPTIONS for WDIOS_ENABLECARD and WDIOS_DISABLECARD.

Signed-off-by: Tord Andersson <tord.andersson@xxxxxxxxx>
---
drivers/watchdog/imx2_wdt.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index dd51d95..180c6a5 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -196,6 +196,17 @@ static long imx2_wdt_ioctl(struct file *file, unsigned int cmd,
new_value = val & IMX2_WDT_WRSR_TOUT ? WDIOF_CARDRESET : 0;
return put_user(new_value, p);

+ case WDIOC_SETOPTIONS:
+ if (get_user(new_value, p))
+ return -EFAULT;
+ if (new_value & WDIOS_ENABLECARD)
+ imx2_wdt_start();
+ else if (new_value & WDIOS_DISABLECARD)
+ imx2_wdt_stop();
+ else
+ return -EINVAL;
+ return 0;
+
case WDIOC_KEEPALIVE:
imx2_wdt_ping();
return 0;
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/