Skip to contentSkip to conversation

curious about a couple examples of drivers including <asm/watchdog.h>

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

lore
Share & tools
lore
#0 lore raw

more nitpicking pedantry ... reading watchdog-kernel-api.txt, which
claims:

"Each watchdog timer driver that wants to use the WatchDog Timer Driver Core must #include <linux/watchdog.h> (you would have to do this anyway when writing a watchdog device driver)."

except i just noticed the following -- kernel files that include
<asm/watchdog.h>:

$ grep -r "include.*asm/watchdog.h" *
arch/sh/boards/mach-hp6xx/pm.c:#include <asm/watchdog.h>
arch/sh/kernel/reboot.c:#include <asm/watchdog.h>
drivers/watchdog/shwdt.c:#include <asm/watchdog.h>
drivers/watchdog/cpwd.c:#include <asm/watchdog.h>
$

that last file, cpwd.c, includes just:

#include <asm/watchdog.h>

while the file shwdt.c includes *both*:

#include <linux/watchdog.h>
...
#include <asm/watchdog.h>

i readily admit i have no idea why this is being done, or if there's
a perfectly good reason that SH needs to be treated a bit differently; just pointing out that the claim in that Doc file is not entirely accurate for those cases.

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
========================================================================
maintainer
#1 lore raw
Quoted 8 lines · Robert P. J. Day

more nitpicking pedantry ... reading watchdog-kernel-api.txt, which
claims:

"Each watchdog timer driver that wants to use the WatchDog Timer Driver Core must #include <linux/watchdog.h> (you would have to do this anyway when writing a watchdog device driver)."

Quoted 6 lines

except i just noticed the following -- kernel files that include
<asm/watchdog.h>:

$ grep -r "include.*asm/watchdog.h" *
arch/sh/boards/mach-hp6xx/pm.c:#include <asm/watchdog.h>
arch/sh/kernel/reboot.c:#include <asm/watchdog.h>

If you look more closely, you'll notice that yhe above two files may use functionality associated with kernel/watchdog.c and/or use definitions and/or functions defined in the asm include. They do not implement watchdog drivers associated with drivers/watchdog.

Quoted 10 lines

drivers/watchdog/shwdt.c:#include <asm/watchdog.h> drivers/watchdog/cpwd.c:#include <asm/watchdog.h> $

that last file, cpwd.c, includes just:

#include <asm/watchdog.h>

while the file shwdt.c includes *both*:

Quoted 9 lines

#include <linux/watchdog.h>
...
#include <asm/watchdog.h>

i readily admit i have no idea why this is being done, or if there's
a perfectly good reason that SH needs to be treated a bit differently; just pointing out that the claim in that Doc file is not entirely accurate for those cases.

Check the source. I would guess that those two drivers use definitions and/or functions from the asm include files. The latter file hasn't been converted to use the watchdog infrastructure.

Guenter