]> git.baikalelectronics.ru Git - kernel.git/commitdiff
watchdog: hpwdt: Disable PreTimeout when Timeout is smaller
authorJerry Hoemann <jerry.hoemann@hpe.com>
Fri, 21 Sep 2018 20:50:39 +0000 (14:50 -0600)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Tue, 2 Oct 2018 11:32:28 +0000 (13:32 +0200)
During module install, disable pretimeout if the requested timeout
value is not greater than the minimal pretimeout value that is
supported by hardware.

This makes the module load handling of pretimeout consistent
with the ioctl handling of pretimeout.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/hpwdt.c

index 7af358b3e2782e20fc8896080ac36e5ecf3a4820..93562304f7aa4f51441154640fa3031d89234fa2 100644 (file)
@@ -311,6 +311,10 @@ static int hpwdt_init_one(struct pci_dev *dev,
        if (watchdog_init_timeout(&hpwdt_dev, soft_margin, NULL))
                dev_warn(&dev->dev, "Invalid soft_margin: %d.\n", soft_margin);
 
+       if (pretimeout && hpwdt_dev.timeout <= PRETIMEOUT_SEC) {
+               dev_warn(&dev->dev, "timeout <= pretimeout. Setting pretimeout to zero\n");
+               pretimeout = 0;
+       }
        hpwdt_dev.pretimeout = pretimeout ? PRETIMEOUT_SEC : 0;
 
        hpwdt_dev.parent = &dev->dev;