From patchwork Wed May 27 06:16:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?eXVlY2hhby56aGFvKOi1tei2iui2hSk=?= X-Patchwork-Id: 11572003 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96350739 for ; Wed, 27 May 2020 06:17:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8848F2075A for ; Wed, 27 May 2020 06:17:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725843AbgE0GRN (ORCPT ); Wed, 27 May 2020 02:17:13 -0400 Received: from [58.211.163.100] ([58.211.163.100]:59990 "EHLO mail.advantech.com.cn" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725267AbgE0GRM (ORCPT ); Wed, 27 May 2020 02:17:12 -0400 Received: from ACNMB2.ACN.ADVANTECH.CORP (unverified [172.21.128.148]) by ACN-SWEEPER01.ACN.ADVANTECH.CORP (Clearswift SMTPRS 5.6.0) with ESMTP id ; Wed, 27 May 2020 14:14:13 +0800 Received: from ADVANTECH.CORP (172.17.10.144) by ACNMB2.ACN.ADVANTECH.CORP (172.21.128.148) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 May 2020 14:17:06 +0800 From: To: <345351830@qq.com> CC: , , , Yuechao Zhao , Jean Delvare , Guenter Roeck , , Subject: [v3,1/1] hwmon:(nct7904) Set default timeout Date: Wed, 27 May 2020 06:16:59 +0000 Message-ID: <1590560219-41328-1-git-send-email-yuechao.zhao@advantech.com.cn> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [172.17.10.144] X-ClientProxiedBy: ACLDAG.ADVANTECH.CORP (172.20.2.88) To ACNMB2.ACN.ADVANTECH.CORP (172.21.128.148) Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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 --- Change in v3: - replace 'static int timeout = WATCHDOG_TIMEOUT;' with 'static int timeout;' - fixed typo Change in v2: - modify subject to 'hwmon:(nct7904) Set default timeout' --- drivers/hwmon/nct7904.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c index 18c95be..b042569 100644 --- a/drivers/hwmon/nct7904.c +++ b/drivers/hwmon/nct7904.c @@ -111,14 +111,14 @@ #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;