aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/watchdog.h
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2016-08-31 07:52:41 -0400
committerWim Van Sebroeck <wim@iguana.be>2016-09-24 03:27:15 -0400
commitdf044e02206230c7d79a9aef96a6c087476f5533 (patch)
treee1e6868b6d5a86c588457dc2b8c90418a6c8f02c /include/linux/watchdog.h
parent68d4cb809ef84f9a0ea6a23c4c0dc0ae48355f78 (diff)
watchdog: add pretimeout support to the core
Since the watchdog framework centrializes the IOCTL interfaces of device drivers now, SETPRETIMEOUT and GETPRETIMEOUT need to be added in the common code. Signed-off-by: Robin Gong <b38343@freescale.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> [vzapolskiy: added conditional pretimeout sysfs attribute visibility] Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> 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.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 7047bc7f8106..4035df7ec023 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -28,6 +28,7 @@ struct watchdog_core_data;
28 * @ping: The routine that sends a keepalive ping to the watchdog device. 28 * @ping: The routine that sends a keepalive ping to the watchdog device.
29 * @status: The routine that shows the status of the watchdog device. 29 * @status: The routine that shows the status of the watchdog device.
30 * @set_timeout:The routine for setting the watchdog devices timeout value (in seconds). 30 * @set_timeout:The routine for setting the watchdog devices timeout value (in seconds).
31 * @set_pretimeout:The routine for setting the watchdog devices pretimeout.
31 * @get_timeleft:The routine that gets the time left before a reset (in seconds). 32 * @get_timeleft:The routine that gets the time left before a reset (in seconds).
32 * @restart: The routine for restarting the machine. 33 * @restart: The routine for restarting the machine.
33 * @ioctl: The routines that handles extra ioctl calls. 34 * @ioctl: The routines that handles extra ioctl calls.
@@ -46,6 +47,7 @@ struct watchdog_ops {
46 int (*ping)(struct watchdog_device *); 47 int (*ping)(struct watchdog_device *);
47 unsigned int (*status)(struct watchdog_device *); 48 unsigned int (*status)(struct watchdog_device *);
48 int (*set_timeout)(struct watchdog_device *, unsigned int); 49 int (*set_timeout)(struct watchdog_device *, unsigned int);
50 int (*set_pretimeout)(struct watchdog_device *, unsigned int);
49 unsigned int (*get_timeleft)(struct watchdog_device *); 51 unsigned int (*get_timeleft)(struct watchdog_device *);
50 int (*restart)(struct watchdog_device *, unsigned long, void *); 52 int (*restart)(struct watchdog_device *, unsigned long, void *);
51 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); 53 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
@@ -61,6 +63,7 @@ struct watchdog_ops {
61 * @ops: Pointer to the list of watchdog operations. 63 * @ops: Pointer to the list of watchdog operations.
62 * @bootstatus: Status of the watchdog device at boot. 64 * @bootstatus: Status of the watchdog device at boot.
63 * @timeout: The watchdog devices timeout value (in seconds). 65 * @timeout: The watchdog devices timeout value (in seconds).
66 * @pretimeout: The watchdog devices pre_timeout value.
64 * @min_timeout:The watchdog devices minimum timeout value (in seconds). 67 * @min_timeout:The watchdog devices minimum timeout value (in seconds).
65 * @max_timeout:The watchdog devices maximum timeout value (in seconds) 68 * @max_timeout:The watchdog devices maximum timeout value (in seconds)
66 * as configurable from user space. Only relevant if 69 * as configurable from user space. Only relevant if
@@ -96,6 +99,7 @@ struct watchdog_device {
96 const struct watchdog_ops *ops; 99 const struct watchdog_ops *ops;
97 unsigned int bootstatus; 100 unsigned int bootstatus;
98 unsigned int timeout; 101 unsigned int timeout;
102 unsigned int pretimeout;
99 unsigned int min_timeout; 103 unsigned int min_timeout;
100 unsigned int max_timeout; 104 unsigned int max_timeout;
101 unsigned int min_hw_heartbeat_ms; 105 unsigned int min_hw_heartbeat_ms;
@@ -163,6 +167,13 @@ static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigne
163 t > wdd->max_timeout); 167 t > wdd->max_timeout);
164} 168}
165 169
170/* Use the following function to check if a pretimeout value is invalid */
171static inline bool watchdog_pretimeout_invalid(struct watchdog_device *wdd,
172 unsigned int t)
173{
174 return t && wdd->timeout && t >= wdd->timeout;
175}
176
166/* Use the following functions to manipulate watchdog driver specific data */ 177/* Use the following functions to manipulate watchdog driver specific data */
167static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data) 178static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data)
168{ 179{