Re: [v2,1/1] hwmon:(nct7904) Set default timeout

2020-05-26 Thread Guenter Roeck
On Wed, May 27, 2020 at 03:49:50AM +, yuechao.z...@advantech.com.cn wrote:
> From: Yuechao Zhao 
> 
> 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 paraameter specified".
> 
> Signed-off-by: Yuechao Zhao 

You should also replace

static int timeout = WATCHDOG_TIMEOUT;

with

static int timeout;

to ensure that the module parameter is only evaluated if it is actually
set. Otherwise your patch has no real impact except if someone explicitly
specifies a timeout parameter of 0 which doesn't really make much sense.

Thanks,
Guenter

> ---
> - modify subject to 'hwmon:(nct7904) Set default timeout'
> ---
>  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 18c95be..27eb276 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 = _wdt_ops;
>   data->wdt.info = _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 = >dev;
> -- 
> 1.8.3.1
> 


[v2,1/1] hwmon:(nct7904) Set default timeout

2020-05-26 Thread yuechao.zhao
From: Yuechao Zhao 

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 paraameter specified".

Signed-off-by: Yuechao Zhao 
---
- modify subject to 'hwmon:(nct7904) Set default timeout'
---
 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 18c95be..27eb276 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 = _wdt_ops;
data->wdt.info = _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 = >dev;
-- 
1.8.3.1