Vladimir Zapolskiy | ff84136 | 2016-10-07 15:39:54 +0300 | [diff] [blame] | 1 | #ifndef __WATCHDOG_PRETIMEOUT_H |
| 2 | #define __WATCHDOG_PRETIMEOUT_H |
| 3 | |
| 4 | #define WATCHDOG_GOV_NAME_MAXLEN 20 |
| 5 | |
| 6 | struct watchdog_device; |
| 7 | |
| 8 | struct watchdog_governor { |
| 9 | const char name[WATCHDOG_GOV_NAME_MAXLEN]; |
| 10 | void (*pretimeout)(struct watchdog_device *wdd); |
| 11 | }; |
| 12 | |
| 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); |
| 17 | |
| 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_governor_get(struct watchdog_device *wdd, char *buf); |
| 22 | |
Vladimir Zapolskiy | f77710c | 2016-10-07 15:39:55 +0300 | [diff] [blame] | 23 | #if IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_NOOP) |
| 24 | #define WATCHDOG_PRETIMEOUT_DEFAULT_GOV "noop" |
Vladimir Zapolskiy | da0d12f | 2016-10-07 15:39:56 +0300 | [diff] [blame^] | 25 | #elif IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC) |
| 26 | #define WATCHDOG_PRETIMEOUT_DEFAULT_GOV "panic" |
Vladimir Zapolskiy | f77710c | 2016-10-07 15:39:55 +0300 | [diff] [blame] | 27 | #endif |
| 28 | |
Vladimir Zapolskiy | ff84136 | 2016-10-07 15:39:54 +0300 | [diff] [blame] | 29 | #else |
| 30 | static inline int watchdog_register_pretimeout(struct watchdog_device *wdd) |
| 31 | { |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | static inline void watchdog_unregister_pretimeout(struct watchdog_device *wdd) |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | static inline int watchdog_pretimeout_governor_get(struct watchdog_device *wdd, |
| 40 | char *buf) |
| 41 | { |
| 42 | return -EINVAL; |
| 43 | } |
| 44 | #endif |
| 45 | |
| 46 | #endif |