summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2019-10-23 18:56:00 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-10-29 10:23:43 +0100
commit9ba3943ce613c179740957e85405b4c832323ddb (patch)
tree079d2e75e55bb80dfa6e85d35491a13ff028b100 /include
parentc2d167823588708c9f8f68c7db111ce146e19e3f (diff)
downloadbarebox-9ba3943ce613c179740957e85405b4c832323ddb.tar.gz
barebox-9ba3943ce613c179740957e85405b4c832323ddb.tar.xz
watchdog: export API to configure watchdogs by name
So far watchdog users could only configure the watchdog with the highest priority. In preparation for having the wd command configure a watchdog by name, extend watchdog_set_timeout with a struct watchdog *parameter and export functions to query default watchdog and to find watchdog by name. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/watchdog.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/include/watchdog.h b/include/watchdog.h
index 0db4263a31..891a0920e4 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -14,6 +14,7 @@
# define INCLUDE_WATCHDOG_H
#include <poller.h>
+#include <driver.h>
struct watchdog {
int (*set_timeout)(struct watchdog *, unsigned);
@@ -31,7 +32,9 @@ struct watchdog {
#ifdef CONFIG_WATCHDOG
int watchdog_register(struct watchdog *);
int watchdog_deregister(struct watchdog *);
-int watchdog_set_timeout(unsigned);
+struct watchdog *watchdog_get_default(void);
+struct watchdog *watchdog_get_by_name(const char *name);
+int watchdog_set_timeout(struct watchdog*, unsigned);
unsigned int of_get_watchdog_priority(struct device_node *node);
#else
static inline int watchdog_register(struct watchdog *w)
@@ -44,11 +47,22 @@ static inline int watchdog_deregister(struct watchdog *w)
return 0;
}
-static inline int watchdog_set_timeout(unsigned t)
+static inline struct watchdog *watchdog_get_default(void)
+{
+ return NULL;
+}
+
+static inline struct watchdog *watchdog_get_by_name(const char *name)
+{
+ return NULL;
+}
+
+static inline int watchdog_set_timeout(struct watchdog*w, unsigned t)
{
return 0;
}
+
static inline unsigned int of_get_watchdog_priority(struct device_node *node)
{
return 0;