mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/7] watchdog: add keep alive support
Date: Fri, 16 Nov 2012 18:02:59 +0100	[thread overview]
Message-ID: <1353085385-14090-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20121116165729.GA8327@game.jcrosoft.org>

this will allow to ping the watchdog via poller

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/watchdog/Kconfig   |    1 +
 drivers/watchdog/wd_core.c |   20 ++++++++++++++++++++
 include/watchdog.h         |    2 ++
 3 files changed, 23 insertions(+)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 8fdc7a5..21480a1 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1,5 +1,6 @@
 menuconfig WATCHDOG
 	bool "Watchdog support              "
+	select GENERIC_POLLER
 	help
 	  Many platforms support a watchdog to keep track of a working machine.
 	  This framework provides routines to handle these watchdogs.
diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index 3d0cfc6..f0a43f3 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -17,18 +17,38 @@
 #include <errno.h>
 #include <linux/ctype.h>
 #include <watchdog.h>
+#include <poller.h>
 
 /*
  * Note: this simple framework supports one watchdog only.
  */
 static struct watchdog *watchdog;
 
+static void watchdog_poller_func(struct poller_struct *poller)
+{
+	watchdog->keep_alive(watchdog);
+}
+
+struct poller_struct watchdog_poller = {
+	.func = watchdog_poller_func,
+};
+
 int watchdog_register(struct watchdog *wd)
 {
 	if (watchdog != NULL)
 		return -EBUSY;
 
+	if (watchdog->keep_alive) {
+		int ret;
+	
+		ret = poller_register(&watchdog_poller);
+		if (ret)
+			return ret;
+	}
+
 	watchdog = wd;
+
+
 	return 0;
 }
 EXPORT_SYMBOL(watchdog_register);
diff --git a/include/watchdog.h b/include/watchdog.h
index 3e2d08e..d5ecf2f 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -13,8 +13,10 @@
 #ifndef INCLUDE_WATCHDOG_H
 # define INCLUDE_WATCHDOG_H
 
+
 struct watchdog {
 	int (*set_timeout)(struct watchdog *, unsigned);
+	void (*keep_alive)(struct watchdog *);
 };
 
 int watchdog_register(struct watchdog *);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-11-16 17:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-16 16:57 [PATCH 0/7] at91sam9 add watchdog support with keep alive Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:02 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-11-16 17:03   ` [PATCH 2/7] watchdog: add at91sam9 watchdog support Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:03   ` [PATCH 3/7] at91sam9260/9g20: add wathdog support Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:03   ` [PATCH 4/7] at91sam9261/9g10: " Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:03   ` [PATCH 5/7] at91sam9263: " Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:03   ` [PATCH 6/7] at91sam9g45: " Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:03   ` [PATCH 7/7] at91sam9x5: " Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:53 [PATCH 0/7 v2] at91sam9 add watchdog support with keep alive Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:55 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
2012-11-19  9:38   ` Sascha Hauer
2012-11-19 10:08     ` Jean-Christophe PLAGNIOL-VILLARD

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=1353085385-14090-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /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