python-pathvalidate: bump version to 0.14.1
[buildroot-gz.git] / board / telit / evk-pro3 / patches / barebox / 0001-watchdog-add-keep-alive-support.patch
blob80bd459b56240cfa30efa5512c4d8b03cd98e280
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>
10 ---
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
22 menuconfig WATCHDOG
23 bool "Watchdog support"
24 + select GENERIC_POLLER
25 help
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
32 @@ -18,6 +18,7 @@
33 #include <errno.h>
34 #include <linux/ctype.h>
35 #include <watchdog.h>
36 +#include <poller.h>
38 static LIST_HEAD(watchdog_list);
40 @@ -31,6 +32,20 @@ static const char *watchdog_name(struct watchdog *wd)
41 return "unknown";
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();
50 + if (wd)
51 + wd->keep_alive(wd);
54 +static struct poller_struct watchdog_poller = {
55 + .func = watchdog_poller_func,
56 +};
58 int watchdog_register(struct watchdog *wd)
60 if (!wd->priority)
61 @@ -41,6 +56,16 @@ int watchdog_register(struct watchdog *wd)
62 pr_debug("registering watchdog %s with priority %d\n", watchdog_name(wd),
63 wd->priority);
66 + if (wd->keep_alive) {
67 + int ret;
69 + ret = poller_register(&watchdog_poller);
70 + if (ret) {
71 + return ret;
72 + }
73 + }
75 return 0;
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
82 @@ -13,12 +13,14 @@
83 #ifndef INCLUDE_WATCHDOG_H
84 # define INCLUDE_WATCHDOG_H
87 struct watchdog {
88 int (*set_timeout)(struct watchdog *, unsigned);
89 const char *name;
90 struct device_d *dev;
91 unsigned int priority;
92 struct list_head list;
93 + void (*keep_alive)(struct watchdog *);
96 #ifdef CONFIG_WATCHDOG
97 --
98 2.12.0