Skip to contentSkip to conversation

is watchdog_ops stop() routine mandatory or optional?

DISCUSSION Robert P. J. Day 2 participants 3 messages Oct 17, 2016 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

continuing with annoying pedantry, there's this from
Documentation/watchdog/watchdog-kernel-api.txt:

The list of watchdog operations is defined as:

  struct watchdog_ops {
        struct module *owner;
        /* mandatory operations */
        int (*start)(struct watchdog_device *);
        int (*stop)(struct watchdog_device *);
        /* optional operations */
        ... snip ...

followed shortly by:

Some operations are mandatory and some are optional. The mandatory operations are:
* start: this is a pointer to the routine that starts the watchdog timer device.
The routine needs a pointer to the watchdog timer device structure as a parameter. It returns zero on success or a negative errno code for failure.

Not all watchdog timer hardware supports the same functionality. That's why all other routines/operations are optional. They only need to be provided if they are supported. These optional routines/operations are:
* stop: with this routine the watchdog timer device is being stopped. ... snip ...

so the first snippet implies that stop() is mandatory, while the
subsequent snippet describes it as optional. thoughts?

rday

p.s. i am currently editing this doc file, and will submit an updated version with little fixes throughout.

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
maintainer
#1 lore raw
Quoted 23 lines · Robert P. J. Day

continuing with annoying pedantry, there's this from
Documentation/watchdog/watchdog-kernel-api.txt:

The list of watchdog operations is defined as:

  struct watchdog_ops {
        struct module *owner;
        /* mandatory operations */
        int (*start)(struct watchdog_device *);
        int (*stop)(struct watchdog_device *);
        /* optional operations */
        ... snip ...

followed shortly by:

Some operations are mandatory and some are optional. The mandatory operations are:
* start: this is a pointer to the routine that starts the watchdog timer device.
The routine needs a pointer to the watchdog timer device structure as a parameter. It returns zero on success or a negative errno code for failure.

Quoted 9 lines

Not all watchdog timer hardware supports the same functionality. That's why all other routines/operations are optional. They only need to be provided if they are supported. These optional routines/operations are:
* stop: with this routine the watchdog timer device is being stopped. ... snip ...

so the first snippet implies that stop() is mandatory, while the
subsequent snippet describes it as optional. thoughts?

stop used to be mandatory, but isn't anymore. I missed updating the structure.

Guenter

Quoted 5 lines

rday

p.s. i am currently editing this doc file, and will submit an updated version with little fixes throughout.

#2 lore raw
Quoted 32 lines · Guenter Roeck
Quoted 31 lines · Robert P. J. Day

continuing with annoying pedantry, there's this from
Documentation/watchdog/watchdog-kernel-api.txt:

The list of watchdog operations is defined as:

  struct watchdog_ops {
        struct module *owner;
        /* mandatory operations */
        int (*start)(struct watchdog_device *);
        int (*stop)(struct watchdog_device *);
        /* optional operations */
        ... snip ...

followed shortly by:

Some operations are mandatory and some are optional. The mandatory operations
are:
* start: this is a pointer to the routine that starts the watchdog timer device.
The routine needs a pointer to the watchdog timer device structure as a parameter. It returns zero on success or a negative errno code for failure.

Not all watchdog timer hardware supports the same functionality. That's why all other routines/operations are optional. They only need to be provided if they are supported. These optional routines/operations are:
* stop: with this routine the watchdog timer device is being stopped. ... snip ...

Quoted 6 lines
Quoted 3 lines

so the first snippet implies that stop() is mandatory, while the
subsequent snippet describes it as optional. thoughts?

stop used to be mandatory, but isn't anymore. I missed updating the structure.

you can patch it if you prefer, or i can do it. your choice.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================