linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] watchdog: imx2: Added ioctl options to enable/disable watchdog as wanted by systemd.
@ 2014-05-28 14:59 Tord Andersson
  2014-05-28 16:11 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Tord Andersson @ 2014-05-28 14:59 UTC (permalink / raw)
  To: Wim Van Sebroeck, linux-watchdog; +Cc: linux-kernel, Tord Andersson

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] watchdog: imx2: Added ioctl options to enable/disable watchdog as wanted by systemd.
  2014-05-28 14:59 [PATCH 1/1] watchdog: imx2: Added ioctl options to enable/disable watchdog as wanted by systemd Tord Andersson
@ 2014-05-28 16:11 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2014-05-28 16:11 UTC (permalink / raw)
  To: Tord Andersson
  Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel, Tord Andersson

On Wed, May 28, 2014 at 04:59:56PM +0200, Tord Andersson wrote:
> 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>
> ---

Hi Tord,

This driver is in the process of being concerted to use the watchdog
core API. See 'watchdog: imx2_wdt: convert to watchdog core api' [1]
from Anatolij Gustschin.

With this update, this patch becomes unnecessary.

Guenter

[1] http://patchwork.roeck-us.net/patch/1340/

>  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-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-28 16:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-28 14:59 [PATCH 1/1] watchdog: imx2: Added ioctl options to enable/disable watchdog as wanted by systemd Tord Andersson
2014-05-28 16:11 ` Guenter Roeck

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).