Re: [PATCH v3 5/7] watchdog: Add Nuvoton NCT6694 WDT support

From: Guenter Roeck
Date: Tue Dec 10 2024 - 10:22:40 EST


On 12/10/24 02:45, Ming Yu wrote:
This driver supports Watchdog timer functionality for NCT6694 MFD
device based on USB interface.

Signed-off-by: Ming Yu <tmyu0@xxxxxxxxxxx>
---
...
+static int nct6694_wdt_probe(struct platform_device *pdev)
+{
...
+ wdev->timeout = timeout;
+ wdev->pretimeout = pretimeout;
+ if (timeout < pretimeout) {
+ dev_warn(data->dev, "pretimeout < timeout. Setting to zero\n");
+ wdev->pretimeout = 0;
+ }
+
+ wdev->min_timeout = 1;
+ wdev->max_timeout = 255;
+
+ mutex_init(&data->lock);
+
+ platform_set_drvdata(pdev, data);
+
+ /* Register watchdog timer device to WDT framework */
+ watchdog_set_drvdata(&data->wdev, data);
+ watchdog_init_timeout(&data->wdev, timeout, dev);

This is pointless since timeout is pre-initialized with a value != 0.
That means a value provided through devicetree will never be used
unless the user sets timeout=0 as module parameter. But then the above
check for pretimeout is useless.

Guenter