diff options
author | Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> | 2016-10-07 08:39:54 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2016-10-08 04:27:10 -0400 |
commit | ff84136cb6a4943f489ad037fe93f43be0573c23 (patch) | |
tree | bde99dc52bf4066e666681d280011d37d17d269a /include/linux/watchdog.h | |
parent | fc113d54e9d7ef3296cdf2eff49c8ca0a3e5a482 (diff) |
watchdog: add watchdog pretimeout governor framework
The change adds a simple watchdog pretimeout framework infrastructure,
its purpose is to allow users to select a desired handling of watchdog
pretimeout events, which may be generated by some watchdog devices.
A user selects a default watchdog pretimeout governor during
compilation stage.
Watchdogs with WDIOF_PRETIMEOUT capability now have one more device
attribute in sysfs, pretimeout_governor attribute is intended to display
the selected watchdog pretimeout governor.
The framework has no impact at runtime on watchdog devices with no
WDIOF_PRETIMEOUT capability set.
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'include/linux/watchdog.h')
-rw-r--r-- | include/linux/watchdog.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 4035df7ec023..35a4d8185b51 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h | |||
@@ -19,6 +19,7 @@ | |||
19 | struct watchdog_ops; | 19 | struct watchdog_ops; |
20 | struct watchdog_device; | 20 | struct watchdog_device; |
21 | struct watchdog_core_data; | 21 | struct watchdog_core_data; |
22 | struct watchdog_governor; | ||
22 | 23 | ||
23 | /** struct watchdog_ops - The watchdog-devices operations | 24 | /** struct watchdog_ops - The watchdog-devices operations |
24 | * | 25 | * |
@@ -61,6 +62,7 @@ struct watchdog_ops { | |||
61 | * watchdog device. | 62 | * watchdog device. |
62 | * @info: Pointer to a watchdog_info structure. | 63 | * @info: Pointer to a watchdog_info structure. |
63 | * @ops: Pointer to the list of watchdog operations. | 64 | * @ops: Pointer to the list of watchdog operations. |
65 | * @gov: Pointer to watchdog pretimeout governor. | ||
64 | * @bootstatus: Status of the watchdog device at boot. | 66 | * @bootstatus: Status of the watchdog device at boot. |
65 | * @timeout: The watchdog devices timeout value (in seconds). | 67 | * @timeout: The watchdog devices timeout value (in seconds). |
66 | * @pretimeout: The watchdog devices pre_timeout value. | 68 | * @pretimeout: The watchdog devices pre_timeout value. |
@@ -97,6 +99,7 @@ struct watchdog_device { | |||
97 | const struct attribute_group **groups; | 99 | const struct attribute_group **groups; |
98 | const struct watchdog_info *info; | 100 | const struct watchdog_info *info; |
99 | const struct watchdog_ops *ops; | 101 | const struct watchdog_ops *ops; |
102 | const struct watchdog_governor *gov; | ||
100 | unsigned int bootstatus; | 103 | unsigned int bootstatus; |
101 | unsigned int timeout; | 104 | unsigned int timeout; |
102 | unsigned int pretimeout; | 105 | unsigned int pretimeout; |
@@ -185,6 +188,16 @@ static inline void *watchdog_get_drvdata(struct watchdog_device *wdd) | |||
185 | return wdd->driver_data; | 188 | return wdd->driver_data; |
186 | } | 189 | } |
187 | 190 | ||
191 | /* Use the following functions to report watchdog pretimeout event */ | ||
192 | #if IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_GOV) | ||
193 | void watchdog_notify_pretimeout(struct watchdog_device *wdd); | ||
194 | #else | ||
195 | static inline void watchdog_notify_pretimeout(struct watchdog_device *wdd) | ||
196 | { | ||
197 | pr_alert("watchdog%d: pretimeout event\n", wdd->id); | ||
198 | } | ||
199 | #endif | ||
200 | |||
188 | /* drivers/watchdog/watchdog_core.c */ | 201 | /* drivers/watchdog/watchdog_core.c */ |
189 | void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority); | 202 | void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority); |
190 | extern int watchdog_init_timeout(struct watchdog_device *wdd, | 203 | extern int watchdog_init_timeout(struct watchdog_device *wdd, |