hwmon: (nct7904) Set default timeout
authorYuechao Zhao <yuechao.zhao@advantech.com.cn>
Wed, 27 May 2020 06:16:59 +0000 (06:16 +0000)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 27 May 2020 06:46:24 +0000 (23:46 -0700)
The timeout module parameter should not be used for setting the default
timeout. Because, if you set the timeout = 0, the default timeout will
be meaningless. And the timeout module parameter of 0 means "no timeout
module parameter specified".

Signed-off-by: Yuechao Zhao <yuechao.zhao@advantech.com.cn>
Link: https://lore.kernel.org/r/1590560219-41328-1-git-send-email-yuechao.zhao@advantech.com.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/nct7904.c

index 18c95be4f5d454b59efdc5b4c5ea8ecee23ded4e..b0425694f702252e250e28e7b57aded40a5b6017 100644 (file)
 #define MIN_TIMEOUT            (1 * 60)
 #define MAX_TIMEOUT            (255 * 60)
 
-static int timeout = WATCHDOG_TIMEOUT;
+static int timeout;
 module_param(timeout, int, 0);
 MODULE_PARM_DESC(timeout, "Watchdog timeout in minutes. 1 <= timeout <= 255, default="
-                       __MODULE_STRING(WATCHODOG_TIMEOUT) ".");
+                       __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
 
 static bool nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, bool, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started once started (default="
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
                        __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static const unsigned short normal_i2c[] = {
@@ -1147,7 +1147,7 @@ static int nct7904_probe(struct i2c_client *client,
        data->wdt.ops = &nct7904_wdt_ops;
        data->wdt.info = &nct7904_wdt_info;
 
-       data->wdt.timeout = timeout * 60; /* in seconds */
+       data->wdt.timeout = WATCHDOG_TIMEOUT * 60; /* Set default timeout */
        data->wdt.min_timeout = MIN_TIMEOUT;
        data->wdt.max_timeout = MAX_TIMEOUT;
        data->wdt.parent = &client->dev;