1 From b5e57a9f158a293b1151638336478af8a5aad0f0 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/5] 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>
10 drivers/watchdog/Kconfig | 1 +
11 drivers/watchdog/wd_core.c | 21 +++++++++++++++++++++
12 include/watchdog.h | 2 ++
13 3 files changed, 24 insertions(+)
15 diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
16 index 2e2900c..0b4dc84 100644
17 --- a/drivers/watchdog/Kconfig
18 +++ b/drivers/watchdog/Kconfig
19 @@ -4,6 +4,7 @@ config WATCHDOG_IMX_RESET_SOURCE
22 bool "Watchdog support"
23 + select GENERIC_POLLER
25 Many platforms support a watchdog to keep track of a working machine.
26 This framework provides routines to handle these watchdogs.
27 diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
28 index 3d0cfc6..a1b9e28 100644
29 --- a/drivers/watchdog/wd_core.c
30 +++ b/drivers/watchdog/wd_core.c
33 #include <linux/ctype.h>
38 * Note: this simple framework supports one watchdog only.
40 static struct watchdog *watchdog;
42 +static void watchdog_poller_func(struct poller_struct *poller)
44 + watchdog->keep_alive(watchdog);
47 +static struct poller_struct watchdog_poller = {
48 + .func = watchdog_poller_func,
51 int watchdog_register(struct watchdog *wd)
58 + if (watchdog->keep_alive) {
61 + ret = poller_register(&watchdog_poller);
70 EXPORT_SYMBOL(watchdog_register);
71 diff --git a/include/watchdog.h b/include/watchdog.h
72 index 3e2d08e..d5ecf2f 100644
73 --- a/include/watchdog.h
74 +++ b/include/watchdog.h
76 #ifndef INCLUDE_WATCHDOG_H
77 # define INCLUDE_WATCHDOG_H
81 int (*set_timeout)(struct watchdog *, unsigned);
82 + void (*keep_alive)(struct watchdog *);
85 int watchdog_register(struct watchdog *);