python-pyasn: bump to version 1.6.0b1
[buildroot-gz.git] / board / telit / evk-pro3 / barebox-2013.04.0-0001-watchdog-add-keep-alive-support.patch
blob155154603126ccc2e2fa63258d2bb2edabfb62a7
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>
9 ---
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
21 menuconfig WATCHDOG
22 bool "Watchdog support"
23 + select GENERIC_POLLER
24 help
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
31 @@ -17,18 +17,39 @@
32 #include <errno.h>
33 #include <linux/ctype.h>
34 #include <watchdog.h>
35 +#include <poller.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,
49 +};
51 int watchdog_register(struct watchdog *wd)
53 if (watchdog != NULL)
54 return -EBUSY;
56 watchdog = wd;
58 + if (watchdog->keep_alive) {
59 + int ret;
61 + ret = poller_register(&watchdog_poller);
62 + if (ret) {
63 + watchdog = NULL;
64 + return ret;
65 + }
66 + }
68 return 0;
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
75 @@ -13,8 +13,10 @@
76 #ifndef INCLUDE_WATCHDOG_H
77 # define INCLUDE_WATCHDOG_H
80 struct watchdog {
81 int (*set_timeout)(struct watchdog *, unsigned);
82 + void (*keep_alive)(struct watchdog *);
85 int watchdog_register(struct watchdog *);
86 --
87 1.8.1.4