|
@@ -1,19 +1,20 @@
|
|
|
-From b5e57a9f158a293b1151638336478af8a5aad0f0 Mon Sep 17 00:00:00 2001
|
|
|
+From 76e2b190803484db033153fe8a97b381a567ed25 Mon Sep 17 00:00:00 2001
|
|
|
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
|
|
|
Date: Wed, 14 Nov 2012 19:16:35 +0800
|
|
|
-Subject: [PATCH 1/5] watchdog: add keep alive support
|
|
|
+Subject: [PATCH 1/4] watchdog: add keep alive support
|
|
|
|
|
|
this will allow to ping the watchdog via poller
|
|
|
|
|
|
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
|
|
|
+Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
|
|
|
---
|
|
|
drivers/watchdog/Kconfig | 1 +
|
|
|
- drivers/watchdog/wd_core.c | 21 +++++++++++++++++++++
|
|
|
+ drivers/watchdog/wd_core.c | 25 +++++++++++++++++++++++++
|
|
|
include/watchdog.h | 2 ++
|
|
|
- 3 files changed, 24 insertions(+)
|
|
|
+ 3 files changed, 28 insertions(+)
|
|
|
|
|
|
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
|
|
|
-index 2e2900c..0b4dc84 100644
|
|
|
+index 63fb1a8c5..7ebff89b9 100644
|
|
|
--- a/drivers/watchdog/Kconfig
|
|
|
+++ b/drivers/watchdog/Kconfig
|
|
|
@@ -4,6 +4,7 @@ config WATCHDOG_IMX_RESET_SOURCE
|
|
@@ -25,23 +26,29 @@ index 2e2900c..0b4dc84 100644
|
|
|
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..a1b9e28 100644
|
|
|
+index 3a3f51964..52537afef 100644
|
|
|
--- a/drivers/watchdog/wd_core.c
|
|
|
+++ b/drivers/watchdog/wd_core.c
|
|
|
-@@ -17,18 +17,39 @@
|
|
|
+@@ -18,6 +18,7 @@
|
|
|
#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 LIST_HEAD(watchdog_list);
|
|
|
|
|
|
+@@ -31,6 +32,20 @@ static const char *watchdog_name(struct watchdog *wd)
|
|
|
+ return "unknown";
|
|
|
+ }
|
|
|
+
|
|
|
++static struct watchdog *watchdog_get_default(void);
|
|
|
++
|
|
|
+static void watchdog_poller_func(struct poller_struct *poller)
|
|
|
+{
|
|
|
-+ watchdog->keep_alive(watchdog);
|
|
|
++ struct watchdog *wd = watchdog_get_default();
|
|
|
++
|
|
|
++ if (wd)
|
|
|
++ wd->keep_alive(wd);
|
|
|
+}
|
|
|
+
|
|
|
+static struct poller_struct watchdog_poller = {
|
|
@@ -50,17 +57,17 @@ index 3d0cfc6..a1b9e28 100644
|
|
|
+
|
|
|
int watchdog_register(struct watchdog *wd)
|
|
|
{
|
|
|
- if (watchdog != NULL)
|
|
|
- return -EBUSY;
|
|
|
+ if (!wd->priority)
|
|
|
+@@ -41,6 +56,16 @@ int watchdog_register(struct watchdog *wd)
|
|
|
+ pr_debug("registering watchdog %s with priority %d\n", watchdog_name(wd),
|
|
|
+ wd->priority);
|
|
|
|
|
|
- watchdog = wd;
|
|
|
+
|
|
|
-+ if (watchdog->keep_alive) {
|
|
|
++ if (wd->keep_alive) {
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ ret = poller_register(&watchdog_poller);
|
|
|
+ if (ret) {
|
|
|
-+ watchdog = NULL;
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ }
|
|
@@ -69,20 +76,24 @@ index 3d0cfc6..a1b9e28 100644
|
|
|
}
|
|
|
EXPORT_SYMBOL(watchdog_register);
|
|
|
diff --git a/include/watchdog.h b/include/watchdog.h
|
|
|
-index 3e2d08e..d5ecf2f 100644
|
|
|
+index 3e8a487a4..a2660c2e0 100644
|
|
|
--- a/include/watchdog.h
|
|
|
+++ b/include/watchdog.h
|
|
|
-@@ -13,8 +13,10 @@
|
|
|
+@@ -13,12 +13,14 @@
|
|
|
#ifndef INCLUDE_WATCHDOG_H
|
|
|
# define INCLUDE_WATCHDOG_H
|
|
|
|
|
|
+
|
|
|
struct watchdog {
|
|
|
int (*set_timeout)(struct watchdog *, unsigned);
|
|
|
+ const char *name;
|
|
|
+ struct device_d *dev;
|
|
|
+ unsigned int priority;
|
|
|
+ struct list_head list;
|
|
|
+ void (*keep_alive)(struct watchdog *);
|
|
|
};
|
|
|
|
|
|
- int watchdog_register(struct watchdog *);
|
|
|
+ #ifdef CONFIG_WATCHDOG
|
|
|
--
|
|
|
-1.8.1.4
|
|
|
+2.12.0
|
|
|
|