From patchwork Fri Jul 22 19:59:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 12926825 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 3FED8C433EF for ; Fri, 22 Jul 2022 20:00:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235459AbiGVUAd (ORCPT ); Fri, 22 Jul 2022 16:00:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233326AbiGVUAc (ORCPT ); Fri, 22 Jul 2022 16:00:32 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 171865007E for ; Fri, 22 Jul 2022 13:00:31 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id u5so7889226wrm.4 for ; Fri, 22 Jul 2022 13:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linexp-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=V3j7KdP9diKndVr49hY7R5tOEchn8S7gnNI8IEoVqXc=; b=hV0JT1g0753+tBm9fMshVZ2sEgZ5B9ZEa18ZoTNcWXQWia4/LtRgE6ce5WR9uyzOC4 03JYij9aZYnX5dGL1imPWcDgZul1UjnJqRIK/xREy6SsE7SRkYzAq//LQ7oX8iyy00Xf YgymQNCb3tvEBq0p+SJz+jCvdhVXmZxKREvd7WgHE1ZanYZQ9cvFy22UADXJiAH05sES 8DVOH1dCpQFEaS0rm4fZTPLFo4z6ULt5i8z3kellO8C8Jdw8fs6087PzTKmFqJ40AGtM D5VtU40bdww/LIY/YDKOfb8h+G/tPAJAUyGdaysJzKx06HsxfbUNnICGO7xDu8G72izg RyWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=V3j7KdP9diKndVr49hY7R5tOEchn8S7gnNI8IEoVqXc=; b=qRGuniG13tonaeEHYyrG7M4eXw2UPW9P4uHpELL3iVjbjNscUIVPo4to9Kc3bx4i+k GTzjVO2VBdgyeX9zgn5Jm380rsgy31+kGCLttK4VAjxGlY1lVYsSF3jLb95cF+IF0ctz GZW4DGAgx8+po7I6peTaHjk2mmud/lr9/eKa3kZcTsShcSyqh3vyVQlYnkzHQaQxun9Y M3RnK6WtMzjFOZ3/XsPpNAnWIMUr16B1Kcivi9BR4zjUkU8dvCeosHHSbo9w9wE62zSL 3pTlj/cCcqFSWsdjL2GKGL78v46dpJst0dpU0obBRiyxtSyYKRw2B0myteH3x/hJ+wjS wUkw== X-Gm-Message-State: AJIora872aK6QqHtM8XyURSWjUTwnt2s2Tw93TOOEJ4HHeZDwE3Tfwnh 6lJilGqmnh4E9eT2WIZtuMDJRA== X-Google-Smtp-Source: AGRyM1uUeYLs8NrRNK1OIGIy/VCdePWCDGTvxbwnaShq1ewnyjm/o5XlQ69K8zBXapP6wnjwY5+lNw== X-Received: by 2002:a05:6000:18c1:b0:21e:4712:b284 with SMTP id w1-20020a05600018c100b0021e4712b284mr894689wrq.545.1658520029437; Fri, 22 Jul 2022 13:00:29 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:957f:d36d:87f9:5c17]) by smtp.gmail.com with ESMTPSA id k23-20020a05600c1c9700b003a31b00c216sm6429008wms.0.2022.07.22.13.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 13:00:29 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, khilman@baylibre.com, abailon@baylibre.com, lukasz.luba@arm.com Subject: [PATCH v6 00/12] thermal OF rework Date: Fri, 22 Jul 2022 21:59:57 +0200 Message-Id: <20220722200007.1839356-1-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The thermal framework initialization with the device tree appears to be complicated and hard to make it to evolve. It contains duplication of almost the same thermal generic structures and has an assymetric initialization making hard any kind of serious changes for more complex features. One of them is the multiple sensors support per thermal zone. In order to set the scene for the aforementioned feature with generic code, we need to cleanup and rework the device tree initialization. However this rework is not obvious because of the multiple components entering in the composition of a thermal zone and being initialized at different moments. For instance, a cooling device can be initialized before a sensor, so the thermal zones must exist before the cooling device as well as the sensor. This asynchronous initialization forces the thermal zone to be created with fake ops because they are mandotory and build a list of cooling devices which is used to lookup afterwards when the cooling device driver is registering itself. As there could be a large number of changes, this first series provide some steps forward for a simpler device tree initialization. More series for cleanup and code duplication removal will follow. Changelog: - v6: - Folded patches 8, 9, 10 - Removed thermal_zone_get_trips() and thermal_zone_get_num_trips() - Moved tz->ntrips => tz->num_trips changes into patch 11 to fix the git bisecting - v5: - Remove extra of_node_put() reported by lkp - V4: - Added of_node_put(trips) - Changed naming 'ntrips' -> 'num_trips' - Updated documentation for added and renamed fields in the thermal zone structure - Fixed bad parameter type 'thermal_zone' -> 'thermal_zone_device' - Clarified there is more cleanups coming in the changelog - Put 'trips' and 'num_trips' fields all together - Made git-bisect safe the series - V3: - Removed patch 1 and 2 from the V2 which consist in renaming the thermal_zone_device_ops to thermal_sensor_ops and separating the structure. I'll do a separate proposal for that after the incoming cleanups - V2: - Drop patch 1/15 which contains too many changes for a simple structure renaming. This could be addressed in a separate series as it is not necessary for the OF rework - Fixed of_node_put with gchild not initialized as reported by kbuild and Dan Carpenter - V1: - Initial post Daniel Lezcano (10): thermal/core: Remove duplicate information when an error occurs thermal/of: Replace device node match with device node search thermal/of: Remove the device node pointer for thermal_trip thermal/of: Move thermal_trip structure to thermal.h thermal/core: Remove unneeded EXPORT_SYMBOLS thermal/core: Move thermal_set_delay_jiffies to static thermal/core: Rename 'trips' to 'num_trips' thermal/core: Add thermal_trip in thermal_zone thermal/of: Use thermal trips stored in the thermal zone thermal/of: Initialize trip points separately drivers/thermal/gov_fair_share.c | 6 +- drivers/thermal/gov_power_allocator.c | 4 +- drivers/thermal/tegra/tegra30-tsensor.c | 2 +- drivers/thermal/thermal_core.c | 53 +++++-- drivers/thermal/thermal_core.h | 15 -- drivers/thermal/thermal_helpers.c | 13 +- drivers/thermal/thermal_netlink.c | 2 +- drivers/thermal/thermal_of.c | 201 +++++++++++++----------- drivers/thermal/thermal_sysfs.c | 22 +-- include/linux/thermal.h | 24 ++- 10 files changed, 189 insertions(+), 153 deletions(-)