Re: [PATCH] selftests: watchdog: Add optional file argument

From: Eugeniu Rosca
Date: Thu Aug 29 2019 - 10:38:27 EST


Hi George,

On Thu, Aug 29, 2019 at 12:39:25AM -0400, George G. Davis wrote:
> Some systems have multiple watchdog devices where the first device
> registered is assigned to the /dev/watchdog device file.

Confirmed on R-Car H3-Salvator-X:

root@rcar-gen3:~# ls -al /dev/watchdog*
crw------- 1 root root 10, 130 Aug 21 09:38 /dev/watchdog
crw------- 1 root root 247, 0 Aug 21 09:38 /dev/watchdog0

[..]

> - fd = open("/dev/watchdog", O_WRONLY);
> + while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
> + if (c == 'f')
> + file = optarg;
> + }
> +
> + fd = open(file, O_WRONLY);

Would it be possible to improve below not so helpful and slightly
misleading printout:

$ ./watchdog-test -d -t 10 -p 5 -e -f /dev/watch
Watchdog device not enabled.

Thanks!

--
Best Regards,
Eugeniu.