From patchwork Tue Feb 28 11:22:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2958718wrd; Tue, 28 Feb 2023 03:33:58 -0800 (PST) X-Google-Smtp-Source: AK7set8UG+Kd1VYFO2CB0seSYxjXbjvxH1Q7xjNcOgg7hCfjeajn0UZbH/2D1oI1XqXmp+nckiRe X-Received: by 2002:a05:6402:54:b0:4ac:c562:bf7d with SMTP id f20-20020a056402005400b004acc562bf7dmr2900966edu.2.1677584038692; Tue, 28 Feb 2023 03:33:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677584038; cv=none; d=google.com; s=arc-20160816; b=jpN8wIbP9tSHJMLGpl0aysfK7BkLf/hmmsp14vv9kcVMFhcJhBfb2MwW8H9IJOZpfV 0nZlinaMNjEAUZ/Ks/l/AFXjkCpm492YwRweuxDxdtXY2CQRPlLN27RnEURFFzY0cDDc 8E9a8A5pv7tzetij1hPfRyPRX5V9EO6GuOKANYde0UOCHALY6fni87L/uSlPJ/t6p0YG imQdp98XsSeWylRzXPbtd0ELuNxVJ/wf6LFVuzZEU9hFB2HgBuoSDjrdc8umy4uxKHqu onGzfxtd6oANjcZ/wKyywJNSPS33IPpCOu0RNpHrRTsMVKC2PAYy6FJzDj2tyLhVyBiw vCHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GP9BUpkAAnItZXgZisVn1kO1oz9qmtA+bV8jqWpOtJM=; b=RbQDA39duckRU6RZau37yn7+mF4CD67upgt1k1QYANLv5EiMulcGL5+0NtzONCHGaP lG6F8QAlOnAYy6dzZb88E3mHV1hL2zK6xGYKfCibfU3+BUVLohGtNmJl/j1uj9YnPQtN +sisbjgBUWRa2k5AUidaA3fnzN4H82hdvBhVKAZTLG/OOXSG4dvwecoGfdTbCXut5tjp sKyR89FpXuPNaQtLojM1LiuxJ6d2iqXccm+0QDP/7evUR3idpk95oWy6fwbuDEpGorgc mBdyqb8TSjsNutSfYsQRIqQY0soxeefloT/sRQDsg0hiAjohVcXa+J0rG837bu+i9A9n dNlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SauDXJNk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a9-20020a50ff09000000b004ad6d76c2e2si10684201edu.190.2023.02.28.03.33.30; Tue, 28 Feb 2023 03:33:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SauDXJNk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231646AbjB1LZO (ORCPT + 99 others); Tue, 28 Feb 2023 06:25:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbjB1LYV (ORCPT ); Tue, 28 Feb 2023 06:24:21 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F0222E821 for ; Tue, 28 Feb 2023 03:23:48 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id e37so6856384wri.10 for ; Tue, 28 Feb 2023 03:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583422; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GP9BUpkAAnItZXgZisVn1kO1oz9qmtA+bV8jqWpOtJM=; b=SauDXJNkgfwQ1ggwYxd3HcJ5q2YHnt2xK5twAXslHbZRS9MM/k74NroFLzymffLQUg /8Qo+sDoEPUr1cSGopMkHV3jf8uF4DS6dqFujIxwlA8wzFqlH4j/oBWz2vvSMQ3I3H+1 HBdWJlW1shUTK/+vTRiVKqlNYiL4iqNmuARgw3QYABI3N26BEUtlFSfTQoZTtckw3F+I HEe0axve0k3LS4JYeh9NfoN7qd9Ml3FjmJBG4gHNagPr33+DlbXBFWUf+9bPM4h46vaQ 6O039a1e6OZLPfxDNhYDltwXd81IWKEHJCatF56nZixI8AIWl8WznaGgK4jZHB5F8UDh n3nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583422; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GP9BUpkAAnItZXgZisVn1kO1oz9qmtA+bV8jqWpOtJM=; b=aNR3QuNtxd5Yb+HO8NtiVsrNs2mvwUBNLuotemHBAK1WdnjZtflIXN1r1yjeXzKU6L 3RTnQ9aPnX+Ov5HySjnYIVmmMBDmde0569msErStAwQpfq9Usl7AWI5tJ/eTfxnWnexj 3bmXpKakFtNKiJzPevuNmLLst8zfVlf1BvjWCFF94vQo4OqPMQJyAQFDWjoL6WKjgfmS f8aI5kJjLf5SDH2BzvxWz18QIuntqbcUyLfSWBr/D82AGJC7uWsS+nbvJWL/9tDQK/i7 f5OsIYZ0Iosgv6Kuj1NR51kIUR3CsARrn8+UsbB0+Cnt3lCOI0h8izebx/IxQaBoyHiS PUHg== X-Gm-Message-State: AO0yUKVvZsMRGecVS2gt2q9b3N/EpfclODg5t0u8Tgk+k7LUQ1apQuqz ZfRRsMUXnXt/G8BxRq/FrIgGWw== X-Received: by 2002:a5d:5651:0:b0:2cc:459b:8bc8 with SMTP id j17-20020a5d5651000000b002cc459b8bc8mr1651726wrw.6.1677583422037; Tue, 28 Feb 2023 03:23:42 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:41 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Kaestle , Hans de Goede , Mark Gross , platform-driver-x86@vger.kernel.org (open list:ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER) Subject: [PATCH v4 18/19] thermal/drivers/acerhdf: Make interval setting only at module load time Date: Tue, 28 Feb 2023 12:22:37 +0100 Message-Id: <20230228112238.2312273-19-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759074361184213097?= X-GMAIL-MSGID: =?utf-8?q?1759074361184213097?= The thermal zone device structure is in the process of being private to the thermal framework core code. This driver is directly accessing and changing the monitoring polling rate. After discussing with the maintainers of this driver, having the polling interval at module loading time is enough for their purpose. Change the code to take into account the interval when the module is loaded but restrict the permissions so the value can not be changed afterwards. Signed-off-by: Daniel Lezcano Acked-by: Peter Kaestle Reviewed-by: Hans de Goede --- drivers/platform/x86/acerhdf.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 1956469c3457..61f1c3090867 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -79,7 +79,6 @@ static unsigned int list_supported; static unsigned int fanstate = ACERHDF_FAN_AUTO; static char force_bios[16]; static char force_product[16]; -static unsigned int prev_interval; static struct thermal_zone_device *thz_dev; static struct thermal_cooling_device *cl_dev; static struct platform_device *acerhdf_dev; @@ -346,20 +345,15 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal) trips[0].temperature = fanon; trips[0].hysteresis = fanon - fanoff; - if (kernelmode && prev_interval != interval) { + if (kernelmode) { if (interval > ACERHDF_MAX_INTERVAL) { pr_err("interval too high, set to %d\n", ACERHDF_MAX_INTERVAL); interval = ACERHDF_MAX_INTERVAL; } + if (verbose) pr_notice("interval changed to: %d\n", interval); - - if (thermal) - thermal->polling_delay_jiffies = - round_jiffies(msecs_to_jiffies(interval * 1000)); - - prev_interval = interval; } } @@ -807,5 +801,5 @@ static const struct kernel_param_ops interval_ops = { .get = param_get_uint, }; -module_param_cb(interval, &interval_ops, &interval, 0600); +module_param_cb(interval, &interval_ops, &interval, 0000); MODULE_PARM_DESC(interval, "Polling interval of temperature check");