• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/board/telit/evk-pro3/barebox-2013.04.0-0001-watchdog-add-keep-alive-support.patch
Fabio PorceddaFabio Porcedda committed 4fabcd28ca310 May 2013
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
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
5
​
6
this will allow to ping the watchdog via poller
7
​
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(+)
14
​
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
20
 
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>
36
 
37
 /*
38
  * Note: this simple framework supports one watchdog only.
39
  */
40
 static struct watchdog *watchdog;
41
 
42
+static void watchdog_poller_func(struct poller_struct *poller)
43
+{
44
+   watchdog->keep_alive(watchdog);
45
+}
46
+
47
+static struct poller_struct watchdog_poller = {
48
+   .func = watchdog_poller_func,
49
+};
50
+
51
 int watchdog_register(struct watchdog *wd)
52
 {
53
    if (watchdog != NULL)
54
        return -EBUSY;
55
 
56
    watchdog = wd;
57
+
58
+   if (watchdog->keep_alive) {
59
+       int ret;
60
+
61
+       ret = poller_register(&watchdog_poller);
62
+       if (ret) {
63
+           watchdog = NULL;
64
+           return ret;
65
+       }
66
+   }
67
+
68
    return 0;
69
 }
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
78
 
79
+
80
 struct watchdog {
81
    int (*set_timeout)(struct watchdog *, unsigned);
82
+   void (*keep_alive)(struct watchdog *);
83
 };
84
 
85
 int watchdog_register(struct watchdog *);
86
-- 
87
1.8.1.4
88
​
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.