Linux 4.10-rc3
[linux/fpc-iii.git] / drivers / watchdog / watchdog_pretimeout.h
bloba5a32b39c56da3a4ff5b1541be5e3314fb04ee4a
1 #ifndef __WATCHDOG_PRETIMEOUT_H
2 #define __WATCHDOG_PRETIMEOUT_H
4 #define WATCHDOG_GOV_NAME_MAXLEN 20
6 struct watchdog_device;
8 struct watchdog_governor {
9 const char name[WATCHDOG_GOV_NAME_MAXLEN];
10 void (*pretimeout)(struct watchdog_device *wdd);
13 #if IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_GOV)
14 /* Interfaces to watchdog pretimeout governors */
15 int watchdog_register_governor(struct watchdog_governor *gov);
16 void watchdog_unregister_governor(struct watchdog_governor *gov);
18 /* Interfaces to watchdog_dev.c */
19 int watchdog_register_pretimeout(struct watchdog_device *wdd);
20 void watchdog_unregister_pretimeout(struct watchdog_device *wdd);
21 int watchdog_pretimeout_available_governors_get(char *buf);
22 int watchdog_pretimeout_governor_get(struct watchdog_device *wdd, char *buf);
23 int watchdog_pretimeout_governor_set(struct watchdog_device *wdd,
24 const char *buf);
26 #if IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_NOOP)
27 #define WATCHDOG_PRETIMEOUT_DEFAULT_GOV "noop"
28 #elif IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC)
29 #define WATCHDOG_PRETIMEOUT_DEFAULT_GOV "panic"
30 #endif
32 #else
33 static inline int watchdog_register_pretimeout(struct watchdog_device *wdd)
35 return 0;
38 static inline void watchdog_unregister_pretimeout(struct watchdog_device *wdd)
42 static inline int watchdog_pretimeout_available_governors_get(char *buf)
44 return -EINVAL;
47 static inline int watchdog_pretimeout_governor_get(struct watchdog_device *wdd,
48 char *buf)
50 return -EINVAL;
53 static inline int watchdog_pretimeout_governor_set(struct watchdog_device *wdd,
54 const char *buf)
56 return -EINVAL;
58 #endif
60 #endif