1 From 76e2b190803484db033153fe8a97b381a567ed25 Mon Sep 17 00:00:00 2001
2 From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
3 Date: Wed, 14 Nov 2012 19:16:35 +0800
4 Subject: [PATCH 1/4] watchdog: add keep alive support
6 this will allow to ping the watchdog via poller
8 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
9 Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
11 drivers/watchdog/Kconfig | 1 +
12 drivers/watchdog/wd_core.c | 25 +++++++++++++++++++++++++
13 include/watchdog.h | 2 ++
14 3 files changed, 28 insertions(+)
16 diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
17 index 63fb1a8c5..7ebff89b9 100644
18 --- a/drivers/watchdog/Kconfig
19 +++ b/drivers/watchdog/Kconfig
20 @@ -4,6 +4,7 @@ config WATCHDOG_IMX_RESET_SOURCE
23 bool "Watchdog support"
24 + select GENERIC_POLLER
26 Many platforms support a watchdog to keep track of a working machine.
27 This framework provides routines to handle these watchdogs.
28 diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
29 index 3a3f51964..52537afef 100644
30 --- a/drivers/watchdog/wd_core.c
31 +++ b/drivers/watchdog/wd_core.c
34 #include <linux/ctype.h>
38 static LIST_HEAD(watchdog_list);
40 @@ -31,6 +32,20 @@ static const char *watchdog_name(struct watchdog *wd)
44 +static struct watchdog *watchdog_get_default(void);
46 +static void watchdog_poller_func(struct poller_struct *poller)
48 + struct watchdog *wd = watchdog_get_default();
54 +static struct poller_struct watchdog_poller = {
55 + .func = watchdog_poller_func,
58 int watchdog_register(struct watchdog *wd)
61 @@ -41,6 +56,16 @@ int watchdog_register(struct watchdog *wd)
62 pr_debug("registering watchdog %s with priority %d\n", watchdog_name(wd),
66 + if (wd->keep_alive) {
69 + ret = poller_register(&watchdog_poller);
77 EXPORT_SYMBOL(watchdog_register);
78 diff --git a/include/watchdog.h b/include/watchdog.h
79 index 3e8a487a4..a2660c2e0 100644
80 --- a/include/watchdog.h
81 +++ b/include/watchdog.h
83 #ifndef INCLUDE_WATCHDOG_H
84 # define INCLUDE_WATCHDOG_H
88 int (*set_timeout)(struct watchdog *, unsigned);
91 unsigned int priority;
92 struct list_head list;
93 + void (*keep_alive)(struct watchdog *);
96 #ifdef CONFIG_WATCHDOG