From mboxrd@z Thu Jan 1 00:00:00 1970 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 BB1F1C32796 for ; Tue, 23 Aug 2022 16:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244692AbiHWQWv (ORCPT ); Tue, 23 Aug 2022 12:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241561AbiHWQWb (ORCPT ); Tue, 23 Aug 2022 12:22:31 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AF4D9E13E for ; Tue, 23 Aug 2022 05:43:20 -0700 (PDT) Date: Tue, 23 Aug 2022 12:43:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1661258598; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B4HtOS66rDPxrLTmMCol0X1aFA0foft7ETCbmwoZ6Lw=; b=HXmFyYDyMwdo2FjW5iC8O+N2JQgfuHnfVLBquC6xeHy6Tlv3nxKGomdLBNdat0XYOC2iQ+ zzENxqM4gJnRVc16U1VpUZRauS/CB94ibLL6OrqaGD4f2ryVUFdPSVVADo16hGa85zdNu1 zzZDFxjQtAwJuczH8QT38UlbuDkHdP/aJavRlcsrNU/TUe9snFE90xvyshy+LhE8QLYqOL lRiAQulZbvRJundISVYNlqw4mQk3dsrDmSYBN921Gicjk0NQ3uQx6S938B03ojlJyMZq5w FlPK4SPTt4G7D2MPaHOC/tY9mLgVNm0sbUGc7HjxdJ5vOfWQkdoKvDu5qHODyg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1661258598; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B4HtOS66rDPxrLTmMCol0X1aFA0foft7ETCbmwoZ6Lw=; b=r43tYInTANrqhUnxdE6FiI0D55igHePc1Ks8tVWcP90GdHM9DC7mKP+6ZTetI4TwV0YeW+ GmoT1PMkcrtsB0Bw== From: "thermal-bot for Daniel Lezcano" Sender: tip-bot2@linutronix.de Reply-to: linux-pm@vger.kernel.org To: linux-pm@vger.kernel.org Subject: [thermal: thermal/next] thermal/of: Make new code and old code co-exist Cc: Daniel Lezcano , Daniel Lezcano , rui.zhang@intel.com, amitk@kernel.org In-Reply-To: <20220804224349.1926752-3-daniel.lezcano@linexp.org> References: <20220804224349.1926752-3-daniel.lezcano@linexp.org> MIME-Version: 1.0 Message-ID: <166125859753.401.12203848347786618091.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The following commit has been merged into the thermal/next branch of thermal: Commit-ID: 48ad3b104b9ec85de58c2b4e38fdad9a26446f99 Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//48ad3b104b9ec85de58c2b4e38fdad9a26446f99 Author: Daniel Lezcano AuthorDate: Fri, 05 Aug 2022 00:43:18 +02:00 Committer: Daniel Lezcano CommitterDate: Wed, 17 Aug 2022 14:09:37 +02:00 thermal/of: Make new code and old code co-exist 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 Link: https://lore.kernel.org/r/20220804224349.1926752-3-daniel.lezcano@linexp.org 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 50d50ce..69447ab 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1492,10 +1492,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", @@ -1503,8 +1499,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 c5cbe25..a17087c 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 @@ free_tz: 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; @@ -1523,7 +1532,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;