Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[WATCHDOG] doc: Fix use of WDIOC_SETOPTIONS ioctl.

In the watchdog-test program and watchdog-api.txt, pass the values to
the WDIOC_SETOPTIONS ioctl as a pointer to an integer containing the
values intead of directly in the third ioctl argument. The actual
watchdog drivers in drivers/watchdog don't read the options directly
from the argument but use get_user and copy_from_user.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

James Hogan and committed by
Wim Van Sebroeck
dfc33383 cf9cf9ae

+8 -5
+6 -2
Documentation/watchdog/src/watchdog-test.c
··· 31 31 */ 32 32 int main(int argc, char *argv[]) 33 33 { 34 + int flags; 35 + 34 36 fd = open("/dev/watchdog", O_WRONLY); 35 37 36 38 if (fd == -1) { ··· 43 41 44 42 if (argc > 1) { 45 43 if (!strncasecmp(argv[1], "-d", 2)) { 46 - ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD); 44 + flags = WDIOS_DISABLECARD; 45 + ioctl(fd, WDIOC_SETOPTIONS, &flags); 47 46 fprintf(stderr, "Watchdog card disabled.\n"); 48 47 fflush(stderr); 49 48 exit(0); 50 49 } else if (!strncasecmp(argv[1], "-e", 2)) { 51 - ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD); 50 + flags = WDIOS_ENABLECARD; 51 + ioctl(fd, WDIOC_SETOPTIONS, &flags); 52 52 fprintf(stderr, "Watchdog card enabled.\n"); 53 53 fflush(stderr); 54 54 exit(0);
+2 -3
Documentation/watchdog/watchdog-api.txt
··· 222 222 ioctl(fd, WDIOC_GETTEMP, &temperature); 223 223 224 224 Finally the SETOPTIONS ioctl can be used to control some aspects of 225 - the cards operation; right now the pcwd driver is the only one 226 - supporting this ioctl. 225 + the cards operation. 227 226 228 227 int options = 0; 229 - ioctl(fd, WDIOC_SETOPTIONS, options); 228 + ioctl(fd, WDIOC_SETOPTIONS, &options); 230 229 231 230 The following options are available: 232 231