[lkml]   [2006]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC] Watchdog device class
Hi Rudolf,

> > It's not about different approaches: we have to find the best thing for watchdog
> > devicesi, so the best thing is to talk about pro's and con's and see what we should
> > do best. (I for instance didn't come to the sysfs part yet of my code (which would
> > be in watchdog_sysfs.c)
> Ok I will look into your code.

Please have a look at the experimental code in the linux-2.6-watchdog-experimental git tree

It's a first draft of the generic code. (it's split into tree main parts: the core code, the
/dev/watchdog code and the sysfs code). (Note: I used Greg's new "class" device setup).
And it basically uses the following operations and watchdog_device structure:

struct watchdog_ops {
/* mandatory routines */
int (*start)(struct watchdog_device *); /* operation = start watchdog */
int (*stop)(struct watchdog_device *); /* operation = stop watchdog */
int (*keepalive)(struct watchdog_device *); /* operation = send keepalive ping */
/* optional routines */
int (*set_heartbeat)(struct watchdog_device *,int); /* operation = set watchdog's heartbeat */
int (*get_status)(struct watchdog_device *,int *); /* operation = get the watchdog's status */
int (*get_timeleft)(struct watchdog_device *, int *); /* operation = get the time left before reboot */
int (*sys_restart)(struct watchdog_device *); /* operation = force a system_restart for rebooting */
struct watchdog_device {
unsigned char name[32]; /* The watchdog's 'identity' */
unsigned long options; /* The supported capabilities/options */
unsigned long firmware; /* The Watchdog's Firmware version */
int heartbeat; /* The watchdog's heartbeat */
int nowayout; /* The nowayout setting for this watchdog */
int bootstatus; /* The watchdog's bootstatus */
int temppanic; /* wether or not to panic on temperature trip's */
struct watchdog_ops *watchdog_ops; /* link to watchdog_ops */
/* watchdog status (register/unregister) state machine */
WATCHDOG_REGISTERED, /* completed register_watchdogdevice */
WATCHDOG_STARTED, /* watchdog device started */
WATCHDOG_STOPPED, /* watchdog device stopped */
WATCHDOG_UNREGISTERED, /* completed unregister_watchdogdevice */
} watchdog_state;
struct semaphore sem; /* locks this structure */
struct device *cdev; /* Sysfs watchdog class device */
/* From here on everything is device dependent */
void *private;
There are still a number of things to be added:
* have a list under register_watchdogdevice so that we can register multiple watchdog devices
(Note: only one watchdog device will be linked to /dev/watchdog)
* add pre-timeout stuff
* clean-up sysfs code
* do proper locking
* add documentation
* make docbook ready
* decide how we will handle the old temperature ioctl

All comments/suggestions are welcome. Let's see/discuss what's missing, what we should do different, ...


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-08-15 19:17    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean