From patchwork Wed Mar 1 20:14:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 13156450 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAB04C678D4 for ; Wed, 1 Mar 2023 20:16:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230113AbjCAUQ6 (ORCPT ); Wed, 1 Mar 2023 15:16:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230020AbjCAUQU (ORCPT ); Wed, 1 Mar 2023 15:16:20 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08B1351F93 for ; Wed, 1 Mar 2023 12:15:56 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id q16so14524553wrw.2 for ; Wed, 01 Mar 2023 12:15:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701751; 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=w20389TVo7cyTMlF1uBdGLoV3aG9r8YnIBrEEaUmS9NigcXApbhiu+OjC9ruIiIyfC qNCdf4BKsBXu3pPRYxFsPeKFTm3gYDg3uMAMMVTVEmgan5U/bqXsoEB63X4rxO4Pn3lr STj1QF6J54achUo1iLzZTLul3chly+tXnbQHYT169j5RNdJk3Y6c2r7Xh4gZvAzZ260/ HszIq/U4S41qFWXpL71jXGfFIngIdvBLkbXJPomnbPjLWH86lNjdQSlBWb07wjK6vtGl 5QAIn0Ux8tUZW/347UD7g6foztFrY++6eH+t7cDjy8ddi5k7jnpowdUOs2fBgR2KDJUs +70w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701751; 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=8Biz3wnhDMPWlYCafsZ3ZCvY0Bx39Js+MsEBIlMOKz3maeM1Vcrd3wdX7tQbqvBwK+ B3NL9eKQrr26/QqXwiSJNiZmDZeD4wwxwBJ8p7npg5jyqfMi4wVMOJxY1E+IOTNHdkCU XOS+oFSv3HWIV4moZKeK4949szvdaTuWHiSIo6JuqNMNklMjoV9YoWwHVCaMlf8mcWMp tBGQRa1Neu89c6MWYzR70esepTXzVHxEXOm5jzFYhwYsKQRxf3K2mO8W2enWirFqQr1c At/V9Bl/iIwoQVxwkdvCjbsdI/bBqIGOfSAP6hd+hgo4Y37sRr7yAbDM8pyswT6FBRE8 bdlw== X-Gm-Message-State: AO0yUKX8vwMEYr20Cy/KQiIagk/YP40LV8m60A1F8+FJQ8ezyjKXFcT0 0z+0hU/0eF3oGXyu5fT9YB3rKIKz/C+wjmv/fIHrAw== X-Google-Smtp-Source: AK7set8XUqwRo5r5lojj7sUCgZls1QjoUg3zR+RESxHPeB+d5LlWXJhnxfeLre8oPm3UQJDLA0WWYg== X-Received: by 2002:adf:ff8f:0:b0:2c7:1757:3a8e with SMTP id j15-20020adfff8f000000b002c717573a8emr5126686wrr.34.1677701751124; Wed, 01 Mar 2023 12:15:51 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6ffe:ce4f:bd31:1e6d]) by smtp.gmail.com with ESMTPSA id x16-20020a1c7c10000000b003e70a7c1b73sm576546wmc.16.2023.03.01.12.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:50 -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 v5 17/18] thermal/drivers/acerhdf: Make interval setting only at module load time Date: Wed, 1 Mar 2023 21:14:45 +0100 Message-Id: <20230301201446.3713334-18-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301201446.3713334-1-daniel.lezcano@linaro.org> References: <20230301201446.3713334-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org 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"); From patchwork Wed Mar 1 20:14:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 13156451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51A04C7EE33 for ; Wed, 1 Mar 2023 20:17:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230030AbjCAURA (ORCPT ); Wed, 1 Mar 2023 15:17:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbjCAUQU (ORCPT ); Wed, 1 Mar 2023 15:16:20 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9985C51FAC for ; Wed, 1 Mar 2023 12:15:59 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id l7-20020a05600c4f0700b003e79fa98ce1so262941wmq.2 for ; Wed, 01 Mar 2023 12:15:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677701752; 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=FS5MMzUrtYY5N2w5QCadh2L/6Lyuv9jfcaqNKoRqTRU=; b=Wh1pDVCEqhjlJTafWbx23xgrU9MTAStk8awP1aqswW8Gi720ZllVpBTdpV3pypOdWz 2/1vcLJXoc2h8DLn7W+CYb7HiFJpY7f/LNhRdj9ryZbyr7m8zfnh18M7I6xmMREEqzNb E47oMtCLR2ltG9x6r3qAYDSCAlyuIENYjlwWtwF0VQ8JGHJVJ6W/gRJXjsJOmz9UUGL6 SGa/FjUFqa4l4hfO97J8INxHyV02noj65Yz08aDuXf5G4HQO77iriljdBwmilKvw8MQX 4kMJ5yIx2ReX6Pl9Cio9VyyByqM4ZHizUjCXu3kUXuUbTX0s0ADV336rk7PqnW4mGKxm AZpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677701752; 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=FS5MMzUrtYY5N2w5QCadh2L/6Lyuv9jfcaqNKoRqTRU=; b=v1aQ4ri3KIC4nKtycuN9dNeYnuRW4gfHereODlExT4mcx2bw6neDwMmwkqGwyqz9om uyntTGY7bP2If0x8kDxj/Zb63k0bgFdtmvPU9seOqp5zm6j32SufFb02NdjlaehoP4gK XTUwY+0T8SIOIDOO7MuhGLyki+UzVT8A/iu1P2gd4Tm6h0Hq+39/YzdO3AVPjTediixV J1yJZ6G0U7JMoQYOXudolHz9ngGbIKkMDgX08DxVZ7Fkm8xQ4hgv/FmJuH3rzGHQ1miU 4IhqYF+FtTvyqnU6Egk+OsSsuCMA9QERAMeqGLB3heo75nxgMeY/cKj4HJv3K/KHe7e2 i0pw== X-Gm-Message-State: AO0yUKX1cTrlRKl0YrHSMsQN+VRIjKbsXS3SVxd0wEzfkoGV5Ryw8zLQ Cis10ASZe4a7MdKcL5xQxeXNyA== X-Google-Smtp-Source: AK7set9/48B3UkJzRbD9ghUuPOZUq417aVxqF4bZ/zrpzF6PhFApIvpjoxt3GWWtJuYzeCOE4ikdug== X-Received: by 2002:a05:600c:1716:b0:3eb:2e66:9 with SMTP id c22-20020a05600c171600b003eb2e660009mr6538243wmn.30.1677701752097; Wed, 01 Mar 2023 12:15:52 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6ffe:ce4f:bd31:1e6d]) by smtp.gmail.com with ESMTPSA id x16-20020a1c7c10000000b003e70a7c1b73sm576546wmc.16.2023.03.01.12.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 12:15:51 -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 v5 18/18] thermal/drivers/acerhdf: Remove pointless governor test Date: Wed, 1 Mar 2023 21:14:46 +0100 Message-Id: <20230301201446.3713334-19-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301201446.3713334-1-daniel.lezcano@linaro.org> References: <20230301201446.3713334-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org The thermal zone parameter specifies the bang-bang governor. The Kconfig selects the bang-bang governor. So it is pointless to test if the governor was set for the thermal zone assuming it may not have been compiled-in. Remove the test and prevent another access into the thermal internals. Signed-off-by: Daniel Lezcano Acked-by: Peter Kaestle --- drivers/platform/x86/acerhdf.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 61f1c3090867..71b9c1f922d9 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -697,13 +697,6 @@ static int __init acerhdf_register_thermal(void) if (ret) return ret; - if (strcmp(thz_dev->governor->name, - acerhdf_zone_params.governor_name)) { - pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n", - acerhdf_zone_params.governor_name); - return -EINVAL; - } - return 0; }