Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296797
b: refs/heads/master
c: fd7b673
h: refs/heads/master
i:
  296795: 842e278
v: v3
  • Loading branch information
Viresh Kumar authored and Wim Van Sebroeck committed Mar 27, 2012
1 parent 8afbc2b commit 96501d6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2ca1606359695cc7ce371c7829c4082d9095fc06
refs/heads/master: fd7b673c92731fc6c0b1e999adfd87b6762ee797
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ Here is a overview of the functions and probably needed actions:
WDIOC_GETTIMEOUT:
No preparations needed

WDIOC_GETTIMELEFT:
It needs get_timeleft() callback to be defined. Otherwise it
will return EOPNOTSUPP

Other IOCTLs can be served using the ioctl-callback. Note that this is mainly
intended for porting old drivers; new drivers should not invent private IOCTLs.
Private IOCTLs are processed first. When the callback returns with
Expand Down
4 changes: 3 additions & 1 deletion trunk/Documentation/watchdog/watchdog-kernel-api.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The Linux WatchDog Timer Driver Core kernel API.
===============================================
Last reviewed: 29-Nov-2011
Last reviewed: 16-Mar-2012

Wim Van Sebroeck <wim@iguana.be>

Expand Down Expand Up @@ -77,6 +77,7 @@ struct watchdog_ops {
int (*ping)(struct watchdog_device *);
unsigned int (*status)(struct watchdog_device *);
int (*set_timeout)(struct watchdog_device *, unsigned int);
unsigned int (*get_timeleft)(struct watchdog_device *);
long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
};

Expand Down Expand Up @@ -123,6 +124,7 @@ they are supported. These optional routines/operations are:
because the watchdog does not necessarily has a 1 second resolution).
(Note: the WDIOF_SETTIMEOUT needs to be set in the options field of the
watchdog's info structure).
* get_timeleft: this routines returns the time that's left before a reset.
* ioctl: if this routine is present then it will be called first before we do
our own internal ioctl call handling. This routine should return -ENOIOCTLCMD
if a command is not supported. The parameters that are passed to the ioctl
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/watchdog/watchdog_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
if (wdd->timeout == 0)
return -EOPNOTSUPP;
return put_user(wdd->timeout, p);
case WDIOC_GETTIMELEFT:
if (!wdd->ops->get_timeleft)
return -EOPNOTSUPP;

return put_user(wdd->ops->get_timeleft(wdd), p);
default:
return -ENOTTY;
}
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/watchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ struct watchdog_device;
* @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.
* @get_timeleft:The routine that get's the time that's left before a reset.
* @ioctl: The routines that handles extra ioctl calls.
*
* The watchdog_ops structure contains a list of low-level operations
Expand All @@ -82,6 +83,7 @@ struct watchdog_ops {
int (*ping)(struct watchdog_device *);
unsigned int (*status)(struct watchdog_device *);
int (*set_timeout)(struct watchdog_device *, unsigned int);
unsigned int (*get_timeleft)(struct watchdog_device *);
long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
};

Expand Down

0 comments on commit 96501d6

Please sign in to comment.