linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tord Andersson <tord.o.andersson@gmail.com>
To: Wim Van Sebroeck <wim@iguana.be>, linux-watchdog@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Tord Andersson <tord.andersson@endian.se>
Subject: [PATCH 1/1] watchdog: imx2: Added ioctl options to enable/disable watchdog as wanted by systemd.
Date: Wed, 28 May 2014 16:59:56 +0200	[thread overview]
Message-ID: <1401289196-27567-1-git-send-email-tord.andersson@endian.se> (raw)

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@endian.se>
---
 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


             reply	other threads:[~2014-05-28 15:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28 14:59 Tord Andersson [this message]
2014-05-28 16:11 ` [PATCH 1/1] watchdog: imx2: Added ioctl options to enable/disable watchdog as wanted by systemd Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401289196-27567-1-git-send-email-tord.andersson@endian.se \
    --to=tord.o.andersson@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=tord.andersson@endian.se \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).