Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp231866imn; Mon, 25 Jul 2022 14:52:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tId4cEidX7umHTTwNvDTua5Wzxyqi5vcvjULqRpICEYZRi8cGYZ9FipJ1ram+Ey81PgKmf X-Received: by 2002:a17:906:846d:b0:72f:3901:de1c with SMTP id hx13-20020a170906846d00b0072f3901de1cmr11497244ejc.199.1658785971728; Mon, 25 Jul 2022 14:52:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658785971; cv=none; d=google.com; s=arc-20160816; b=mZpvtpVFj5fSdBy1WKI2lN8lc1T3vtPwPccieysmeQQf+Cz8MWYDd5wHMiB1Es/Xid ltecvEoaPNxfA6PdsZESCS2GfxTLfhyV3s/HyT1LaI98xjbyJ7qI0NdM9xXm5jFLCS1/ eR6B0cyFZqvkHTQ47KIkJuCkSpQsriWlkVLW/SvpvCaMLWi7W9KUqET3H0V54Qsa2Qzh k0+2/UOya6ttG5v25KZZR1uJQV8lVgvbmZM9H8yWBIL4GfCJcZih7bvoojf6MPrmktT6 5cQuk6mUgXNIv5Lcm3nk+Art72TqOl3x0LkKI16NKyumtGbCpvTwBegqLiSkxZCyoD1P 7p/A== 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=+fP/YW6lKk1YJJQWc/7vmVyoV6adpF0oqi8olxQPTOI=; b=rYN2lTtUp8aggs0PhQadyeUpb1LHmXLiY8EYr1dvLS+zMacdbpXq+24Ln7fSg7KrF1 VWks47Aj+sjBloPSKwf/f3Y5jcWPAx3TLV+LC8mMSJGv4t/xIbdf0ye3oeLGmCO5D4xN abYL/VkJ7i3txlawkaetm/yyyXmsygpFkfZVsxAco5UC2mmNHlLtm5xbOIYgp6sm1vjg 2hK2XBEPvDB9cCA2DaNhveaOpnVctNGqNokbUDIdyb8MYUAPnO/3iqEEFOj9GSIiuJhM mDL2uxcKxJHSe1blnDQh3nkGX/Hb7y/7fbU81f5d+Qi8k8/hSC8ETtBotun04eogQSDc wXjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b=0feYwnXx; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc41-20020a1709071c2900b007263709af8fsi9048277ejc.995.2022.07.25.14.52.27; Mon, 25 Jul 2022 14:52:51 -0700 (PDT) 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=@linexp-org.20210112.gappssmtp.com header.s=20210112 header.b=0feYwnXx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236967AbiGYV1F (ORCPT + 99 others); Mon, 25 Jul 2022 17:27:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237070AbiGYV05 (ORCPT ); Mon, 25 Jul 2022 17:26:57 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B620240B5 for ; Mon, 25 Jul 2022 14:26:56 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id ay11-20020a05600c1e0b00b003a3013da120so10196185wmb.5 for ; Mon, 25 Jul 2022 14:26:56 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=+fP/YW6lKk1YJJQWc/7vmVyoV6adpF0oqi8olxQPTOI=; b=0feYwnXx3S2BBot69kmOpOTZrOsVcBHsOOlpGhAPFhioWbRVeQHiw/hj/JuMtOW/LV DwFre0nCZhvE/hFn5q5PLOu9okhYPqsKOU6CAEhCih7dgJSPKU2Ue+mAR1lsqagakOkr d++OwpTy0W0iW2VfW7XeTLxJfwBFFTJK8dWPTBFo0Ldiag2euoH79Yyl4iLlgJYW3Gdp DZAbZkHp/WDhpQucou3zO6xIcpVuLglLDwr3Xuf3mVIvoMUvJDLkU0kLe8oH3eMArfJQ UqkC73BCw9tFAWNyU5DkrrDdIZQifHXyD/yf18HM6OUPLyAhLvJ0cBU8knK6aasVbEXI WQeQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=+fP/YW6lKk1YJJQWc/7vmVyoV6adpF0oqi8olxQPTOI=; b=LrDUCRWvIGEO+p0SAyaoyzICFEBchP9J6mzwU7lZ1nxMfvxm9333Q2lvL/GnwIDHHq rrbalM0JAcPlm1cO43UrxSSkfFytgSxyJ5UiglIzR/EHdsf73PFfd1EoTftkLDXr5j0C u59Aw23XadPlQV8D17KsxKv5brRVFYEVcZKhdBXvUGYF4BVx1fOfpZpGIIRfEvE5ouQj kNbcueXotynH7dO61DHclo+0uA5Zt/PQMdWA8oi/uwJ868RSFhPbBCJlJ65q9XCY8jdv OrGW14oY1hjU7GcXwbW8sDvanwXzSzUeeVDt3TrWgTykdNK0FF0/tkXY8314w8s+c/5i /q3w== X-Gm-Message-State: AJIora/7qkApJhKRZ83wBo+ehdEqbbjtKdfEE/BI1sGJDDeE61adcbfY oc2NiKJC729sVQltNDsLz4AUpA== X-Received: by 2002:a05:600c:1549:b0:3a3:2aa2:6f60 with SMTP id f9-20020a05600c154900b003a32aa26f60mr9660502wmg.57.1658784414975; Mon, 25 Jul 2022 14:26:54 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:1780:8e54:dd38:6668]) by smtp.gmail.com with ESMTPSA id r17-20020a5d52d1000000b0021d68a504cbsm12668772wrv.94.2022.07.25.14.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 14:26:54 -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, broonie@kernel.org, damien.lemoal@opensource.wdc.com, heiko@sntech.de, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com, jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com, baolin.wang7@gmail.com, f.fainelli@gmail.com, bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com, glaroque@baylibre.com, miquel.raynal@bootlin.com, shawnguo@kernel.org, niklas.soderlund@ragnatech.se, matthias.bgg@gmail.com, j-keerthy@ti.com, Amit Kucheria Subject: [PATCH v2 02/32] thermal/of: Make new code and old code co-exist Date: Mon, 25 Jul 2022 23:26:07 +0200 Message-Id: <20220725212637.2818207-3-daniel.lezcano@linexp.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220725212637.2818207-1-daniel.lezcano@linexp.org> References: <20220725212637.2818207-1-daniel.lezcano@linexp.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 This transient change allows to use old and new OF together until all the drivers are converted to use the new OF API. This will go away when the old OF code will be removed. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 6 ------ drivers/thermal/thermal_of.c | 13 +++++++++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 0d9e9b175f93..a4783ab7eabd 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1495,10 +1495,6 @@ static int __init thermal_init(void) if (result) goto unregister_governors; - result = of_parse_thermal_zones(); - if (result) - goto unregister_class; - result = register_pm_notifier(&thermal_pm_nb); if (result) pr_warn("Thermal: Can not register suspend notifier, return %d\n", @@ -1506,8 +1502,6 @@ static int __init thermal_init(void) return 0; -unregister_class: - class_unregister(&thermal_class); unregister_governors: thermal_unregister_governors(); error: diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 7e7713c32e89..dbb450a9823c 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -485,6 +485,15 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *data, { struct device_node *np, *child, *sensor_np; struct thermal_zone_device *tzd = ERR_PTR(-ENODEV); + static int old_tz_initialized; + int ret; + + if (!old_tz_initialized) { + ret = of_parse_thermal_zones(); + if (ret) + return ERR_PTR(ret); + old_tz_initialized = 1; + } np = of_find_node_by_name(NULL, "thermal-zones"); if (!np) @@ -1004,7 +1013,7 @@ __init *thermal_of_build_thermal_zone(struct device_node *np) return ERR_PTR(ret); } -static __init void of_thermal_free_zone(struct __thermal_zone *tz) +static void of_thermal_free_zone(struct __thermal_zone *tz) { struct __thermal_bind_params *tbp; int i, j; @@ -1517,7 +1526,7 @@ EXPORT_SYMBOL_GPL(devm_thermal_of_zone_unregister); * Return: 0 on success, proper error code otherwise * */ -int __init of_parse_thermal_zones(void) +int of_parse_thermal_zones(void) { struct device_node *np, *child; struct __thermal_zone *tz; -- 2.25.1