Linux 4.19.133
[linux/fpc-iii.git] / drivers / watchdog / watchdog_pretimeout.h
bloba3f1abc68839aa9002c52c280488c2fe08841379
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __WATCHDOG_PRETIMEOUT_H
3 #define __WATCHDOG_PRETIMEOUT_H
5 #define WATCHDOG_GOV_NAME_MAXLEN 20
7 struct watchdog_device;
9 struct watchdog_governor {
10 const char name[WATCHDOG_GOV_NAME_MAXLEN];
11 void (*pretimeout)(struct watchdog_device *wdd);
14 #if IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_GOV)
15 /* Interfaces to watchdog pretimeout governors */
16 int watchdog_register_governor(struct watchdog_governor *gov);
17 void watchdog_unregister_governor(struct watchdog_governor *gov);
19 /* Interfaces to watchdog_dev.c */
20 int watchdog_register_pretimeout(struct watchdog_device *wdd);
21 void watchdog_unregister_pretimeout(struct watchdog_device *wdd);
22 int watchdog_pretimeout_available_governors_get(char *buf);
23 int watchdog_pretimeout_governor_get(struct watchdog_device *wdd, char *buf);
24 int watchdog_pretimeout_governor_set(struct watchdog_device *wdd,
25 const char *buf);
27 #if IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_NOOP)
28 #define WATCHDOG_PRETIMEOUT_DEFAULT_GOV "noop"
29 #elif IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC)
30 #define WATCHDOG_PRETIMEOUT_DEFAULT_GOV "panic"
31 #endif
33 #else
34 static inline int watchdog_register_pretimeout(struct watchdog_device *wdd)
36 return 0;
39 static inline void watchdog_unregister_pretimeout(struct watchdog_device *wdd)
43 static inline int watchdog_pretimeout_available_governors_get(char *buf)
45 return -EINVAL;
48 static inline int watchdog_pretimeout_governor_get(struct watchdog_device *wdd,
49 char *buf)
51 return -EINVAL;
54 static inline int watchdog_pretimeout_governor_set(struct watchdog_device *wdd,
55 const char *buf)
57 return -EINVAL;
59 #endif
61 #endif