diff mbox series

[v1,1/1,2/2] Set the default timeout

Message ID 1590542319-35736-2-git-send-email-yuechao.zhao@advantech.com.cn (mailing list archive)
State Superseded
Headers show
Series [v1,1/1,2/2] Set the default timeout | expand

Commit Message

yuechao.zhao(赵越超) May 27, 2020, 1:18 a.m. UTC
From: Yuechao Zhao <yuechao.zhao@advantech.com.cn>

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 wahtchdog_init_timeout() can not detect this
error because the timeout module parameter of 0 means "no timeout
module paraameter specified".

Signed-off-by: Yuechao Zhao <yuechao.zhao@advantech.com.cn>
---
 drivers/hwmon/nct7904.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck May 27, 2020, 1:46 a.m. UTC | #1
On 5/26/20 6:18 PM, yuechao.zhao@advantech.com.cn wrote:
> From: Yuechao Zhao <yuechao.zhao@advantech.com.cn>
> 
> 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 wahtchdog_init_timeout() can not detect this
> error because the timeout module parameter of 0 means "no timeout
> module paraameter specified".
> 
> Signed-off-by: Yuechao Zhao <yuechao.zhao@advantech.com.cn>

Please fix the subject to something like "hmwmon: (nct7904) Set default timeout".

Also, the change only makes sense if you also change "static int timeout"
to default to 0. Then you can just drop patch 1/2.

Guenter

> ---
>  drivers/hwmon/nct7904.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c
> index d069d59..ddbe47e 100644
> --- a/drivers/hwmon/nct7904.c
> +++ b/drivers/hwmon/nct7904.c
> @@ -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;
>
diff mbox series

Patch

diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c
index d069d59..ddbe47e 100644
--- a/drivers/hwmon/nct7904.c
+++ b/drivers/hwmon/nct7904.c
@@ -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;