From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CF45C433E1 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 76DD220723 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 Content-Type: text/plain 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; -- 1.8.3.1