From patchwork Mon Apr 10 20:52:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 672578 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 936D4C77B61 for ; Mon, 10 Apr 2023 20:53:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229838AbjDJUxp (ORCPT ); Mon, 10 Apr 2023 16:53:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229836AbjDJUxk (ORCPT ); Mon, 10 Apr 2023 16:53:40 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 275F92128 for ; Mon, 10 Apr 2023 13:53:38 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id d9so5625094wrb.11 for ; Mon, 10 Apr 2023 13:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681160017; x=1683752017; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wgjQsE1Hdvwl1NpUaWmvVlqrPBksB4aMkQUF06EbqG0=; b=GMbkVC5Odhohp4FRso5dq41lhdBBmwA0cCsSv1a/9GCDi+dGlj1xq07iL7kn4n0TDF jMzdfCAvDiEBAbWfWTOJ28/rnuViok0d2ohjI6x3Zarbg/Q6qJFMOPy0b6wlmFPGeK+C CUfQ3kR3yY03IQnrTOhxrvhYoyV9OKoyBqvvtfJJPjbDzSzTJOM7SQT28mIVUxyb3EZp g/wy70BBo/Rhg2Gn8Uy19Xu2Tddy6CZE5DcSPdcZPT39MtdYE0jUqBczrVMxREVIxqPR kxWKjRGAeJsOvmZOwKPXzRC0bP36mbDB6rVmh6WviMJ8nkDIg+qTqRNGHkwreBtp8N6+ 3VlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681160017; x=1683752017; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wgjQsE1Hdvwl1NpUaWmvVlqrPBksB4aMkQUF06EbqG0=; b=Cum4etmFMjEadim2FRZFSYbUcYc4/Et777jYRHXOhyITyU5GLGQGW2ixcG5UIcUwwa r2ImfSPLRxiAZG5c8kyWJaSqSBVaKtTYpBnD9mO1IvRPb+DJG6ExGpz3MQ7oFjQfgD3k CGm11Ht0ZJoBKz4rK9qMFqttmB0EKEoAAOXIdzr1os21MGj948w6TNfPUqRzmeKzxSGD H2/tlzmnzr9O915rWSNFLcXTj0/nHbVm4JvPapbmAP/A5/KMYdqPxL7n3ig0eAEzIoYf JviTH/FtwmIAzrfF9q9FtJ0Wsd888ZXggmzroejfmQ4cUUgdLAgr7qACIu9bNQTWitJv X8/Q== X-Gm-Message-State: AAQBX9eEPbFYm11jA774aYYTbzq7/DIfq66xvMPw4HWyaFV4tURCo/ZR 28d4jLwLsq9B9KksX2SlZGVmaA== X-Google-Smtp-Source: AKy350b05mU+al6g2Ror4NodaOndG1msKWfJ52vGjmVkxmCNOvPO/YJaOzW6kKCeQSvoVCDsdSThzg== X-Received: by 2002:a5d:5510:0:b0:2ce:9877:84ae with SMTP id b16-20020a5d5510000000b002ce987784aemr8705347wrv.16.1681160017218; Mon, 10 Apr 2023 13:53:37 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:2611:592:3b9e:d2ae]) by smtp.gmail.com with ESMTPSA id e17-20020adffc51000000b002ef2e148d59sm11966789wrs.16.2023.04.10.13.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 13:53:36 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v2 0/7] Thermal zone device structure encapsulation Date: Mon, 10 Apr 2023 22:52:58 +0200 Message-Id: <20230410205305.1649678-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The thermal zone device structure is defined in the exported thermal header include/linux/thermal.h Given the definition being public, the structure is exposed to the external components other than the thermal framework core code. It results the drivers are tampering the structure internals like taking the lock or changing the field values. Obviously that is bad for several reasons as the drivers can hook the thermal framework behavior and makes very difficult the changes in the core code as external components depend on it directly. Moreover, the thermal trip points being reworked, we don't want the drivers to access the trips array directly in the thermal zone structure and doing assumptions on how they are organized. This series provides a second set of changes moving to the thermal zone device structure self-encapsulation. The ACPI and the Menlon drivers are using the thermal zone's device fields to create symlinks and new attributes in the sysfs thermal zone directory. These changes provide a hopefully temporary wrapper to access it in order to allow moving forward in the thermal zone device self-encapsulation and a Kconfig option to disable by default such a extra sysfs information. Changelog: v2: - Add the Kconfig option to remove specific attributes - Add a thermal_zone_device() wrapper to access tz->device Daniel Lezcano (7): thermal/drivers/intel_pch_thermal: Use thermal driver device to write a trace thermal/core: Encapsulate tz->device field thermal/drivers/acpi: Use thermal_zone_device() thermal/drivers/menlow: Use thermal_zone_device() thermal/core: Prepare sanitizing thermal class sysfs content thermal/drivers/acpi: Make cross dev link optional by configuration thermal/drivers/intel_menlow: Make additionnal sysfs information optional drivers/acpi/thermal.c | 57 +++++++++++++++++------ drivers/thermal/Kconfig | 12 +++++ drivers/thermal/intel/intel_menlow.c | 12 +++-- drivers/thermal/intel/intel_pch_thermal.c | 5 +- drivers/thermal/thermal_core.c | 6 +++ include/linux/thermal.h | 1 + 6 files changed, 74 insertions(+), 19 deletions(-)