mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
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>
This commit is contained in:
committed by
Wim Van Sebroeck
parent
68d4cb809e
commit
df044e0220
@@ -28,6 +28,7 @@ struct watchdog_core_data;
|
||||
* @ping: The routine that sends a keepalive ping to the watchdog device.
|
||||
* @status: The routine that shows the status of the watchdog device.
|
||||
* @set_timeout:The routine for setting the watchdog devices timeout value (in seconds).
|
||||
* @set_pretimeout:The routine for setting the watchdog devices pretimeout.
|
||||
* @get_timeleft:The routine that gets the time left before a reset (in seconds).
|
||||
* @restart: The routine for restarting the machine.
|
||||
* @ioctl: The routines that handles extra ioctl calls.
|
||||
@@ -46,6 +47,7 @@ struct watchdog_ops {
|
||||
int (*ping)(struct watchdog_device *);
|
||||
unsigned int (*status)(struct watchdog_device *);
|
||||
int (*set_timeout)(struct watchdog_device *, unsigned int);
|
||||
int (*set_pretimeout)(struct watchdog_device *, unsigned int);
|
||||
unsigned int (*get_timeleft)(struct watchdog_device *);
|
||||
int (*restart)(struct watchdog_device *, unsigned long, void *);
|
||||
long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
|
||||
@@ -61,6 +63,7 @@ struct watchdog_ops {
|
||||
* @ops: Pointer to the list of watchdog operations.
|
||||
* @bootstatus: Status of the watchdog device at boot.
|
||||
* @timeout: The watchdog devices timeout value (in seconds).
|
||||
* @pretimeout: The watchdog devices pre_timeout value.
|
||||
* @min_timeout:The watchdog devices minimum timeout value (in seconds).
|
||||
* @max_timeout:The watchdog devices maximum timeout value (in seconds)
|
||||
* as configurable from user space. Only relevant if
|
||||
@@ -96,6 +99,7 @@ struct watchdog_device {
|
||||
const struct watchdog_ops *ops;
|
||||
unsigned int bootstatus;
|
||||
unsigned int timeout;
|
||||
unsigned int pretimeout;
|
||||
unsigned int min_timeout;
|
||||
unsigned int max_timeout;
|
||||
unsigned int min_hw_heartbeat_ms;
|
||||
@@ -163,6 +167,13 @@ static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigne
|
||||
t > wdd->max_timeout);
|
||||
}
|
||||
|
||||
/* Use the following function to check if a pretimeout value is invalid */
|
||||
static inline bool watchdog_pretimeout_invalid(struct watchdog_device *wdd,
|
||||
unsigned int t)
|
||||
{
|
||||
return t && wdd->timeout && t >= wdd->timeout;
|
||||
}
|
||||
|
||||
/* Use the following functions to manipulate watchdog driver specific data */
|
||||
static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data)
|
||||
{
|
||||
|
Reference in New Issue
Block a user