From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C2B138F25C for ; Wed, 22 Apr 2026 17:43:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879799; cv=none; b=jpJN4pxMyJWpPbAPQiZEjYw/qJo9UCqbeq1j8L74yWD9c9tlT1Z5bN+StdGd2kdi1AAp7XgetEAe/3L2bOj9aqt082T3bWQQt8HvAn1iVGMjVSdfBFKF0drWGcLZKMxSFIraC9fSr41G/Jd1GCC/0k6f/+43sbDs1wIZWuAkXow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879799; c=relaxed/simple; bh=zWS8PuwEBAA/aKTsS1W5V1wcu3h80TjX0hW2zjl2YyY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TWj43QLYA2ST9w387cyJQbsFO8F8UvRvARkNMM+HNmdNviPnshf4NuQL9XVdesR3tm8OvLR9ar+S9C7alj2PBrXOuxuR4OWdzA9tPoR5Cjq9iC2Rpszl1ngbBPjGUUkpCxIS5rbE2AB+R++7fuU0jnMoqufDsNzjPJR7acyBdMs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=HSSKvqma; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=K33xB6Ph; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="HSSKvqma"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="K33xB6Ph" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MG3ebb1230127 for ; Wed, 22 Apr 2026 17:43:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=YAVmnQsYcnQ YdpKJBDYnCqGDQ8o6FQwjhG98mPvL/qc=; b=HSSKvqma7woJ8Qi+alo+1LO+g3F APsb5flzPPCga7UTDbNJ9FADQ/PDuMLPilBhhyDDq7LMVGdXJzoRLxdIBgDCdYfS +mcJsC89mfQZ/Xe4T1LaLzO1XjWRfysO/gziDYQKYsIuKBP+8iYt8hZgXuhLIEky NVsYRhZA1LrLi2Jfgc/GF074nfLcZrNS/nL0bN0/wmo6w5vAHIwlyVgyCJzIaldB ID/t7fB5pU7fyiJf03J4m0DOXmnW8WY/TN7gn5hiB0bAImJbOqR/7xjDyyiAnOkc Nu9qTnlH3eVeNbkTEngP7ksBI+gXGnQfXOpAY05RfqwLkjIRF9SJCwOKXUw== Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq1h68bra-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:17 +0000 (GMT) Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-50f13da9684so41125041cf.3 for ; Wed, 22 Apr 2026 10:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879796; x=1777484596; darn=vger.kernel.org; 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=YAVmnQsYcnQYdpKJBDYnCqGDQ8o6FQwjhG98mPvL/qc=; b=K33xB6PhqHeIFi/UMMSq9mYTMTqCy2gjPgfva+ROpCitvOiRiPDxjW48lrHbFBhcZE JDwK/udiY4F/KQpajSE+S9t6PbVhDGgmtJmx2S6B6lvBn5+RYLAXdfP0XrnuzAt1Nx2Y jtNTamZ7RtNlMWE/8GLNqAApC8JBgu8gN4knTchgBs5l1wZgik+vMfDsjIfI4JhzgnSR fLEQkwuzfuovUFvf+wkLCNiUmlvFYfux7mW8J3OoiKx7mPmYSSN8EAYQmUrpc8C911Uc 5L9sSHPk3pfurYHvxK0PxBT/8yEPQXbDHLQH+hfuG2A9ctVChRQBNcCagUR6AuIppQeg ktuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879796; x=1777484596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YAVmnQsYcnQYdpKJBDYnCqGDQ8o6FQwjhG98mPvL/qc=; b=krtydru54A4sev8A8PSjqHegdWjqhssy6KihgHZc+I1mwxQGcV+KRP2xkHz4efwLPv g1JhWXXpP5NQLQBJXXj9yjKx3lBqXhBSN0frAn0t9LEBeqYNHGcQ09LXEM+JHPeahOUr SbisQBrqreJBNFa2JNYpR4TyOqTfPNgFbJEK8OvS/gzyktw9mDThDgKrj6tdkTYHwW8v iCRcEvcMxihRICruo3Cp6oWwFsSkE+diSlB6EWqTT4qlICh8m2Ab4bJ9/ZFYu2UdodXt uKpXvsCX5YesVCyGJa/DYkJ7O2Mr6BveNPGI4K+7bJyl2n21xIIjuhL5kPM1SE5D2tF6 H+pg== X-Forwarded-Encrypted: i=1; AFNElJ+FK4nMJ6mPUwe218StQDFKtWSRx5YuCzfUpP+X8yleYLtW1ThTAZnZNy12+e5SAiT5DwVtXDD0jwG7PPw=@vger.kernel.org X-Gm-Message-State: AOJu0YzR1MP5/wMTDvSzAk1McCM+lqo3XSJeHA9IxDyEJt1PmzWKiXqy afXfZ7R3oHH9Td8mpKnSCjs2fusLOdCj1Ew977zdWagy/R0u0JByHeNLNnV0iYORMPTZfc1ZtmI h7hJMoUWzWzHDa7PoIbQjB5/aEr31yniu5Bs8TnIdXpu+630IrJlXjKiCndgZy+NFeus= X-Gm-Gg: AeBDievb03TEUUsEDFFzlDb3KdDz1lDO+zeA5UGxO1GZSFW54XtLGJ3H2wojVq1rYwh 6KHCGm50owfKJjdMsgkZHQ8xOcOfcvcwOnBOTChJ8hv+hCqkZggs5PrjA7zNEnDek2gh7wljNAW r75LwdDGhC7crXEOgK2eNP1VUJbCi1pUa7P1/nbz3/e61VUrreq89Tt7h6Tcnb1IqrSLymgwpok O928+wjqz0dRLvPPZhbbIz1V/5RIbrUPU4WYD+7aJB77JuncjWnaS34Z+cp48/b19MoA37Bdiu2 8mQ8LFp7P3xbS6rlH8YYA+by9zOpR14bfZV2Vr2RK/cJchoh8fmojuGuPsT/gKHpF/OalKfaiXe yUGbIXY3cEFNmskmkQEN8cYHRB3E6CbqcIR/kGkxopg+ZpHrWJF3nxkRyXPec X-Received: by 2002:a05:622a:5516:b0:50f:b904:457 with SMTP id d75a77b69052e-50fb9040613mr96316391cf.25.1776879796191; Wed, 22 Apr 2026 10:43:16 -0700 (PDT) X-Received: by 2002:a05:622a:5516:b0:50f:b904:457 with SMTP id d75a77b69052e-50fb9040613mr96315451cf.25.1776879795605; Wed, 22 Apr 2026 10:43:15 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:12 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, "Jiri Slaby (SUSE)" , Mikko Perttunen , Svyatoslav Ryhel , Thomas Gleixner , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT) Subject: [PATCH v2 01/12] thermal/driver/tegra/soctherm: Use devm_ variant when registering a cooling device Date: Wed, 22 Apr 2026 19:42:50 +0200 Message-ID: <20260422174305.2899095-2-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=f4Z4wuyM c=1 sm=1 tr=0 ts=69e908b5 cx=c_pps a=mPf7EqFMSY9/WdsSgAYMbA==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=oPkgDEUO7JvNfMSusBkA:9 a=dawVfQjAaf238kedN5IG:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfXw5RZvar9dEgd XuBa6XbFnlDfMftYZiQ1DHHOdXo422oQVsqZGK5VQJItP/32p+b9t5XRRJuLyvHABL5eR+kObVX iE6Y2Hwl8RISfHgfH1a6mxM5nmqff5RfvthQ/ZJDLIlQwJaOBsl4X5DVdT0EnYtes9qByhaz38L rdNGMCTLZzmNCYVOorTTxvuNYNMGgwBZeOYcgJ7ratZ34Dq7cxZwRyrU6sTrI3i4+vx9TL+60Ha 4X/g7HSwC/8q5LH98aAlM06Ff0aRS2xTaEd11gmEyWPxn7+4mEugn1BJVcUH8lGEOazLU2cUxgC vUE2ixunvqRnfkZXPuiligb1cByAG0GH4bMOjdJueOhZMC/MxIGyYiFdjyrMAcL1NEBGoxkVWxT YJpiLaMJKk8168barnngjt9OOUJjOMR4hAhrzzakKOlPrDnqE4Qv0+j3o8sV+yUvyKQ5UBhMOiQ 4lqs8cr2goll/rYPXRQ== X-Proofpoint-GUID: K9SKzjRxCVz45bzckQIkmnzlwUu1cxrr X-Proofpoint-ORIG-GUID: K9SKzjRxCVz45bzckQIkmnzlwUu1cxrr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 bulkscore=0 malwarescore=0 clxscore=1015 spamscore=0 suspectscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" The driver invokes thermal_of_cooling_device_register() at probe time but without unregistering it at remove time. As we have a devm_ variant, use it and the cooling device should be automatically removed. While this prevents the cooling device from leaking, the unregistration is = now deferred until devres_release_all() runs (after probe() returns an error or remove() completes). A bug can be subtly introduced by this change because the driver still manually disables the hardware clocks during the probe error path and in tegra_soctherm_remove(). This creates a window where the cooling device remains registered and exposed to the thermal core and sysfs while the underlying hardware is powered down. In order to prevent this potential issue, use the devm_ variant for the clk. Compiled-tested only. Signed-off-by: Daniel Lezcano --- drivers/thermal/tegra/soctherm.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/socth= erm.c index 5d26b52beaba..790c4c96a9b5 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -1700,9 +1700,9 @@ static void soctherm_init_hw_throt_cdev(struct platfo= rm_device *pdev) stc->init =3D true; } else { =20 - tcd =3D thermal_of_cooling_device_register(np_stcc, - (char *)name, ts, - &throt_cooling_ops); + tcd =3D devm_thermal_of_cooling_device_register(dev, np_stcc, + (char *)name, ts, + &throt_cooling_ops); if (IS_ERR_OR_NULL(tcd)) { dev_err(dev, "throttle-cfg: %s: failed to register cooling device\n", @@ -2133,13 +2133,13 @@ static int tegra_soctherm_probe(struct platform_dev= ice *pdev) return PTR_ERR(tegra->reset); } =20 - tegra->clock_tsensor =3D devm_clk_get(&pdev->dev, "tsensor"); + tegra->clock_tsensor =3D devm_clk_get_enabled(&pdev->dev, "tsensor"); if (IS_ERR(tegra->clock_tsensor)) { dev_err(&pdev->dev, "can't get tsensor clock\n"); return PTR_ERR(tegra->clock_tsensor); } =20 - tegra->clock_soctherm =3D devm_clk_get(&pdev->dev, "soctherm"); + tegra->clock_soctherm =3D devm_clk_get_enabled(&pdev->dev, "soctherm"); if (IS_ERR(tegra->clock_soctherm)) { dev_err(&pdev->dev, "can't get soctherm clock\n"); return PTR_ERR(tegra->clock_soctherm); @@ -2171,10 +2171,6 @@ static int tegra_soctherm_probe(struct platform_devi= ce *pdev) if (!tegra->thermctl_tzs) return -ENOMEM; =20 - err =3D soctherm_clk_enable(pdev, true); - if (err) - return err; - soctherm_thermtrips_parse(pdev); =20 soctherm_init_hw_throt_cdev(pdev); @@ -2184,10 +2180,8 @@ static int tegra_soctherm_probe(struct platform_devi= ce *pdev) for (i =3D 0; i < soc->num_ttgs; ++i) { struct tegra_thermctl_zone *zone =3D devm_kzalloc(&pdev->dev, sizeof(*zone), GFP_KERNEL); - if (!zone) { - err =3D -ENOMEM; - goto disable_clocks; - } + if (!zone) + return -ENOMEM; =20 zone->reg =3D tegra->regs + soc->ttgs[i]->sensor_temp_offset; zone->dev =3D &pdev->dev; @@ -2201,7 +2195,7 @@ static int tegra_soctherm_probe(struct platform_devic= e *pdev) err =3D PTR_ERR(z); dev_err(&pdev->dev, "failed to register sensor: %d\n", err); - goto disable_clocks; + return err; } =20 zone->tz =3D z; @@ -2210,7 +2204,7 @@ static int tegra_soctherm_probe(struct platform_devic= e *pdev) /* Configure hw trip points */ err =3D tegra_soctherm_set_hwtrips(&pdev->dev, soc->ttgs[i], z); if (err) - goto disable_clocks; + return err; } =20 err =3D soctherm_interrupts_init(pdev, tegra); @@ -2218,11 +2212,6 @@ static int tegra_soctherm_probe(struct platform_devi= ce *pdev) soctherm_debug_init(pdev); =20 return 0; - -disable_clocks: - soctherm_clk_enable(pdev, false); - - return err; } =20 static void tegra_soctherm_remove(struct platform_device *pdev) --=20 2.43.0 From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F5F638F92F for ; Wed, 22 Apr 2026 17:43:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879804; cv=none; b=Z873ehnKTWSHdXL6ptvEWozYazLqICsCaqtw668XstPvFutJ1JJGUu8vmGsAA96a8a/0Vj4QEnegzWknzcoIu574hJu7qpNwpvnmfMVqYwL6yMa1ETd+tkAvKgjMl490bONxZ7/kqJYjfu/ZNUhAvqrDBsk1r/Vhw8LQmC6ySw0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879804; c=relaxed/simple; bh=8CJ7eadvGl7GqKniVLLqEwYFaXzs263oYCNun34bBFU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q+XxTAu+2id3a3BOPfIiXvljkKf9SZCNzElrY8DetaRbUJ+EvB6ek9hF88/AuWWaWh+6QN+QMaNmixxLMieOqId0Eag8W1GWqwaHLvvMpku9vZg15KvSmyj11wqsWmnPZHkvvBx5YMa5ghbkWEb0a+jfqidFhaLTvVUqQHkDgPY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=bHExX8TY; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Fr9SS3qC; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="bHExX8TY"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Fr9SS3qC" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MGA8rE3174074 for ; Wed, 22 Apr 2026 17:43:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=pzqN02xmUOc iJ0Ac5IjOLUP8JJ7SGTjboIPlBRiCRas=; b=bHExX8TY9KGvxpewtk35G4YGTru Bq6uReObllkg5SsUPG+ejYdnC3LE5wvfGRO/G9FrrAS/vBhOGDBEQ2DWjgqHcl+M YqJw1DpakmPJBZzgCgBY3iTsaNrzrrjzuBDTIHR+9PZYMo/Vj7f1Oms98jCQY/nK 8YnW+FxKd9nAifxVVsqhMggWanDAybN+1VrORNLEw5J6XjLSxar7QbyQzOK6wu2o ZIMVSVzFZYEP3egzthJqDcBfRr90AuSTIYa8xU8Km8v4dUJ8lYsamFhBKwwx+SNX DDJ3dzKQxwrcBPDw7v4uIRbu/jKxC3zPoPm5bQGLWe2xoyqwAdJy/T2eDpw== Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq1m30an6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:20 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-50b220c72bbso143468461cf.1 for ; Wed, 22 Apr 2026 10:43:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879799; x=1777484599; darn=vger.kernel.org; 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=pzqN02xmUOciJ0Ac5IjOLUP8JJ7SGTjboIPlBRiCRas=; b=Fr9SS3qCEmeu7HV2xgZio0/obt6/5l6Iru9d8aRGyG7XXO4Yd1uguDC89thhnHfkwe JZ1IXDCVe4wdNbDQ6GotdfE3G7/1GCbTcaakllXhU7FWZOBPymAOQgZd/nh5Do8tTNzZ IxixZOl2f+IM5NQqgDYPfyXijyHfUMehRJfVMV9jcd/IcfYLlLiPdQShdH2tIaXDAXCn J59EwT9bGoIsOZxlo54a05i2k2B6vW1vE8XUnzvk1bbhK1rxYdlL6eQHIjGdWmumFLk1 Nw2CUCJy5bCh7K0Y9Ji2iBxq2M3Mabp5IABmIhZa4pMG5COXQSgnoKASljJVx+V7v+RY rWeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879799; x=1777484599; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=pzqN02xmUOciJ0Ac5IjOLUP8JJ7SGTjboIPlBRiCRas=; b=qOiAtB4KRXQm+nylh9oRkKHvCksctMNRfITYjRjCJSPAtbViBLJGu422cX5S1InKzR 2SnEX8mZtmY83wVC8w9VRsBkkPz/I3tzwQqCCWveibvfnYjrQA0A85upcHe5YYI7PRTV o+NxPWF0WLrUB1ndEWk7jxeN2e2htSVadcnU0nqnXj+sgUtd5uM/1NSfc+1IIM+4TRnH 2DfgrGjoF00rM9VuMWwANGcBfCgGRz7rzMVqtsGce+So8jXYRlLyf+u2FhlbhcqiG8TV uR2H5yJ49F3KsDXtaenaNY3EXxXGmVdDwfzoGQh/PljnpMJRIlCVt1K4/2EEyJ8hxBxv bfug== X-Forwarded-Encrypted: i=1; AFNElJ909FpVWGDZ3sTbLZ2GADfVyBrnrzPcDlbLJetMJ27vpNL27NMR8LGelAh6Az5uyYlFhOqinQe7KZmIyhE=@vger.kernel.org X-Gm-Message-State: AOJu0YyLcG1uCAzFOq4ELPFxWKH7Qea+wKgh/ME6Ps1tbU76Hx5qU/Hx 0r3Mwy5Bj5H2FSfJmrHBb7UXhL/IrFrJteZ7Q+Vjr93SaffZeDuDP43KkL0thh+iUYW5N+Pr4m/ O+KoZCl9DFyXOwBWk49a15zBvbCc9a1fbXkW+H9mh+e1RO0ZD6jpgBZZfifd8PszbF00= X-Gm-Gg: AeBDietYVtSKqvp5LToz7xOWNK2+cpb8Ad+lcDTEch2M50SaDc3Ggp+E2Z+y926dKoh 9135AKmcTswjycrnLBriKtn8Qn4eXy8gGwsyGKwfXPuxlASH2URCoMWzqc+2SgDpAJaZAoVZCFF OsPtuTBX738s+412fxxLLyMU7kacwKt+MprvaLRv1y60M+TZ8rhhcHGdy9SxFYZ/wheg2QhzzXp 7r6R+gnkVIJ3b0pJskZgjs3VCKvyH5D3ID48Dc6eHdalM9xiGcLqIl3Mw5T8wiEmExgzQmLGPPm SGg7JYHNQPJiSHHp3ykGWs6AwzUYQdO7drKs5hmqAzTfni09rj5zGj2mTBFM6f6nUOswwcmzE3x GqdkLZK9WLkLhsNKAGKckNkXG0stWvV8X9v4CklhTC1BxNyGysaMwO7EG47oV X-Received: by 2002:ac8:7fd2:0:b0:509:1ffc:c538 with SMTP id d75a77b69052e-50e36b3f557mr342328631cf.19.1776879799314; Wed, 22 Apr 2026 10:43:19 -0700 (PDT) X-Received: by 2002:ac8:7fd2:0:b0:509:1ffc:c538 with SMTP id d75a77b69052e-50e36b3f557mr342327611cf.19.1776879798680; Wed, 22 Apr 2026 10:43:18 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:17 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v2 02/12] thermal/of: Move OF code where it belongs to Date: Wed, 22 Apr 2026 19:42:51 +0200 Message-ID: <20260422174305.2899095-3-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: R49tZ0Dp1U1SsyPf8_YVHYEKf52DxRuE X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfX1jGufm7UNfvN rIKlMe8tPlQ3KCy8p2Tj3CQdb4hg+55s0b6JPNmP4t3d5pOljVuv6CkFFF/q46t2M7WxiPL5xu3 bNNWpYmXHNrzvcfiw4eCO+Hl76qPbEo8KaNRXc9gfueKXEARJUqCugmqWTmMbmN5of6AcUKWtdA LOYRrXxQmt2qEnAehOFd5AXS3kpWs2VmAeTy4dIXuthTX1JiZa+f0m+ajrru4o19aqCmiv0rGU3 LTL5tC8NaH25eBkdsnWg1xXb+kBdySNDjMQT/TTjVxj0o7ZQY9yQU2WUhuA6fIgwbQMURTgLdIL w3zjOXRQgp7zp5Hs8Q/CoKBAm5fR08atgtK/SFVotru0pqM9WS3Q3bBJOBIRr+ov03o+mMXkJ1W eYE5LZ8NT6f/X4djQYsXeZpiTPDn1v7M2tRASfEZjkzY0C1qgDDiAB/28hCpMPxrMJQA2TRqR31 wa8l9bubEnbe1M4Jiww== X-Authority-Analysis: v=2.4 cv=PsOjqQM3 c=1 sm=1 tr=0 ts=69e908b8 cx=c_pps a=EVbN6Ke/fEF3bsl7X48z0g==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=gsbXGzNoRcIiw2hTtpUA:9 a=a_PwQJl-kcHnX1M80qC6:22 X-Proofpoint-GUID: R49tZ0Dp1U1SsyPf8_YVHYEKf52DxRuE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" The functions: - thermal_of_cooling_device_register() - devm_thermal_of_cooling_device_register() are related to thermal-of but they are implemented in thermal-core. Move these functions to the right file. As the thermal-of file depends on CONFIG_THERMAL_OF=3Dy, by moving these two functions in it, when non-OF drivers are using this API that results in a link issue. In order to prevent unnecessary circumvolutions with the changes, the stubs have been added in the header file resulting in having the non-OF drivers compiled without the CONFIG_THERMAL_OF=3Dy using these stubs and failing to register their cooling devices. This is temporary as the next changes introduces the functions for non-OF drivers and returning to the initial state. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 75 +--------------------------------- drivers/thermal/thermal_core.h | 5 +++ drivers/thermal/thermal_of.c | 72 ++++++++++++++++++++++++++++++++ include/linux/thermal.h | 47 ++++++++++++--------- 4 files changed, 105 insertions(+), 94 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 2f4e2dc46b8f..8a70768b46dd 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1056,7 +1056,7 @@ static void thermal_cooling_device_init_complete(stru= ct thermal_cooling_device * * Return: a pointer to the created struct thermal_cooling_device or an * ERR_PTR. Caller must check return value with IS_ERR*() helpers. */ -static struct thermal_cooling_device * +struct thermal_cooling_device * __thermal_cooling_device_register(struct device_node *np, const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) @@ -1163,79 +1163,6 @@ thermal_cooling_device_register(const char *type, vo= id *devdata, } EXPORT_SYMBOL_GPL(thermal_cooling_device_register); =20 -/** - * thermal_of_cooling_device_register() - register an OF thermal cooling d= evice - * @np: a pointer to a device tree node. - * @type: the thermal cooling device type. - * @devdata: device private data. - * @ops: standard thermal cooling devices callbacks. - * - * This function will register a cooling device with device tree node refe= rence. - * This interface function adds a new thermal cooling device (fan/processo= r/...) - * to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind = itself - * to all the thermal zone devices registered at the same time. - * - * Return: a pointer to the created struct thermal_cooling_device or an - * ERR_PTR. Caller must check return value with IS_ERR*() helpers. - */ -struct thermal_cooling_device * -thermal_of_cooling_device_register(struct device_node *np, - const char *type, void *devdata, - const struct thermal_cooling_device_ops *ops) -{ - return __thermal_cooling_device_register(np, type, devdata, ops); -} -EXPORT_SYMBOL_GPL(thermal_of_cooling_device_register); - -static void thermal_cooling_device_release(struct device *dev, void *res) -{ - thermal_cooling_device_unregister( - *(struct thermal_cooling_device **)res); -} - -/** - * devm_thermal_of_cooling_device_register() - register an OF thermal cool= ing - * device - * @dev: a valid struct device pointer of a sensor device. - * @np: a pointer to a device tree node. - * @type: the thermal cooling device type. - * @devdata: device private data. - * @ops: standard thermal cooling devices callbacks. - * - * This function will register a cooling device with device tree node refe= rence. - * This interface function adds a new thermal cooling device (fan/processo= r/...) - * to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind = itself - * to all the thermal zone devices registered at the same time. - * - * Return: a pointer to the created struct thermal_cooling_device or an - * ERR_PTR. Caller must check return value with IS_ERR*() helpers. - */ -struct thermal_cooling_device * -devm_thermal_of_cooling_device_register(struct device *dev, - struct device_node *np, - const char *type, void *devdata, - const struct thermal_cooling_device_ops *ops) -{ - struct thermal_cooling_device **ptr, *tcd; - - ptr =3D devres_alloc(thermal_cooling_device_release, sizeof(*ptr), - GFP_KERNEL); - if (!ptr) - return ERR_PTR(-ENOMEM); - - tcd =3D __thermal_cooling_device_register(np, type, devdata, ops); - if (IS_ERR(tcd)) { - devres_free(ptr); - return tcd; - } - - *ptr =3D tcd; - devres_add(dev, ptr); - - return tcd; -} -EXPORT_SYMBOL_GPL(devm_thermal_of_cooling_device_register); - static bool thermal_cooling_device_present(struct thermal_cooling_device *= cdev) { struct thermal_cooling_device *pos =3D NULL; diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index d3acff602f9c..bdd59947b24f 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -269,6 +269,11 @@ void thermal_zone_device_critical_shutdown(struct ther= mal_zone_device *tz); void thermal_governor_update_tz(struct thermal_zone_device *tz, enum thermal_notify_event reason); =20 +struct thermal_cooling_device * +__thermal_cooling_device_register(struct device_node *np, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops); + /* Helpers */ #define for_each_trip_desc(__tz, __td) \ for (__td =3D __tz->trips; __td - __tz->trips < __tz->num_trips; __td++) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 99085c806a1f..398157e740fc 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -510,3 +510,75 @@ void devm_thermal_of_zone_unregister(struct device *de= v, struct thermal_zone_dev devm_thermal_of_zone_match, tz)); } EXPORT_SYMBOL_GPL(devm_thermal_of_zone_unregister); + +/** + * thermal_of_cooling_device_register() - register an OF thermal cooling d= evice + * @np: a pointer to a device tree node. + * @type: the thermal cooling device type. + * @devdata: device private data. + * @ops: standard thermal cooling devices callbacks. + * + * This function will register a cooling device with device tree node refe= rence. + * This interface function adds a new thermal cooling device (fan/processo= r/...) + * to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind = itself + * to all the thermal zone devices registered at the same time. + * + * Return: a pointer to the created struct thermal_cooling_device or an + * ERR_PTR. Caller must check return value with IS_ERR*() helpers. + */ +struct thermal_cooling_device * +thermal_of_cooling_device_register(struct device_node *np, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops) +{ + return __thermal_cooling_device_register(np, type, devdata, ops); +} +EXPORT_SYMBOL_GPL(thermal_of_cooling_device_register); + +static void thermal_cooling_device_release(struct device *dev, void *res) +{ + thermal_cooling_device_unregister(*(struct thermal_cooling_device **)res); +} + +/** + * devm_thermal_of_cooling_device_register() - register an OF thermal cool= ing + * device + * @dev: a valid struct device pointer of a sensor device. + * @np: a pointer to a device tree node. + * @type: the thermal cooling device type. + * @devdata: device private data. + * @ops: standard thermal cooling devices callbacks. + * + * This function will register a cooling device with device tree node refe= rence. + * This interface function adds a new thermal cooling device (fan/processo= r/...) + * to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind = itself + * to all the thermal zone devices registered at the same time. + * + * Return: a pointer to the created struct thermal_cooling_device or an + * ERR_PTR. Caller must check return value with IS_ERR*() helpers. + */ +struct thermal_cooling_device * +devm_thermal_of_cooling_device_register(struct device *dev, + struct device_node *np, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops) +{ + struct thermal_cooling_device **ptr, *tcd; + + ptr =3D devres_alloc(thermal_cooling_device_release, sizeof(*ptr), + GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + tcd =3D __thermal_cooling_device_register(np, type, devdata, ops); + if (IS_ERR(tcd)) { + devres_free(ptr); + return tcd; + } + + *ptr =3D tcd; + devres_add(dev, ptr); + + return tcd; +} +EXPORT_SYMBOL_GPL(devm_thermal_of_cooling_device_register); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 0ddc77aeeca2..d9ad860cee87 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -198,6 +198,15 @@ struct thermal_zone_device *devm_thermal_of_zone_regis= ter(struct device *dev, in =20 void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zo= ne_device *tz); =20 +struct thermal_cooling_device * +thermal_of_cooling_device_register(struct device_node *np, const char *typ= e, void *devdata, + const struct thermal_cooling_device_ops *ops); + +struct thermal_cooling_device * +devm_thermal_of_cooling_device_register(struct device *dev, + struct device_node *np, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops); #else =20 static inline @@ -211,6 +220,23 @@ static inline void devm_thermal_of_zone_unregister(str= uct device *dev, struct thermal_zone_device *tz) { } + +static inline struct thermal_cooling_device * +thermal_of_cooling_device_register(struct device_node *np, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops) +{ + return ERR_PTR(-ENODEV); +} + +static inline struct thermal_cooling_device * +devm_thermal_of_cooling_device_register(struct device *dev, + struct device_node *np, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops) +{ + return ERR_PTR(-ENODEV); +} #endif =20 int for_each_thermal_trip(struct thermal_zone_device *tz, @@ -252,14 +278,6 @@ void thermal_zone_device_update(struct thermal_zone_de= vice *, =20 struct thermal_cooling_device *thermal_cooling_device_register(const char = *, void *, const struct thermal_cooling_device_ops *); -struct thermal_cooling_device * -thermal_of_cooling_device_register(struct device_node *np, const char *, v= oid *, - const struct thermal_cooling_device_ops *); -struct thermal_cooling_device * -devm_thermal_of_cooling_device_register(struct device *dev, - struct device_node *np, - const char *type, void *devdata, - const struct thermal_cooling_device_ops *ops); void thermal_cooling_device_update(struct thermal_cooling_device *); void thermal_cooling_device_unregister(struct thermal_cooling_device *); struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name= ); @@ -305,18 +323,7 @@ thermal_cooling_device_register(const char *type, void= *devdata, const struct thermal_cooling_device_ops *ops) { return ERR_PTR(-ENODEV); } static inline struct thermal_cooling_device * -thermal_of_cooling_device_register(struct device_node *np, - const char *type, void *devdata, - const struct thermal_cooling_device_ops *ops) -{ return ERR_PTR(-ENODEV); } -static inline struct thermal_cooling_device * -devm_thermal_of_cooling_device_register(struct device *dev, - struct device_node *np, - const char *type, void *devdata, - const struct thermal_cooling_device_ops *ops) -{ - return ERR_PTR(-ENODEV); -} + static inline void thermal_cooling_device_unregister( struct thermal_cooling_device *cdev) { } --=20 2.43.0 From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6CFA38F636 for ; Wed, 22 Apr 2026 17:43:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879804; cv=none; b=nRU51Jzlq2bbrBKED2nuRD7BKngNhCQuPHooq8a/9QSkesVJ+APE+kXlBifgfm5zHvJjJXzCjpo5u5jFvZL16mUpXU4qR3qbNTg8UqZSub5lvUlSJJMsfpcos98Jpq1/ej+tugVW0YzSswx+H9JflncLjgQNARO8fQKRlqWEaMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879804; c=relaxed/simple; bh=+Rhz6zZjd9HYPGnCJeEP5+oKE5R8Tr8IDN6zjN+2ED8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jLxFS/OwFScbbCIXjP+SN0VRWSoaHlXoP3enmg5WyKPxz0fLA4D250TRLlnMibfEUqgFE5eIQW7AEQKfISd6ukpAGIu3fgpxBAMhRpD7Y7+HecYWNI4HGXoy4aHI/pxQl9fUaPykZTn5OjjlqudTZxaXb8hx5kCY3o9m4LjRLho= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=LV6BA9D6; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=RdwEWaOQ; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="LV6BA9D6"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="RdwEWaOQ" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MG3hfX1230225 for ; Wed, 22 Apr 2026 17:43:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=CqcNV2iehbX zaUc/4R568E4Zx3AugzvURR9OMc5Xhd0=; b=LV6BA9D6MtDIIsG/TiHi/HHEMG3 7UPbmB6s/lUzrVVW8Bo2nGkUC3APdBRO/iN6VVj+hdFM8VodJDToNCwGZIKXmkm3 4yqhBCHBurCtV/E65jeR77y5Kq1ROVV5Qibo0tivHIucthMDDbckkcIjQ7mz4LE+ I+hK8OjE8FNxuZTHZ8P63JrnjVj0kkzh0jnBdSwLx/O4U5RZbBTmlhc3NoY99PXm QENVIfoidnDYtivcJCHLleL9/IMylDjXa/43Vh6AirM9n3e/Pju33djW6l+HO+0e pI3eN5gtT8/ZcCFqMc42hte41jND8M3OgQTx/nt0gVSrFPYoBdt0RWb/uew== Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq1h68bru-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:22 +0000 (GMT) Received: by mail-vs1-f72.google.com with SMTP id ada2fe7eead31-610169771d7so6857617137.3 for ; Wed, 22 Apr 2026 10:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879801; x=1777484601; darn=vger.kernel.org; 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=CqcNV2iehbXzaUc/4R568E4Zx3AugzvURR9OMc5Xhd0=; b=RdwEWaOQCLTlxb5TECIMMbfqMh9pEuRvSZR4u/MAh5O/P5rEn9ljMVz0ubvgzjUzZE 7XCzjVW6QC2w2ik6Gzow+x6juRpvoz3AccX59BVuVhlYW0Di8yuwDNW7au6uVGGT4TG2 FxqErog2Atket+Zqkfw6xgDog8xH31hzfYJiOHpJe1yc3fwsxuX5Fyps9cKqJQ6VN/vD zWat9uhzAxF+u6hI48QzUkbEDlH3WMSYZrup9g74ODq+lNnY0e93qbHnJtrHUk3zofPP i9WEfkFoyVd9TUND2uhLzBaR78W8W4fMeTFoddZYy6JdvKBMsRQ2oYCywrDJ/gX4LzjW I/wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879801; x=1777484601; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CqcNV2iehbXzaUc/4R568E4Zx3AugzvURR9OMc5Xhd0=; b=SrLxCYhRmawB7K+d1T4MZoesVXDvciiBPGY8hqABF3Ix7ELjLl0YTplFHUrYA0jTnu PqHVq42TC8aFvA6FjkGzQzQjWIoh7HYY4g2LJQI4twmARXSXtOAJeUz6UMnAuKyWNtsa 83bT6X88VUiKMCcjYKkcB+9mXCPzCk9NCqUlV10eBbuwmAC8qA9QzzeGbWRNqB5g06O6 Q4uOQmlkBZcan2VGhht4MqoFe3eSOB8++8a9YX3uPzKfs5yf1QpJZPRKDyo9QwCMrtw4 j5om7G1l0po5xQYKM0SIxGNZ+gVqwGPf7riBu56bMfoyvSjWqmlUEjfBtfBmpI81y9ZN cuYw== X-Forwarded-Encrypted: i=1; AFNElJ9fboNHBYStKyvsprtNWNUvR7lCxl+rwU44pKD0Oon0fezsV35/RDzysl40Dv6GcVhwEVoIPhXyzqCmB14=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1j794NXZgBHt8KccHROXpkcEn2kMfwFdoLGaoOMk+EzKEBvkd 2AYzQ95K2ZZwCHWbOypm5iB0nw3k90wjrqKqP1VuzdA4MrvEFLj7cAK+DF3VQ7TWxLYcHfJ3QhD HqMnOyyGZEVAqVNBrFr2teClsxQ6tuJFFFRmOxgRobhFtrQwBP/oq6/K+EXTSEheSWJk= X-Gm-Gg: AeBDieu1YxasSrVLji8fFLZV309Cv9fxvFd/oSWV5Lfd9OviOQ/RkIN70MRIoN2DUAv mHJPa7Vic35/dojMQR3DcfqFljU8ZjbZP7E/u7Z6O+rRWo5HOinKK6DY9ldDqlCJ7KBvhiCVbuA pq7InsYZZ/GnNBcBiLpE+xvOxMxFVXMOwZiIZrZCQPKZAONbLiLh3w9WwECoatkUwtPA3qmso9t EJ2tyxPuLmUmwAbZPm8r/Ci4m0ScfevY2z3A2bs4GUtEo4mtrVrP/Me8dBRhHEXKhVHDm22r4Bv 3Zk1gI2BWx4BdG8GJmPMdm2txQhI2BpTHI4c6/jqTm9zNgfuxGWpBimPogsEibCuMPWg+Tv1iff 07q4/PsQe9uLEZ41CTuBlPlN1jLVMc+sPPvFsOnfLhhuGpVbAqKhmo9I+2l9H X-Received: by 2002:a05:6102:109e:b0:61c:5310:e9d3 with SMTP id ada2fe7eead31-61c5310ec4emr4276279137.24.1776879801145; Wed, 22 Apr 2026 10:43:21 -0700 (PDT) X-Received: by 2002:a05:6102:109e:b0:61c:5310:e9d3 with SMTP id ada2fe7eead31-61c5310ec4emr4276254137.24.1776879800699; Wed, 22 Apr 2026 10:43:20 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:19 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v2 03/12] thermal/core: Make thermal_cooling_device_init_complete() non static Date: Wed, 22 Apr 2026 19:42:52 +0200 Message-ID: <20260422174305.2899095-4-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=f4Z4wuyM c=1 sm=1 tr=0 ts=69e908ba cx=c_pps a=DUEm7b3gzWu7BqY5nP7+9g==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=XCaTwWLIzJkqVeeR-uYA:9 a=-aSRE8QhW-JAV6biHavz:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfX4E+0oqO5hExW yA/mOjAFkHANaxlCVYqthviqyYnfXdUDzZU2m5KCRyRQSY2TXQIGmHTzlqUvvY9mKjkrLgvUmGd DMnypVkTSQcEmQagm4llxHm7ba9yzFYbKa3vljRDEC2VxMhvxvccPwdDwmDCZdqUN744sx4wpbC m/YJe5F5PkmUp2Lm3Sl8ymSzNU+sZeW5M3fHPpV1h/DN9yxVg/4v2YNPoOfsSTkZn6DVXkNQ3be f8zL/b8Kmkjj8bgDTAFZPbI6uG4vcu/yaFc0S8HeC+tEC6YUf8b0TqngLrLbw3nP/0jjWIm+wRc y71y72rweZeW52z60J/l/4HvV/w1XONQw/C0pRYYT1cwEP7ORvBX15/smBIdV3pltnIk2PsWRtS JPCNNYRrfPyZ1ek8rV4RjKK+0TrPxkIovzGCs4ESwGD4tgPVmmYRTxQdNyeP5NZuVkQQh5ekcFS 8Q3u4/ujU+HB1JMCIFA== X-Proofpoint-GUID: NefFRyVO8EeQnsa6rDT-9L0SUYbIrxnd X-Proofpoint-ORIG-GUID: NefFRyVO8EeQnsa6rDT-9L0SUYbIrxnd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 bulkscore=0 malwarescore=0 clxscore=1015 spamscore=0 suspectscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" In the process of separating clearly the OF code and the thermal core code, let's split and export the thermal_cooling_device_init_complete() function so it can be used by an implementation inside the thermal OF code. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 12 ++++++++---- drivers/thermal/thermal_core.h | 2 ++ drivers/thermal/thermal_of.c | 12 +++++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 8a70768b46dd..35cf170f3fa1 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1028,7 +1028,7 @@ static void thermal_zone_cdev_bind(struct thermal_zon= e_device *tz, __thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); } =20 -static void thermal_cooling_device_init_complete(struct thermal_cooling_de= vice *cdev) +void thermal_cooling_device_init_complete(struct thermal_cooling_device *c= dev) { struct thermal_zone_device *tz; =20 @@ -1127,8 +1127,6 @@ __thermal_cooling_device_register(struct device_node = *np, if (current_state <=3D cdev->max_state) thermal_debug_cdev_add(cdev, current_state); =20 - thermal_cooling_device_init_complete(cdev); - return cdev; =20 out_cooling_dev: @@ -1159,7 +1157,13 @@ struct thermal_cooling_device * thermal_cooling_device_register(const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { - return __thermal_cooling_device_register(NULL, type, devdata, ops); + struct thermal_cooling_device *cdev; + + cdev =3D __thermal_cooling_device_register(NULL, type, devdata, ops); + if (!IS_ERR(cdev)) + thermal_cooling_device_init_complete(cdev); + + return cdev; } EXPORT_SYMBOL_GPL(thermal_cooling_device_register); =20 diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index bdd59947b24f..6e44bcf37b00 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -269,6 +269,8 @@ void thermal_zone_device_critical_shutdown(struct therm= al_zone_device *tz); void thermal_governor_update_tz(struct thermal_zone_device *tz, enum thermal_notify_event reason); =20 +void thermal_cooling_device_init_complete(struct thermal_cooling_device *c= dev); + struct thermal_cooling_device * __thermal_cooling_device_register(struct device_node *np, const char *type, void *devdata, diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 398157e740fc..c4b67554df44 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -531,7 +531,15 @@ thermal_of_cooling_device_register(struct device_node = *np, const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { - return __thermal_cooling_device_register(np, type, devdata, ops); + struct thermal_cooling_device *cdev; + + cdev =3D __thermal_cooling_device_register(np, type, devdata, ops); + if (IS_ERR(cdev)) + return cdev; + + thermal_cooling_device_init_complete(cdev); + + return cdev; } EXPORT_SYMBOL_GPL(thermal_of_cooling_device_register); =20 @@ -579,6 +587,8 @@ devm_thermal_of_cooling_device_register(struct device *= dev, *ptr =3D tcd; devres_add(dev, ptr); =20 + thermal_cooling_device_init_complete(tcd); + return tcd; } EXPORT_SYMBOL_GPL(devm_thermal_of_cooling_device_register); --=20 2.43.0 From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B0BF391E66 for ; Wed, 22 Apr 2026 17:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879807; cv=none; b=VFPL9GYCynNvcqSh8pIf26y/RgzwiM92/iFOJvhk9wz6U7HyzOOKKoCzsN9T8sjKlB9xQ3Rz+t1/hTtU2TkvQB59MlnHQwpDuUmbDERWnfbp9ngrkie3gMiM7rOGm3SRVgwolHJiaqG4WZx2584p8cOYJu26LoSkEZzi4ij7mjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879807; c=relaxed/simple; bh=EuGFtQsC7a5bcq3fuxmHgftjiPsKkyQGyjD8DJn3ogk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GC7qYFZdsyTVVOadq7+i3e5CTbb224PX3muqAn7p7wIi3cAQYbY5o/tmMZHf4kJhV2LT95vcGYB7dFpEFhPgsl7928Y+pNLTrLiQhhO6ZX/yhiEP6LCud1iL0ka/uP/HO/UDoNnfkYZnw6SptMEyBK/W9BUfi3d0mFpqemfL+x4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=jaz9SfvA; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=YRrpfa36; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="jaz9SfvA"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="YRrpfa36" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MG43fJ122915 for ; Wed, 22 Apr 2026 17:43:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=eWAtqSg/Vbx /yWW93k81ni9/DB10T+Cnl86NnNmbO8A=; b=jaz9SfvAgFHjXAUMa5h2VP07eo/ wjX+LnMa3pe+Zz2DoN+uZu3RjSdzZTlEsmwaCXqEKgeNtZ9fSRSrep864Bx794hY b06QkOWp+R+bMr4kEAQ8Kct9hnbcO98iKbFg6kP7a7dItct2dVJ1Rjg6slI3FkcB NlzNnTcPqCOGvHNt5X3Me2ZReiiZOcbtF+iESze994pTyMGmvGU+w2awORnnKLMJ 1ZOIJI0H5EXlptrTFXSPoC9U/N5Zo72vAC/2IqSWeQgxyDL08csAetDDYs7rnLT7 RAO3oIDQ/HQ8C/q57eTE9ljyq6sAaWakqlWbGIyQex1C0CW30JtEOp/g/Rg== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq1h80b5u-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:24 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-50edf0245b0so75098161cf.1 for ; Wed, 22 Apr 2026 10:43:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879804; x=1777484604; darn=vger.kernel.org; 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=eWAtqSg/Vbx/yWW93k81ni9/DB10T+Cnl86NnNmbO8A=; b=YRrpfa36aqrnedjv9or6Cwm2oZu4DuaofWF1dF4W7QjNFjs2+iHJu4vXsk/1U5uemz ybred0p/Ib8DF0cx+omklQe13dDNv0hhRXJqrydtLPGP1gvGXKXpIbivUO3pYw5jUmu7 1pQ+qR7+m+43itfEKYBej7Du3WJclF/livZdtxpNNDlv9dKQeST3P7STJ1f+yGiDYtdJ bo+RboUrMSFae04vpkS3iZyN0WIwaHdZQ5027gWkCTCxaawbJ4VNqZ1a03y/FsE0N4Je Re0ueOGtuBULFd++yu/GJBbI48XmalIMez8/l1Jx/s2t52oZn7s2G+XHacJ4s23JJUfK +/mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879804; x=1777484604; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eWAtqSg/Vbx/yWW93k81ni9/DB10T+Cnl86NnNmbO8A=; b=VtFDTdym/0hVx66GzFFaj/rnP9ohGFK/1cv9WHCnT5LVzegZ3CmfwkPke9lAvqXqv3 0KoC3fx45IBRoY5ZxynP7PDqOG6qlK+IcZv3CtYhbSr3V8z7W4bkmDoUfb12gQpY7Z13 nXNNP0adhg2BuFnYRmK7s0gCHPmBUCaM+f18s5VVRp13LDTG3fgHxR2yD49Ud4sY4dEP nQff3CDV8sBv+iRcJ7FZvhpGVKp5CjootlAs9HKlQNw317eyiUb41Cjt1R/zHhoRphhT CFGtY1EXfSXUJ2+eNO8Gi9sS2S+oXuagy2XdVu8qpAIlgsx4CmMtzaX4H9F/DZtBQT4L 4V3g== X-Forwarded-Encrypted: i=1; AFNElJ9XItsWhOXulr7JIq01Uz11qzwbVMXyu4t5EK8ZerzpRZzEYyhB2HZ8OX2i2i/cr89v78Dm+7hqpMCCk3w=@vger.kernel.org X-Gm-Message-State: AOJu0YzbidXyckuX5OkbtOyhNYvKC3OfQPhJP/Ecrvl9kwdY2zoXDz1a ufzYo7WGyAP9WWw8UnCmNJLFo8LeHe+W5tJTtfiKJGzsQL3nbFdtRhzpRq8YyESRgJmf/4YzQx6 rmIaMrBkQVBa3x5oPNeydQyfIExK4bvlrK/5k1/HHZC7krNP5y2sLd36APdDXAEDX15Y= X-Gm-Gg: AeBDieuZk9FE37H/1KODgIesl0IxSB9qu2nY+T71dzaHaCXk56LuPadZ2Ugo0TlPWYo 697ZfDV9uD1dsUYrs5ZyZtFS73e2pv6OgHplg3eMDIizctD5/Vu/w7pTor1Mkjpf4VJzQf6p+eN oPJ9Bjh3gFKN5OiExedfEcn3E6pr9HgJTFXwEMgDUyxDySO3JBcihpqAhNeBJnnrf2hgfx4nWyY OsJf3+CIRuI1kmSJdPw84mRKZDuQtoqrwCLYb2S8jiPtx5wy5rWbfOFRl85bysG0BOy0YUgHxdm o2MeKEdFO/3Mv0TSCX3coGovGHsl3wmeZYvN/SWq5nPRe48TBgK7Zwvn5g4aW3yY1L7okX4K7cb 7okYvIuTHVQwl70Xz3l4CtVetf8Y5mDH85tUCQb7UkfvnrgwdCUGuYDfsnWFP X-Received: by 2002:a05:622a:7103:b0:50e:5eba:caec with SMTP id d75a77b69052e-50e5ebad365mr136708301cf.54.1776879803783; Wed, 22 Apr 2026 10:43:23 -0700 (PDT) X-Received: by 2002:a05:622a:7103:b0:50e:5eba:caec with SMTP id d75a77b69052e-50e5ebad365mr136707811cf.54.1776879803278; Wed, 22 Apr 2026 10:43:23 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:22 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v2 04/12] thermal/core: Remove node pointer parameter when registering a tz Date: Wed, 22 Apr 2026 19:42:53 +0200 Message-ID: <20260422174305.2899095-5-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfXzj5zUIvG1Kdq Yqmht/1NHpszcrwXTj1WhTd/VcPmDj+mBCeIs/ALKyrPNkDQVASzGyj+gx6TWyNNm6y/KdQbFyB +crp+4yIlH0n/Z2fHiLKm+7aBMoSF6tkoYMz1VKoOr0WTFEkjMyx+9awF6IgdGMf5gOjugi65Jh cH8oEmzL6O7hrxKrld3RlsxgnBxY04ddenZ+GhNUC12/9fVrHcnbDEPTr0GP2n8YzOZ6HqEAixb 3gPW/ni8lWwSoH83g4nJGRzI595o0Vci/8XheCqJlvsiwbUGYbzEd6R8PPGsORe/8Q0H6LTG244 qzIR00KfUamv10fy69wAZoYpETxzftg5znI8KzBFpZw0oxBZLRwBRJ+wd8x3s9XiqrPXQYT+jrd NVE4l45ETgrdeYR9unkbttDQVF3P8Dh1Bu2iLwrSuNEWhK7p1ceLbEXi/DWcpKbnmNVD58hyY1K xeqsADEz8QkzrHrMcSg== X-Proofpoint-GUID: 26_iAw2iYh-dyXOwFhDKknzy4_91nmoi X-Authority-Analysis: v=2.4 cv=RaKgzVtv c=1 sm=1 tr=0 ts=69e908bc cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=1QA-LxGU_wHIdTGdApUA:9 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-ORIG-GUID: 26_iAw2iYh-dyXOwFhDKknzy4_91nmoi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 priorityscore=1501 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" Now we have a OF version for all functions registering a thermal zone or a cooling device. Let's remove the device_node pointer parameter in the core function which is inconsistent with non-OF code. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 52 ++++++++++++++++++++++++++++++---- drivers/thermal/thermal_core.h | 3 +- drivers/thermal/thermal_of.c | 2 +- include/linux/thermal.h | 11 +++++++ 4 files changed, 59 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 35cf170f3fa1..113719466dc2 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1042,7 +1042,6 @@ void thermal_cooling_device_init_complete(struct ther= mal_cooling_device *cdev) =20 /** * __thermal_cooling_device_register() - register a new thermal cooling de= vice - * @np: a pointer to a device tree node. * @type: the thermal cooling device type. * @devdata: device private data. * @ops: standard thermal cooling devices callbacks. @@ -1050,15 +1049,12 @@ void thermal_cooling_device_init_complete(struct th= ermal_cooling_device *cdev) * This interface function adds a new thermal cooling device (fan/processo= r/...) * to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind = itself * to all the thermal zone devices registered at the same time. - * It also gives the opportunity to link the cooling device to a device tr= ee - * node, so that it can be bound to a thermal zone created out of device t= ree. * * Return: a pointer to the created struct thermal_cooling_device or an * ERR_PTR. Caller must check return value with IS_ERR*() helpers. */ struct thermal_cooling_device * -__thermal_cooling_device_register(struct device_node *np, - const char *type, void *devdata, +__thermal_cooling_device_register(const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { struct thermal_cooling_device *cdev; @@ -1159,7 +1155,7 @@ thermal_cooling_device_register(const char *type, voi= d *devdata, { struct thermal_cooling_device *cdev; =20 - cdev =3D __thermal_cooling_device_register(NULL, type, devdata, ops); + cdev =3D __thermal_cooling_device_register(type, devdata, ops); if (!IS_ERR(cdev)) thermal_cooling_device_init_complete(cdev); =20 @@ -1167,6 +1163,50 @@ thermal_cooling_device_register(const char *type, vo= id *devdata, } EXPORT_SYMBOL_GPL(thermal_cooling_device_register); =20 +static void thermal_cooling_device_release(struct device *dev, void *res) +{ + thermal_cooling_device_unregister(*(struct thermal_cooling_device **)res); +} + +/** + * devm_thermal_cooling_device_register() - register a thermal cooling dev= ice + * @dev: a valid struct device pointer of a sensor device. + * @type: the thermal cooling device type. + * @devdata: device private data. + * @ops: standard thermal cooling devices callbacks. + * + * This function will register a cooling device with device tree node refe= rence. + * This interface function adds a new thermal cooling device (fan/processo= r/...) + * to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind = itself + * to all the thermal zone devices registered at the same time. + * + * Return: a pointer to the created struct thermal_cooling_device or an + * ERR_PTR. Caller must check return value with IS_ERR*() helpers. + */ +struct thermal_cooling_device * +devm_thermal_cooling_device_register(struct device *dev, const char *type, + void *devdata, const struct thermal_cooling_device_ops *ops) +{ + struct thermal_cooling_device **ptr, *tcd; + + ptr =3D devres_alloc(thermal_cooling_device_release, sizeof(*ptr), + GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + tcd =3D thermal_cooling_device_register(type, devdata, ops); + if (IS_ERR(tcd)) { + devres_free(ptr); + return tcd; + } + + *ptr =3D tcd; + devres_add(dev, ptr); + + return tcd; +} +EXPORT_SYMBOL_GPL(devm_thermal_cooling_device_register); + static bool thermal_cooling_device_present(struct thermal_cooling_device *= cdev) { struct thermal_cooling_device *pos =3D NULL; diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 6e44bcf37b00..d45455bb9e9e 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -272,8 +272,7 @@ void thermal_governor_update_tz(struct thermal_zone_dev= ice *tz, void thermal_cooling_device_init_complete(struct thermal_cooling_device *c= dev); =20 struct thermal_cooling_device * -__thermal_cooling_device_register(struct device_node *np, - const char *type, void *devdata, +__thermal_cooling_device_register(const char *type, void *devdata, const struct thermal_cooling_device_ops *ops); =20 /* Helpers */ diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index c4b67554df44..3ba8c970f11f 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -533,7 +533,7 @@ thermal_of_cooling_device_register(struct device_node *= np, { struct thermal_cooling_device *cdev; =20 - cdev =3D __thermal_cooling_device_register(np, type, devdata, ops); + cdev =3D __thermal_cooling_device_register(type, devdata, ops); if (IS_ERR(cdev)) return cdev; =20 diff --git a/include/linux/thermal.h b/include/linux/thermal.h index d9ad860cee87..ba2c8b4dda87 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -278,6 +278,11 @@ void thermal_zone_device_update(struct thermal_zone_de= vice *, =20 struct thermal_cooling_device *thermal_cooling_device_register(const char = *, void *, const struct thermal_cooling_device_ops *); + +struct thermal_cooling_device * +devm_thermal_cooling_device_register(struct device *dev, const char *type, + void *devdata, const struct thermal_cooling_device_ops *ops); + void thermal_cooling_device_update(struct thermal_cooling_device *); void thermal_cooling_device_unregister(struct thermal_cooling_device *); struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name= ); @@ -322,7 +327,13 @@ static inline struct thermal_cooling_device * thermal_cooling_device_register(const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { return ERR_PTR(-ENODEV); } + static inline struct thermal_cooling_device * +devm_thermal_cooling_device_register(struct device *dev, const char *type, + void *devdata, const struct thermal_cooling_device_ops *ops) +{ + return ERR_PTR(-ENODEV); +} =20 static inline void thermal_cooling_device_unregister( struct thermal_cooling_device *cdev) --=20 2.43.0 From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A79E6392C4B for ; Wed, 22 Apr 2026 17:43:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879810; cv=none; b=sXmo5J7rE31HcRYyCRZLa8zx1xxE+RoeWk+dBNkYPZPqA47wrq1FgqLh/Yv+K3Kwy7Li9KmXCJzyW6jIQzpeMZQ7QvES2Hn/A4LPRjYMVwU4gvYhLpYFA3GqJdVSF8K8w5/IyC4qzMzeWK0jmOPYS/WlfegVJdtVZgoWjuKKWv4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879810; c=relaxed/simple; bh=Vv1+AfS/7xSCRW0EJqJ5tYsZh8DIv4JK6RBnX9pSCCg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BcDV66bVk91cgiMrBZnHZDBR4SndKPyu71s+I+gm6Izfzv1lFN5E0sPdNSM+zzjP5OEUoPfuKFI4XTQNJPVYciB02tkU6UGJevdVkoQRJWqWVpcRCh2BbxNjJoIV9yNCW8cZp4NnvM1f42Ki2gZQrCb38esR/nbUtIE1ryCtQfA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=a/lV+Hc3; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=TT1dL1xK; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="a/lV+Hc3"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="TT1dL1xK" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MG45iB122928 for ; Wed, 22 Apr 2026 17:43:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=1e9sKez2pO0 WFR+E8EFHfxXVc5ZRx16s8xW16cRALIA=; b=a/lV+Hc36PlJEjollEl9LeLSOu3 E3AAquoUjD/NK2wf22KTqvJIfMMHlLOoJyo8sw5ROTUWuI8fnT+GpXCGBWjr5HIf PnnojjXgw8Ggp/EM7HZmXQQSZ4qj+5wP+lBLwPMtVmSFaDl85h/58xwtHdN6tMEM k1GQrME5JWSTkWbCyKOiCZ8bE+VXlHvZJK/CqkM8u7RiUHiCkg8WpKtiPMYsfra8 74H101TNVQBx6lg9gpSTHS4V8nkoEKZdQ04yRND1s9f0Wxc51TZi6RkPzVPodE+W FUG1eUK1ROvjHWXwERabf/tpDwWIgrogpni4z3dpPBsFz6lVZTAKZ2JvTfw== Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq1h80b65-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:28 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-50e2592ea3bso63123541cf.2 for ; Wed, 22 Apr 2026 10:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879807; x=1777484607; darn=vger.kernel.org; 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=1e9sKez2pO0WFR+E8EFHfxXVc5ZRx16s8xW16cRALIA=; b=TT1dL1xKw6OAYXKwy+IYei5YJRmI7jPnrKXLszbvBGFyVYmKmzly69pBjz0+MXTFOr FymYB9r/TbkQpDT1iZ2WpZPWPbxqtmnk0PgsUARK2kczWu20k2O0SefEQAiakRUFieq1 H+uj36pt070XDwlpVbuFSoe0DLEPL2C0qyhJZGNBKkZ3x7ODhidlsU2bkfmZT6RiSOtY xxuXCzkFWy7mbBlDv0qbEi3YelVGKgf2recygQSKMkHw0CI8+J5PYYETyjEIFSGV+gLG z8SjBagdcH9JSzV1HzpzUDSmauxgAoxHthPCBtOov0rNkTRwtv8ziVzRMglcB7/SqPvi DxOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879807; x=1777484607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1e9sKez2pO0WFR+E8EFHfxXVc5ZRx16s8xW16cRALIA=; b=heBz+z/mVSZEOLIDyRfC9x8PrYQRUZOe18hYwu+uICzMnEe3b0Nm+dfcQCRrXwU/VQ O5DrsZ31atvx5U4spre3kuus5C0w+3WOT1plS8DGKfCFpvBd935CYvpmatp/pqIfvwMB Q7lm+UFXJBo9Yjikxa1cFzhJxL2Ocf1JOQUUe/LSMRszKbbx4jsrrv1d1DTHpLlFB3LY SD26rYF5IUwPN3+n/nrbz7cHNoxprvd9gc9vqVy4MgGDpZYdBMGCqBPSvJSPK4eXFr55 eSvhV00s7YMrrceHme+bNpGTtWcsTEETasMtDZpjXEe8F/a21P+WA8g5ON72/oJaZdQm ri5Q== X-Forwarded-Encrypted: i=1; AFNElJ+BnEJj8Eu4qZj6ENa8CYA4ARqil5vbaxkNoTkwsIlkm4ooQkpn8xq/nnT5tmNqS5WFSYACwGmcPDk5024=@vger.kernel.org X-Gm-Message-State: AOJu0YwuJ9xzwlo4TPy2MXgRElPv3cZQ8lfAwK/V6/nUFDlHgIxLTrNg EIvGLdfGwkrRZT4a5G57MYqMWN5MS3xhrMZFtsQv50hoS0saF8mo0DZa5GuH4jsCzmztZeOHvBw WBgo6NqqFU32DVW60L0QidE0os3EkpcNBGQPTHAlTpZi5xOV8nTrmDjNtPsnDONSoJ5I= X-Gm-Gg: AeBDietLV/yL2CpC6ADeKoVaSf4x/xF2zB7DwvZNXyiSttNssrrzcK1THR88G2u0nOX +GvAC97hZ2qLjIWDK/e34oiuyXlqtPoXANBsAYxZPp/lcMAP49N6RDGluhKkaGF6h9BmH3u2RK2 qkdD+IR87qaIeHEdddiGTx6AutXfiWdJr6vDSyzCkwwKNnjzHqDjSqhhqEownspMV3aN5fZX4mr O0p07ibssEfjrCd9sPnNP8Wc7S6Jw0+c8Maef8i0iJ/0vD2Rx90L0zlx+pfJfMnje4A8f4E3UUg S9QFm8hjws1Cx1me1H/xGDMqWjcwbUZOHcEowVP/zpl/+XF3UhKSjhzlOkwECI6V5K5Pz6PYw4k Ir393Vp1O/EJgVALArcmV2J1MfoQUuBsk/1Pmw1LKo3w59vzkDqU1kPVpNEC4 X-Received: by 2002:a05:622a:1e89:b0:50b:1e5d:992b with SMTP id d75a77b69052e-50e36c74de4mr337070371cf.54.1776879806962; Wed, 22 Apr 2026 10:43:26 -0700 (PDT) X-Received: by 2002:a05:622a:1e89:b0:50b:1e5d:992b with SMTP id d75a77b69052e-50e36c74de4mr337069651cf.54.1776879806451; Wed, 22 Apr 2026 10:43:26 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:24 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v2 05/12] thermal/of: Move the node pointer assignation in the OF code file Date: Wed, 22 Apr 2026 19:42:54 +0200 Message-ID: <20260422174305.2899095-6-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfXyIkIh+Kk6zmi bB/m1JTqOVL07MorxjCgXGOsleAbt0gft+/oeM3Ch6dQzez8rHuwtytS97AsBBPvazyEnQ4r9D2 tlXp4gbd0nYdaB+fmr5XtHGJihYbBeth2yA21IrIwvqmySkHXkuiOPolS6UJoUHLxCNkz4KXgV3 lMB8foqiZm+LhY9irxSJbZGSRYTJ51qRuAPJXwTFLTwdYr2SUKb3PoFsyjpAn/SNl1u+XLdGuQa fCJ6Tz/rKmAbObhsWeEHp9owQ2cPOQOvX9fWBO9dlJRuA/FArpTHX0oKkX1xxpQ7DZB2Sr2xEU/ pplwGQ07FgJc7anCiyuUJ1GRhYJxZMA7GZ8o8W9u995o0uPSlKTnqNteyPGvkL93KF3vE+JH26s Cd8K+faTGcoJI49IyhGl43+QDLJeZ0DfY/swF0sFQMDVjIMKS1zHj/O6A2Q4Eb+yp0kSQbwSToL X9D/BOvON03Sv2ICgVg== X-Proofpoint-GUID: FrmJS4ezOeR_ct4s3qzRlvqQD7N6IODa X-Authority-Analysis: v=2.4 cv=RaKgzVtv c=1 sm=1 tr=0 ts=69e908c0 cx=c_pps a=EVbN6Ke/fEF3bsl7X48z0g==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=DEwMSQuYoAZka129e_kA:9 a=a_PwQJl-kcHnX1M80qC6:22 X-Proofpoint-ORIG-GUID: FrmJS4ezOeR_ct4s3qzRlvqQD7N6IODa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 priorityscore=1501 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" The node pointer being assigned to the cooling device structure is an action done by the thermal OF only and does not belong to the core framework code. Move the node pointer assignation in the thermal OF code. Consequently, the devm_thermal_of_cooling_device_register() can call its non-devm version resulting in a more intuitive design of the API. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 1 - drivers/thermal/thermal_of.c | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 113719466dc2..9c4081d58972 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1085,7 +1085,6 @@ __thermal_cooling_device_register(const char *type, v= oid *devdata, =20 mutex_init(&cdev->lock); INIT_LIST_HEAD(&cdev->thermal_instances); - cdev->np =3D np; cdev->ops =3D ops; cdev->updated =3D false; cdev->device.class =3D &thermal_class; diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 3ba8c970f11f..ee9776d0e5be 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -537,6 +537,7 @@ thermal_of_cooling_device_register(struct device_node *= np, if (IS_ERR(cdev)) return cdev; =20 + cdev->np =3D np; thermal_cooling_device_init_complete(cdev); =20 return cdev; @@ -578,7 +579,7 @@ devm_thermal_of_cooling_device_register(struct device *= dev, if (!ptr) return ERR_PTR(-ENOMEM); =20 - tcd =3D __thermal_cooling_device_register(np, type, devdata, ops); + tcd =3D thermal_of_cooling_device_register(np, type, devdata, ops); if (IS_ERR(tcd)) { devres_free(ptr); return tcd; --=20 2.43.0 From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DB873815C5 for ; Wed, 22 Apr 2026 17:43:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879812; cv=none; b=AnyPLFRU5lW5iKZe92OgdZXMUh3aMPchGT//sAYoBsDIYwuX2QpWW2ErEqXa1P3fnDkDRvOTkZFOHv8w9P5Psjger+Fs9C09s34OEBxzoLqz8k/ky9X4IMwIbFi0/vG/R8L9i4gigAFC3azPybegcKE/DFSPEFG62L72kskmjxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879812; c=relaxed/simple; bh=j+dZZjvhX3/uWmfqgcfNW8B38xnfwi9TQ/BZm/YnRHQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r0SOurNMcpsxolHGFgN1br/hcjiT+2jeDIt2UtJkNcef32GGu8nQsQxn6fW9KtRLq6nwNbE4n/NLkrZnsS9ANJjr3lqZEvMGLbZrquSuJ+ouINLCl49r6wWFyRCGDxRBCm+b3CwJ16dwXOOpDtv5qwTmiiun9KvIzxK0EOpv704= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=bpw9HLF5; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=MI36/NnD; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="bpw9HLF5"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="MI36/NnD" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MGqWE51218367 for ; Wed, 22 Apr 2026 17:43:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=QzXG7s0ro7q CMWOD8nEVlnf4H7DSkLvufeY3TSsikco=; b=bpw9HLF5c+cnx3KqIgepiGc/Ugt RYsO3AcAmr/xeHdHvtpjc3pcq7KpuxDWzXxaSaL/VQCcSwYcwq5DVDEMvAD9P2Nl LRqEWfQo/t77fqiZjGHYLfRdKlN549wg8O/czZwhug0olhqGzwHiu7yG2gDxDWrh SC6oLDft6gxf0UXyHKzIeaMarZvawjxPKxvwZ4f+wHrOLuN+GA2FWcifOocl0Bvz /tHrISfLO2NY9dttgMzIkREus6/n19E8FZy357AUS5ZEEStPOir1xhT/TSrm3Jrm sAs70KMrTp/F0TjX/VYlbj10rIZ+3LlX6xbJRDehT0j2vYEu2zsupEtbJEg== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq282r5st-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:30 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-50fbc70cfbdso43681661cf.2 for ; Wed, 22 Apr 2026 10:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879809; x=1777484609; darn=vger.kernel.org; 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=QzXG7s0ro7qCMWOD8nEVlnf4H7DSkLvufeY3TSsikco=; b=MI36/NnDjM+Of2G2VYVxsSLcRdvAumaMUh3okIZBczf87x7dZUdOTYKyU/+wNxXMYx oPSiTckQKY2LQaYHIv/SsZhccsiV+fuM+YwF7qavC3F99hluLp2WHAv/mxgAYU4WZWfg 3sa3eF51O9z0N/fV8YlER31ZAQmSRnjmxDHgcpSVajHItr/pBhWUZUKYEAnkVvSA8D8M 6dMXF0hHAn3vxAgwNuJNqmKM2lO1yykDmYf2uuWgmkRtiZo3JAdCqv8e04NYUQ3HKnS0 8NXZxNZVKX+AcTQzMkVlqhfK2f75BVYMrUnI6IW7S+Uc0TQMsZybsSnx/+ZxNkPrSZcS NAfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879809; x=1777484609; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QzXG7s0ro7qCMWOD8nEVlnf4H7DSkLvufeY3TSsikco=; b=DIifBatTr7MdCHUvN9161HlIYqUjfyLftgNljB48SXFFo9IpfFiZYGb6enRoRaxBrY MMRFs/mnRSsjE02jytSCew/QK6em292dcc+elMTN5q5da6SIchKudWDPz4bPdGswgzQj GpRUD4pooBCkXlWnC23fyAIhFqmfjLWjqWgA6mPCtUdBTt8cr2r7Lv75bRsV5AhsjuxU X/12jtVO+xZzY8YCnIEbbT7JXdHTPjHLDpfXGNp2vxKiE3zEeRpTtsviS8HWZSDprBTC f6CmbCl+bmqbvuV4Y6y1hwmkFihuGbxyO3dAPsnIvTeZqlY+kY7yfaQbqFt4prXSgDTd DjFA== X-Forwarded-Encrypted: i=1; AFNElJ8Y4chY5qZB2QhNh39vVu9A+NPfdsTv6+aUtOujDkr335jElreAQFXGcbkt/CHErpdQH7LibCi+AiPT20U=@vger.kernel.org X-Gm-Message-State: AOJu0Yyofa/6B+NjN670zW+NLpQi6WK2ttKd+MHFcVQC06TNZoEJJdg9 5XWxnXLGqiX3S4wmuMXKhL7TsCHgAt7lf8lnoAjMQVWV0Qhppiv4XRfqp/U0xuysZ6CLaAxn5+t IweKEXPWu0NPwyrFikdiwgit2r1pvJBwUh1i5gD3qX71SI9zzGGf48m0gGUslaPBxRTI= X-Gm-Gg: AeBDieu0hIS3c5Qsx+gqWlpQBs6pvN86EZ9706r4LJLeXM4FG9rrLe+wwFY8+aBMMrW +Yp/yIZpsi1PP/VdBUq9ZE1/F0EvyXugDhl47rjX6hsTwfZS8DaLiB6/nsyYSeU6kwF68X6ts2m jXr68iaD69U8Bi0/FkfxZ1yTaorJ0Tp95eT8ar32V+vs3VVFvdjJlJ89BMWvJ0a/VxE/FLQKMM3 tIGuQ9tktBasFFQHNIWPfLGlH3C55V9PkdX16DhJFqKL+TBNpU74utSXBwM1dxmGA64sAm2CXBW 8+N90+d1P1DorrmRGVgwGm4AMKAy0paSxGLpMS/5oEYv8RKPVgmD73m96ltgjn2U/rOpfgxwsku y998Ca3yI5bHmHA1cEZRwr4d91/FpoYBTbsfvkV3BKAwh1D0M5etnUc/K2Vh1 X-Received: by 2002:a05:622a:5808:b0:50f:c26d:f309 with SMTP id d75a77b69052e-50fc26e288dmr48528711cf.9.1776879809482; Wed, 22 Apr 2026 10:43:29 -0700 (PDT) X-Received: by 2002:a05:622a:5808:b0:50f:c26d:f309 with SMTP id d75a77b69052e-50fc26e288dmr48527861cf.9.1776879808984; Wed, 22 Apr 2026 10:43:28 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:27 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, chrome-platform@lists.linux.dev (open list:CHROMEOS EC HARDWARE MONITORING) Subject: [PATCH v2 06/12] hwmon:: Use non-OF thermal cooling device register function Date: Wed, 22 Apr 2026 19:42:55 +0200 Message-ID: <20260422174305.2899095-7-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfXxaH2G+Zxe+MX OUBk0jHW4ivwaA5mEtiQf7g43vgHJlNqTneB48B33v7LrtBt4wZalqR9FMENrPtK7mZ40TfONZ9 dFrCm7GsDBJslgAhWfYkx2lmk++hSaGdtTVnE3rAvVfiUGj/spnJTRbw109IwLZmAdxUtoCBtux 2yfWM1tI8n8I7fhNvdnZb6f5/Ib5duOcp3FVOl89/wxvkJplUnRjpkkAyZf897IeuxIkp+FSIAp +BLwWnUXHGOIJUOoWtCPpcVY+8y5McIUUTgbGfKRmA5EGeqdHJjjVVR1h+iITzu47yZnKSW0BxO hr7eKNtEGinwtNFirmQ6HPE3ArgJ7XNskR5TCTvYrUw8T37BzWvfIl/vF3Flc2uuUnK21F59zSw XN4tvJIdHfPyCUQOdNj8WDzKJkag4hSDKuXYts0N0onPLjcTTXX6PQ6awb/KvRvuI8uab1FpiHM it2IpblJ9L4bJL7zIxw== X-Authority-Analysis: v=2.4 cv=Zond7d7G c=1 sm=1 tr=0 ts=69e908c2 cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=_jlGtV7tAAAA:8 a=ggIEzLyBpZPC2L1Vao8A:9 a=kacYvNCVWA4VmyqE58fU:22 a=nlm17XC03S6CtCLSeiRr:22 X-Proofpoint-GUID: bPXiamO4ITndGOUD-_ADt5OkmkgOXq8X X-Proofpoint-ORIG-GUID: bPXiamO4ITndGOUD-_ADt5OkmkgOXq8X X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 suspectscore=0 clxscore=1015 impostorscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" Make HWMON drivers which are not based on device tree to use the corresponding non-OF functions. Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck --- drivers/hwmon/cros_ec_hwmon.c | 4 ++-- drivers/hwmon/dell-smm-hwmon.c | 4 ++-- drivers/hwmon/mlxreg-fan.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/hwmon/cros_ec_hwmon.c b/drivers/hwmon/cros_ec_hwmon.c index 6cf5ab0f4b73..77dd9f28962d 100644 --- a/drivers/hwmon/cros_ec_hwmon.c +++ b/drivers/hwmon/cros_ec_hwmon.c @@ -532,8 +532,8 @@ static void cros_ec_hwmon_register_fan_cooling_devices(= struct device *dev, =20 cpriv->hwmon_priv =3D priv; cpriv->index =3D i; - cdev =3D devm_thermal_of_cooling_device_register(dev, NULL, type, cpriv, - &cros_ec_thermal_cooling_ops); + cdev =3D devm_thermal_cooling_device_register(dev, type, cpriv, + &cros_ec_thermal_cooling_ops); if (IS_ERR(cdev)) { dev_warn(dev, "failed to register fan %zu as a cooling device: %pe\n", = i, cdev); diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 038edffc1ac7..47b373ea6db4 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -1161,8 +1161,8 @@ static int dell_smm_init_cdev(struct device *dev, u8 = fan_num) if (cdata) { cdata->fan_num =3D fan_num; cdata->data =3D data; - cdev =3D devm_thermal_of_cooling_device_register(dev, NULL, name, cdata, - &dell_smm_cooling_ops); + cdev =3D devm_thermal_cooling_device_register(dev, name, cdata, + &dell_smm_cooling_ops); if (IS_ERR(cdev)) { devm_kfree(dev, cdata); ret =3D PTR_ERR(cdev); diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c index 137a90dd2075..860de6cfd8a4 100644 --- a/drivers/hwmon/mlxreg-fan.c +++ b/drivers/hwmon/mlxreg-fan.c @@ -583,8 +583,8 @@ static int mlxreg_fan_cooling_config(struct device *dev= , struct mlxreg_fan *fan) pwm->fan =3D fan; /* Set minimal PWM speed. */ pwm->last_hwmon_state =3D MLXREG_FAN_PWM_DUTY2STATE(MLXREG_FAN_MIN_DUTY); - pwm->cdev =3D devm_thermal_of_cooling_device_register(dev, NULL, mlxreg_= fan_name[i], - pwm, &mlxreg_fan_cooling_ops); + pwm->cdev =3D devm_thermal_cooling_device_register(dev, mlxreg_fan_name[= i], + pwm, &mlxreg_fan_cooling_ops); if (IS_ERR(pwm->cdev)) { dev_err(dev, "Failed to register cooling device\n"); return PTR_ERR(pwm->cdev); --=20 2.43.0 From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9CA9390CAE for ; Wed, 22 Apr 2026 17:43:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879815; cv=none; b=rdNhi+83vToXL7TjTsgRNJAFdlKpG9hcjH3oBE8GMDz9SOjH9Ui9vvZW5gCt3OzyuObIMnhPQ6oqK3rnFR+aqlWCfbMMKemuJPHhnmvQWMtaUwHZvvjCYCB9RqheONMcguQg11vJHnvDR9yJFXP8zgsPFS5q6p1Zh8PixP8T66g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879815; c=relaxed/simple; bh=2qBk2ep3/UzHtxWczG5M1hr5BLVx8K3kTzC+hO/UzIk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y5neH2yP5hb3XwePoLtlOXBWu5vIknrnhx9i5ydOEEkp542i2JQlGys+qLWxvHz8NQFJoR07plj9t3Cp46yE+HC/yPUE9QFtIOaMhbEn0eI3zieLlPWbm0JDwcnGnKQE1hMhkpoR9qFVaMBsIhNA09RdxRO4v37MLZ+8ElRqeXM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=gFqx4ZK0; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=TGFcBDqu; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="gFqx4ZK0"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="TGFcBDqu" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MGqdBG1218562 for ; Wed, 22 Apr 2026 17:43:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=ocRAnxbNzf3 8+DhYm3zLq1MLbyIrBdT46oxuz56xG+Y=; b=gFqx4ZK0zE1RJrNUwZAMZ+jYkMO I+eHmCgc1Ge3ZtrY61jSIPrKvc1wPf1rJ8PolgANmNqSTsr0gjAweQcTIM5UqW1A vD4b7puo3+aKHlxxQCmDuIovGCzpQF8IPO3TLQjlJUKaHRBF3DX8oILp2U+PaP9P NTm1la4rZUKQtye1q46tBflAgLypPFklEPavbxXCSEPibG8U/dIqE5CQCuFh8+7w bSa+hDDTc8En7EUuZn9Gab2seV0zM9cxjSVoOTrH332klUr6te3spmX+Lj8ItqKI 05zEWlLNd8UsGzObiO9GwJlhXF2mkbULB7UYMZ3U0mHBNozmnvh9XU3ka9A== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq282r5t6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:32 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-50e5a336b44so41073141cf.0 for ; Wed, 22 Apr 2026 10:43:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879812; x=1777484612; darn=vger.kernel.org; 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=ocRAnxbNzf38+DhYm3zLq1MLbyIrBdT46oxuz56xG+Y=; b=TGFcBDquDBbAB4zvue8vKQJ46ydXlbMC/Y+UR8aNX/7N1TdjVk+q2MOIgiQ2aWKfOy zCb3/bCCHzH76wOAdXngmkPWP87CmOj+mj6AiM1mmEXPrVa1k7pD7tDyP2TaZJKtdSGv vfVs7HWWQZDzwci4P8s1RrQqRJnBfQBxTFWn+lLJudmmwyyr7KgYiu8HVJt4P+dOZeJP r3sMaOAFzD6s9wMTLwqmBTOS40nXup7M/6j7sOcOlp4oMor29m1mqg4pZNAEZmUk28Tp /NWeSWK4cY2/qDKkK9UHODRC5m6ESuGML7n6xnpXtF5lLEYurAENFJeVoUeBMgh7rStU Nucg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879812; x=1777484612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ocRAnxbNzf38+DhYm3zLq1MLbyIrBdT46oxuz56xG+Y=; b=lfAxrJgAlF64ZVzICHpDkgVhOWU5fBLKho82Zzyzt+re4G5eWwvMHsHgXJfbGvQsSl o8cLbOpuM20LzLEuoe7BS9LByHM6/Ll+zCqUhZfucvhsT2OEdyR97KuLwMHFfGCmbm/V OkrknURbzU0k3blJk/2MY4iLb5+4ewxYzNGbiUKzg0vUe9ZcO3HfWSefjK7brzgyaCC+ 98kmjLwWZ3s7XkieKobHiWwc47kM7okDDZ6zCc0wqSymPv1yjITPIuMeCoSUfGlosLei BoGQ3VZ5Uey7B0cAw7hyOFPQ9BapXim6Mkt0QvHmd6X7o9INkx9obB9RbJhohBK2issV AvNA== X-Forwarded-Encrypted: i=1; AFNElJ/Hug/Rq6sZ5lTlc7ymfCbvOCnHL6pXn3WJMyoTFtcvabmxJUCKSQzIMyeL26e4mOKTq9jgY651Gjyj77s=@vger.kernel.org X-Gm-Message-State: AOJu0YxRvhCK9s+fWdy7M92pG3Nl2zLI8Q5ve4mcprguytRcC12bhXwg LfHzGs9BDrRWyVn27DFw9xjUaTHF6yLs0b+dptI3hfmmLOp3A9xfoenApRqj0yFrAgDroM9MYuO zkqvqU50hsPT8l345kkelXBcTy8FTgxaxRl/STyCY/6lDDhi4UtzQ/z3E8UxEd+1Ebzk= X-Gm-Gg: AeBDieupHrQYEPIqHP9wCQRVUueRLU/0i4seGy2TDkXuORw7nN/hCnpVGDdQLFRqgWL u9NwOT3Phqgb9Fit0tJ0C3lHOId043plOztdKnyBErdwOzwrhkYLCMu/pNGXGEoefC8dKdyBFje htVEc9YA9MJ78zUr6pZ665FJ1LUTbEYhrErVPWaFuMOWqbjuNkB1C8cgUlCgcWAM66I/yUiflWJ hy7Z9CfRJRzXUk25iMBxkZPx5iAqlZIPuciAFMeW61PtvVJFDT5G0rPdouORG2FlHEOs2FB7pkg 66MwCy074ftpNArUeIN2gDPXUPV245pLcJ5S7lCOhbzzunbYB+Fm0Ifc2hFbk6N+piaDLoLSEs0 udXdaKlmp1ZJrAszPmUXRi/t2gqIqctHz82ZKJVJOWcu8ClyLR3/0Xd54php3 X-Received: by 2002:ac8:7f55:0:b0:4ee:1bdb:a547 with SMTP id d75a77b69052e-50e3664bc7cmr315857911cf.14.1776879811908; Wed, 22 Apr 2026 10:43:31 -0700 (PDT) X-Received: by 2002:ac8:7f55:0:b0:4ee:1bdb:a547 with SMTP id d75a77b69052e-50e3664bc7cmr315857311cf.14.1776879811420; Wed, 22 Apr 2026 10:43:31 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:30 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v2 07/12] thermal/core: Put of_node field cooling device structure under Kconfig option Date: Wed, 22 Apr 2026 19:42:56 +0200 Message-ID: <20260422174305.2899095-8-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfX7KvIdFcS6pL4 yMzEOk7YoNrVMySiqyYBLhZjPk7G7MCc15zBJC0zZX1YYuFmLe5uoWApYuUebBizE+RLk750532 9cz903TK4ptGYc1pcohFRsgeB+UyeHZWSjPnSN59yfkIOjLuMShlLed4qgf8vLnG18BmFtWHp2J 5vAt41fwA+TUgIxU/tQEQn49l8kgRCNU9R+QjBFIx9jth2bdarIznQG/zfbnakEvfYkNyHJ5Q6v AU+P3CEer1dXIZwTcC9nQvuZfbOD2z+dh5hr4VmxB/2xgdFz40cCVOaoar3ljcpAt5AmI0VEJEq McZC81JLk7rf8/tPwEG+WjfQyuhPVprVwV+s9wMTocpNuHvJaxbLq2iR05FjDRXJj0CbU+RzeiV uKqo1akPGJvDKbpT5XCGXBnQCio0LUAmr1GDOUy9qS1NWxJw9Tegp/n3y4zaPXwqAwbxGFdZ3FY D9IAPI2DtPmuoJqW3gw== X-Authority-Analysis: v=2.4 cv=Zond7d7G c=1 sm=1 tr=0 ts=69e908c4 cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=5aU8Z_IAf-MFAndoPNkA:9 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-GUID: FsnAzEmjKwv9rmqggCUrjCt_q5x13e2R X-Proofpoint-ORIG-GUID: FsnAzEmjKwv9rmqggCUrjCt_q5x13e2R X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 suspectscore=0 clxscore=1015 impostorscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" The device node pointer in the cooling device structure is only needed by the thermal OF in order to bind a thermal zone with a cooling device. Now only the OF based drivers are using the thermal OF functions and do not call the function with a NULL device_node parameter as before. We can put this field under the CONFIG_THERMAL_OF condition and make it go away if the device tree is not used. Signed-off-by: Daniel Lezcano --- include/linux/thermal.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/thermal.h b/include/linux/thermal.h index ba2c8b4dda87..0a95cfeffa74 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -125,7 +125,6 @@ struct thermal_cooling_device { const char *type; unsigned long max_state; struct device device; - struct device_node *np; void *devdata; void *stats; const struct thermal_cooling_device_ops *ops; @@ -133,6 +132,9 @@ struct thermal_cooling_device { struct mutex lock; /* protect thermal_instances list */ struct list_head thermal_instances; struct list_head node; +#ifdef CONFIG_THERMAL_OF + struct device_node *np; +#endif #ifdef CONFIG_THERMAL_DEBUGFS struct thermal_debugfs *debugfs; #endif --=20 2.43.0 From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BE96396B99 for ; Wed, 22 Apr 2026 17:43:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879820; cv=none; b=AEjRClsRDy/pYxaXMRij1rQQTzb58A8H7QBI9tO+6oUrsyb11B1AdTkYuVq1thInt/mT/pkBPO+sjXYuajzaeLVFYc5QE4nMKEkOZNAFVeAf5ouebSw88RsMSV4wymIzrJq+9l8ZM0nbISMnpJNsnv5twGDFxM39Z9BCkcswIJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879820; c=relaxed/simple; bh=Lv5Xg8BU5v+PbSSXolZEv2wfgJvRzEAFDtwyaMs8Mas=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fOIDF30CdnSoGwA/5UJ74zEAWDfxtsjz+NP7lBxFIUBKMDQO0W2c6ePx3kIh5l2sasrfG9JqGPcTakU8KdbAO2K/8Rl8exoW0pQu/5Z8Pmk6PlKHV378dAnyNFNIZAIHT47Vc+bzzbRisf6PpfyF3v62G8daoWCgLNfKAkq41MQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=WCLqvnQh; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=hfPpp15u; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="WCLqvnQh"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="hfPpp15u" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MG3k5P1230241 for ; Wed, 22 Apr 2026 17:43:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=9NaipcfK+U5 vCs+9GzkqYBawAZE4g4xw2/lsPt8l0yA=; b=WCLqvnQhHRE/A3ymgh9SwvoGTwp 9Rp6TJoWSyOfKbLHy1QF+3nV0knEePgih8rSzbWDN68N9US4k9VYStrVtxrSS7m8 Ir3pi7T30enBmiBOAvFnBHADhT1ptyOkFJjoi5tlpgTewM+CclM7j9isSWOjju9L mPyhlbQh1j8Tql3ButuxulyqjOMVHCmg+SrIMCWkVhvN9esGPFRIuhzqSRqjfbEi AtYOA+T3e+Uved5YIdcdLj0l9wFoiCybauJjT8Je4eI94c2W5GtfM+0ZT02mYrSB 2zcZAn9PhYcCmHz3/vwL6pBJ4e0mkIzzCv7QKi8nwP+5nIF111u3WoTgHNQ== Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq1h68bu7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:37 +0000 (GMT) Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-50fae95c82cso18814311cf.2 for ; Wed, 22 Apr 2026 10:43:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879816; x=1777484616; darn=vger.kernel.org; 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=9NaipcfK+U5vCs+9GzkqYBawAZE4g4xw2/lsPt8l0yA=; b=hfPpp15ufZQbIWB3x46fVqEBqmoJdjxg9n+1ckfu2rXQjQtONf8fNKcBoVOUDv0pBg Pp7zdVlXNAg8tof9v8KT2rME9rBbxTcH4wWqMD14YsTAS4H1Ns64dfZNz3OIxTOqRHkb g3dQ9pXq1n1jZFzg+Ou/JmO2iZWrNExQ2cEkuOmYRR0bwqu1pCPflv0/HFPdd+w6JYl+ z4OM4T3nnCeiaOlza75YYZTNWsaTaRwjIZDJsiCURelqfllMLm3jsHu0u75KygQxe7ax RzjV4hZO7rldvhdv8O9pEqOPnX+AaMUF0G1HZNr1UgSJEkfHfqMns0VaDa8NNlsMLYoE NdMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879816; x=1777484616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=9NaipcfK+U5vCs+9GzkqYBawAZE4g4xw2/lsPt8l0yA=; b=FjS1Acc99RazUd5KoZcveAWVrgsazz3KrxaSmCOrc6tJhucvjigEnJAg/nPfRxzjql axC2hx3oA46/qFqXQNfmC6pQWmH426vRRIC8FjTzLsYaG+dWci84qDIrIMihVWoddo/V NbB7m7cnTBk0F/7587jCECtHMrjLTpep9+vHtcxmB77JO7cWQ2Gn3aOFjOgIbbTc5zJo mpvpoLcSwQ7by0LH/e7M+cP1jG6TTgapCetO8TgWNETbgDbRXql6XmP7+j6L84gfE8/f n/kwglUQPJpwjrQgjRbLsAB44Pb293h+2nO2uJzqzQzngrpxtYXpAT6UdD0+IKUXXgtd oR/Q== X-Forwarded-Encrypted: i=1; AFNElJ+TeAoD/qWodIN8HXnv8k04LFj7kLUbMsqIV8iONiiHoFcRsRbarsxERKdNyGg/Bp/WJ+lAriJVW9DOH/Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5t0tzXdZ1t0Un4P/SmbT7ah3iGZDBZC1ncCWF7VXw1gm+tybC 9YgY1dUM5RBCTde8l2IVXZfSmKxgctLpCrDWwkrTC00zVY5CV+/z9bE5tNFd5lwf73BAmGAFOPm UQ/kedyrM6Tzrev/CxKQBhqtK1iTkdytZoC2xeSb0ohmyGbLjWSb9MjRawizYIGFLphc= X-Gm-Gg: AeBDietx33aUmllAWWL/ST1O4Tl3RWm4/ADRg+MytLpa4QNns7GFsNo0a3a9rewNQQO YZrrJxEphITOFXgqjLdyVH57LuZU/cIACLFGVZpCrody205xwsreKlbdLIqNIxctbSYP/xvvQ9u vrUijQdhKaP6Ryci13iiWxV2lYNI5s6OyR7pOZMx+lwLTF5HQXL4hzlJjAXcCZ46VtvXedb+/+k ZxVejsFnAfdofd8TnP6yYW1q54F0IYteVnN74bn3Zsrjg49RLRNNYynHUK59X7d75jeJtYJ68aH OnQ9cSA5E3/f+8w3Th+i0o77enaERb2FIUobrsIJW6MzwTSpdt5lQaOCUdJxzfqwt/aMA3bsbK7 ISMJ3PzuJNek2b66ShYyURhXGDBy8rclYq/UJH21U96tIcceMxZ3bSYCCrJ5g X-Received: by 2002:ac8:7dc5:0:b0:50e:6054:ba with SMTP id d75a77b69052e-50e60540c69mr173172541cf.9.1776879816042; Wed, 22 Apr 2026 10:43:36 -0700 (PDT) X-Received: by 2002:ac8:7dc5:0:b0:50e:6054:ba with SMTP id d75a77b69052e-50e60540c69mr173171461cf.9.1776879815403; Wed, 22 Apr 2026 10:43:35 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:34 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Krzysztof Kozlowski , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Thomas Gleixner , Ingo Molnar , "Jiri Slaby (SUSE)" , Svyatoslav Ryhel , Mikko Perttunen , linux-arm-kernel@lists.infradead.org (moderated list:ARM/ASPEED MACHINE SUPPORT), linux-aspeed@lists.ozlabs.org (moderated list:ARM/ASPEED MACHINE SUPPORT), openbmc@lists.ozlabs.org (moderated list:ARM/NUVOTON NPCM ARCHITECTURE), linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT), linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM MAILING LIST), linux-amlogic@lists.infradead.org (open list:KHADAS MCU MFD DRIVER), llvm@lists.linux.dev (open list:CLANG/LLVM BUILD SUPPORT) Subject: [PATCH v2 08/12] thermal/of: Rename the devm_thermal_of_cooling_device_register() function Date: Wed, 22 Apr 2026 19:42:57 +0200 Message-ID: <20260422174305.2899095-9-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=f4Z4wuyM c=1 sm=1 tr=0 ts=69e908c9 cx=c_pps a=JbAStetqSzwMeJznSMzCyw==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=YYchOvpREA9nlnY3_CYA:9 a=uxP6HrT_eTzRwkO_Te1X:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfX5dK1V6jhVshv /Gfd/NGIldSAqxq+kZuZck/rwWnmTTurhkYfmWQZjUg2HyRyUjkMZsY6zLN/xCXJ0XXYukqFi09 zDpwafxQGg2TqZo3zngOthffAWE5E6N+Z6NehyVEw4EVw0ncxRzmad7h/kOohYh+fvdgpFeG3R5 1Pqlkj8lIVVA8pq51HkUkM04fCLeur+ga3c+vMXArCzn6A7i7qyiJcB7Jh5Lto2/fcjMObdf8uF T1e/bN5KtzLrg2x1pIe2kK6WR6LP8shy5gRLJJ6H1UR12RRhzFmXv+R9Z7mlPzwcXwdVyOB51Wo JHdOX4fXUgG0y89H0oMpuaweyFgSlHLU8+PpkyupCqCuFInWvErUHxXToOBm2RXprjwoGrZOurQ 5bDkBS5sE9HD84GFm/zfPg7Ci98M2VAuM2mt2wb0J125sGKxJWVmb9MybRN1OEIaciIm3ZmMDHL yAtbGR4JgpnyK/ZMPGQ== X-Proofpoint-GUID: GiP8n3Yg9d07HpliQgUockkfotxARGfo X-Proofpoint-ORIG-GUID: GiP8n3Yg9d07HpliQgUockkfotxARGfo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 bulkscore=0 malwarescore=0 clxscore=1015 spamscore=0 suspectscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" The cooling devices can be composed with a cooling device controller and a set of cooling devices attached to it. Until now, the DT bindings were described using a node for the cooling device controller and child nodes for all the cooling devices. Recently, a new set of cooling devices were proposed with the same bindings. Those were rejected because DT maintainers do not want this format anymore. In place, a cooling device will be created with an id. Whatever its meaning, the thermal OF will bind a thermal zone and a cooling device by checking the device node pointer + the id are matching the cooling map with the cooling device. Actually this approach is consistent with the thermal which are also registered with a device and an id. In order to do a distinction between the old binding with child nodes and the incoming new binding, let's rename the registering function with a self-explanatory name. Rename the functions: devm_thermal_of_cooling_device_register() -> devm_thermal_of_child_cooling= _device_register() Used the command: find . -type f -name '*.[ch]' -exec \ sed -i 's/devm_thermal_of_cooling_device_register/\ devm_thermal_of_child_cooling_device_register/g' {} \; Did not used clang-format-diff because it does not indent correctly and checkpatch complained. Manually reindented to make checkpatch happy Signed-off-by: Daniel Lezcano --- drivers/hwmon/amc6821.c | 2 +- drivers/hwmon/aspeed-pwm-tacho.c | 5 +++-- drivers/hwmon/emc2305.c | 6 +++--- drivers/hwmon/gpio-fan.c | 6 ++++-- drivers/hwmon/max6650.c | 6 +++--- drivers/hwmon/npcm750-pwm-fan.c | 6 ++++-- drivers/hwmon/pwm-fan.c | 5 +++-- drivers/hwmon/qnap-mcu-hwmon.c | 6 +++--- drivers/hwmon/tc654.c | 5 +++-- drivers/memory/tegra/tegra210-emc-core.c | 4 ++-- drivers/soc/qcom/qcom_aoss.c | 2 +- drivers/thermal/khadas_mcu_fan.c | 7 ++++--- drivers/thermal/tegra/soctherm.c | 6 +++--- drivers/thermal/thermal_of.c | 15 +++++++++------ include/linux/thermal.h | 16 ++++++++-------- 15 files changed, 54 insertions(+), 43 deletions(-) diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c index d5f864b360b0..8e5926b06070 100644 --- a/drivers/hwmon/amc6821.c +++ b/drivers/hwmon/amc6821.c @@ -1076,7 +1076,7 @@ static int amc6821_probe(struct i2c_client *client) "Failed to initialize hwmon\n"); =20 if (IS_ENABLED(CONFIG_THERMAL) && fan_np && data->fan_cooling_levels) - return PTR_ERR_OR_ZERO(devm_thermal_of_cooling_device_register(dev, + return PTR_ERR_OR_ZERO(devm_thermal_of_child_cooling_device_register(dev, fan_np, client->name, data, &amc6821_cooling_ops)); =20 return 0; diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-ta= cho.c index aa159bf158a3..1c5945d4ba37 100644 --- a/drivers/hwmon/aspeed-pwm-tacho.c +++ b/drivers/hwmon/aspeed-pwm-tacho.c @@ -841,8 +841,9 @@ static int aspeed_create_pwm_cooling(struct device *dev, } snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%pOFn%d", child, pwm_port); =20 - cdev->tcdev =3D devm_thermal_of_cooling_device_register(dev, child, - cdev->name, cdev, &aspeed_pwm_cool_ops); + cdev->tcdev =3D devm_thermal_of_child_cooling_device_register(dev, child, + cdev->name, cdev, + &aspeed_pwm_cool_ops); if (IS_ERR(cdev->tcdev)) return PTR_ERR(cdev->tcdev); =20 diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c index 64b213e1451e..2505e9fac499 100644 --- a/drivers/hwmon/emc2305.c +++ b/drivers/hwmon/emc2305.c @@ -309,9 +309,9 @@ static int emc2305_set_single_tz(struct device *dev, st= ruct device_node *fan_nod pwm =3D data->pwm_min[cdev_idx]; =20 data->cdev_data[cdev_idx].cdev =3D - devm_thermal_of_cooling_device_register(dev, fan_node, - emc2305_fan_name[idx], data, - &emc2305_cooling_ops); + devm_thermal_of_child_cooling_device_register(dev, fan_node, + emc2305_fan_name[idx], data, + &emc2305_cooling_ops); =20 if (IS_ERR(data->cdev_data[cdev_idx].cdev)) { dev_err(dev, "Failed to register cooling device %s\n", emc2305_fan_name[= idx]); diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index a8892ced1e54..084828e1e281 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c @@ -592,8 +592,10 @@ static int gpio_fan_probe(struct platform_device *pdev) } =20 /* Optional cooling device register for Device tree platforms */ - fan_data->cdev =3D devm_thermal_of_cooling_device_register(dev, np, - "gpio-fan", fan_data, &gpio_fan_cool_ops); + fan_data->cdev =3D devm_thermal_of_child_cooling_device_register(dev, np, + "gpio-fan", + fan_data, + &gpio_fan_cool_ops); =20 dev_info(dev, "GPIO fan initialized\n"); =20 diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c index 9649c6611d5f..a50b1b0f1f48 100644 --- a/drivers/hwmon/max6650.c +++ b/drivers/hwmon/max6650.c @@ -793,9 +793,9 @@ static int max6650_probe(struct i2c_client *client) return err; =20 if (IS_ENABLED(CONFIG_THERMAL)) { - cooling_dev =3D devm_thermal_of_cooling_device_register(dev, - dev->of_node, client->name, - data, &max6650_cooling_ops); + cooling_dev =3D devm_thermal_of_child_cooling_device_register(dev, dev->= of_node, + client->name, data, + &max6650_cooling_ops); if (IS_ERR(cooling_dev)) { dev_warn(dev, "thermal cooling device register failed: %ld\n", PTR_ERR(cooling_dev)); diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fa= n.c index c8f5e695fb6d..aea0b8659f5f 100644 --- a/drivers/hwmon/npcm750-pwm-fan.c +++ b/drivers/hwmon/npcm750-pwm-fan.c @@ -857,8 +857,10 @@ static int npcm7xx_create_pwm_cooling(struct device *d= ev, snprintf(cdev->name, THERMAL_NAME_LENGTH, "%pOFn%d", child, pwm_port); =20 - cdev->tcdev =3D devm_thermal_of_cooling_device_register(dev, child, - cdev->name, cdev, &npcm7xx_pwm_cool_ops); + cdev->tcdev =3D devm_thermal_of_child_cooling_device_register(dev, child, + cdev->name, + cdev, + &npcm7xx_pwm_cool_ops); if (IS_ERR(cdev->tcdev)) return PTR_ERR(cdev->tcdev); =20 diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c index 37269db2de84..e6a567d58579 100644 --- a/drivers/hwmon/pwm-fan.c +++ b/drivers/hwmon/pwm-fan.c @@ -685,8 +685,9 @@ static int pwm_fan_probe(struct platform_device *pdev) =20 ctx->pwm_fan_state =3D ctx->pwm_fan_max_state; if (IS_ENABLED(CONFIG_THERMAL)) { - cdev =3D devm_thermal_of_cooling_device_register(dev, - dev->of_node, "pwm-fan", ctx, &pwm_fan_cooling_ops); + cdev =3D devm_thermal_of_child_cooling_device_register(dev, dev->of_node, + "pwm-fan", ctx, + &pwm_fan_cooling_ops); if (IS_ERR(cdev)) { ret =3D PTR_ERR(cdev); dev_err(dev, diff --git a/drivers/hwmon/qnap-mcu-hwmon.c b/drivers/hwmon/qnap-mcu-hwmon.c index e86e64c4d391..c1c1e9d6f340 100644 --- a/drivers/hwmon/qnap-mcu-hwmon.c +++ b/drivers/hwmon/qnap-mcu-hwmon.c @@ -337,9 +337,9 @@ static int qnap_mcu_hwmon_probe(struct platform_device = *pdev) * levels and only succeed with either no or correct cooling levels. */ if (IS_ENABLED(CONFIG_THERMAL) && hwm->fan_cooling_levels) { - cdev =3D devm_thermal_of_cooling_device_register(dev, - to_of_node(hwm->fan_node), "qnap-mcu-hwmon", - hwm, &qnap_mcu_hwmon_cooling_ops); + cdev =3D devm_thermal_of_child_cooling_device_register(dev, to_of_node(h= wm->fan_node), + "qnap-mcu-hwmon", hwm, + &qnap_mcu_hwmon_cooling_ops); if (IS_ERR(cdev)) return dev_err_probe(dev, PTR_ERR(cdev), "Failed to register qnap-mcu-hwmon as cooling device\n"); diff --git a/drivers/hwmon/tc654.c b/drivers/hwmon/tc654.c index 39fe5836f237..ba18b442b81e 100644 --- a/drivers/hwmon/tc654.c +++ b/drivers/hwmon/tc654.c @@ -541,8 +541,9 @@ static int tc654_probe(struct i2c_client *client) if (IS_ENABLED(CONFIG_THERMAL)) { struct thermal_cooling_device *cdev; =20 - cdev =3D devm_thermal_of_cooling_device_register(dev, dev->of_node, clie= nt->name, - hwmon_dev, &tc654_fan_cool_ops); + cdev =3D devm_thermal_of_child_cooling_device_register(dev, dev->of_node, + client->name, hwmon_dev, + &tc654_fan_cool_ops); return PTR_ERR_OR_ZERO(cdev); } =20 diff --git a/drivers/memory/tegra/tegra210-emc-core.c b/drivers/memory/tegr= a/tegra210-emc-core.c index e96ca4157d48..065ae8bc2830 100644 --- a/drivers/memory/tegra/tegra210-emc-core.c +++ b/drivers/memory/tegra/tegra210-emc-core.c @@ -1966,8 +1966,8 @@ static int tegra210_emc_probe(struct platform_device = *pdev) =20 tegra210_emc_debugfs_init(emc); =20 - cd =3D devm_thermal_of_cooling_device_register(emc->dev, np, "emc", emc, - &tegra210_emc_cd_ops); + cd =3D devm_thermal_of_child_cooling_device_register(emc->dev, np, "emc",= emc, + &tegra210_emc_cd_ops); if (IS_ERR(cd)) { err =3D PTR_ERR(cd); dev_err(emc->dev, "failed to register cooling device: %d\n", diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c index a543ab9bee6c..742f571200fa 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -381,7 +381,7 @@ static int qmp_cooling_device_add(struct qmp *qmp, qmp_cdev->qmp =3D qmp; qmp_cdev->state =3D !qmp_cdev_max_state; qmp_cdev->name =3D cdev_name; - qmp_cdev->cdev =3D devm_thermal_of_cooling_device_register + qmp_cdev->cdev =3D devm_thermal_of_child_cooling_device_register (qmp->dev, node, cdev_name, qmp_cdev, &qmp_cooling_device_ops); diff --git a/drivers/thermal/khadas_mcu_fan.c b/drivers/thermal/khadas_mcu_= fan.c index d35e5313bea4..21b3d0a71bd0 100644 --- a/drivers/thermal/khadas_mcu_fan.c +++ b/drivers/thermal/khadas_mcu_fan.c @@ -90,9 +90,10 @@ static int khadas_mcu_fan_probe(struct platform_device *= pdev) ctx->mcu =3D mcu; platform_set_drvdata(pdev, ctx); =20 - cdev =3D devm_thermal_of_cooling_device_register(dev->parent, - dev->parent->of_node, "khadas-mcu-fan", ctx, - &khadas_mcu_fan_cooling_ops); + cdev =3D devm_thermal_of_child_cooling_device_register(dev->parent, + dev->parent->of_node, + "khadas-mcu-fan", ctx, + &khadas_mcu_fan_cooling_ops); if (IS_ERR(cdev)) { ret =3D PTR_ERR(cdev); dev_err(dev, "Failed to register khadas-mcu-fan as cooling device: %d\n", diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/socth= erm.c index 790c4c96a9b5..f58430ed8f11 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -1700,9 +1700,9 @@ static void soctherm_init_hw_throt_cdev(struct platfo= rm_device *pdev) stc->init =3D true; } else { =20 - tcd =3D devm_thermal_of_cooling_device_register(dev, np_stcc, - (char *)name, ts, - &throt_cooling_ops); + tcd =3D devm_thermal_of_child_cooling_device_register(dev, np_stcc, + (char *)name, ts, + &throt_cooling_ops); if (IS_ERR_OR_NULL(tcd)) { dev_err(dev, "throttle-cfg: %s: failed to register cooling device\n", diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index ee9776d0e5be..d06487bb5e67 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -550,7 +550,7 @@ static void thermal_cooling_device_release(struct devic= e *dev, void *res) } =20 /** - * devm_thermal_of_cooling_device_register() - register an OF thermal cool= ing + * devm_thermal_of_child_cooling_device_register() - register an OF therma= l cooling * device * @dev: a valid struct device pointer of a sensor device. * @np: a pointer to a device tree node. @@ -563,14 +563,17 @@ static void thermal_cooling_device_release(struct dev= ice *dev, void *res) * to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind = itself * to all the thermal zone devices registered at the same time. * + * This function should be used when a cooling controller has child + * nodes which are referenced in the thermal zone cooling map. + * * Return: a pointer to the created struct thermal_cooling_device or an * ERR_PTR. Caller must check return value with IS_ERR*() helpers. */ struct thermal_cooling_device * -devm_thermal_of_cooling_device_register(struct device *dev, - struct device_node *np, - const char *type, void *devdata, - const struct thermal_cooling_device_ops *ops) +devm_thermal_of_child_cooling_device_register(struct device *dev, + struct device_node *np, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops) { struct thermal_cooling_device **ptr, *tcd; =20 @@ -592,4 +595,4 @@ devm_thermal_of_cooling_device_register(struct device *= dev, =20 return tcd; } -EXPORT_SYMBOL_GPL(devm_thermal_of_cooling_device_register); +EXPORT_SYMBOL_GPL(devm_thermal_of_child_cooling_device_register); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 0a95cfeffa74..b3c448f7d919 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -205,10 +205,10 @@ thermal_of_cooling_device_register(struct device_node= *np, const char *type, voi const struct thermal_cooling_device_ops *ops); =20 struct thermal_cooling_device * -devm_thermal_of_cooling_device_register(struct device *dev, - struct device_node *np, - const char *type, void *devdata, - const struct thermal_cooling_device_ops *ops); +devm_thermal_of_child_cooling_device_register(struct device *dev, + struct device_node *np, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops); #else =20 static inline @@ -232,10 +232,10 @@ thermal_of_cooling_device_register(struct device_node= *np, } =20 static inline struct thermal_cooling_device * -devm_thermal_of_cooling_device_register(struct device *dev, - struct device_node *np, - const char *type, void *devdata, - const struct thermal_cooling_device_ops *ops) +devm_thermal_of_child_cooling_device_register(struct device *dev, + struct device_node *np, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops) { return ERR_PTR(-ENODEV); } --=20 2.43.0 From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1BEF391E76 for ; Wed, 22 Apr 2026 17:43:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879823; cv=none; b=qN6VLrO+cqKrhqxhanrMX9Jbs2uBYTkBolKkKDp/3DuL3e4ErXS+W61k7n9o3YRpOxGvwRq+09tCW69Y57UicSL1xKPJ3AxEBu4sVtjH7RjiX99rJJahT8fANrB6c7h8cdD3ZyXn37iUgPk0hfCvJ5TvoB9t+r9kI6Nf/V74BxM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879823; c=relaxed/simple; bh=WZWZt0bPOVWm1f/mYYZeoQ2v34IzpqaOtZm+yK+w7as=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WC8henzKY9J0+MyUggy9+ioWvnONINv9H0mQUlfGNkfDu6OMQJaSS0hSoOLmtn7Ux+TJnkJd++HpMRoFkIdNCxaupesDHeKJlzq69LaPJv0HozVpujCfDVs/wnt6wfeEartw10Yft0oNB/xDPNMizDauFKO7JdHhqxJqApnyDxM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=lUqpt0hJ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=BDQPDJcW; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="lUqpt0hJ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="BDQPDJcW" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MG9pGe3172948 for ; Wed, 22 Apr 2026 17:43:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=RPB74rjHmio iPv8T6HjThisH0Pt4yN6/d8eSpZWAlsw=; b=lUqpt0hJTHzrhLdMaxsXr1yL/Fh QIO7xd91xuTaR1uBj9aRW4uYyAghxi5e2s46MWED1RA1pwtw86fPuQowXyVZl/53 zJi3+nUZAPEtRGBoWl0gc3aQZpHIaeef3IXzFAOOAro9tMFlEfYrs1qpm69nbK2Z Kpauw5EHQsA+7sRPj3r/CWWCdI9N2Eip0Oe1CRikzNElMqHPzycVstu9WhRbqUno bS1jYHZF9P+XWq66kwucSubbHwmb7956UtbgzAy0ODQWUCNmsSUw91OlNm5s90RC RSKyjFItBcb5NJ/cmcjeznKRQmtA9KKhofw0Kg7ndPzBTqoIZHjAUoR4HAg== Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq1m30aq5-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:40 +0000 (GMT) Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-50eb8bad331so17642491cf.0 for ; Wed, 22 Apr 2026 10:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879819; x=1777484619; darn=vger.kernel.org; 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=RPB74rjHmioiPv8T6HjThisH0Pt4yN6/d8eSpZWAlsw=; b=BDQPDJcWLPjk/9InnjEvMER23d7GmHkbtkD1mVisSrdv+26s3yaiaUOPwxm9Ik8QPU v0sZhIo6AQ9hUqA41jiCJKmjt8X23tR+P7Wwny3YPIqo3wEXaWnI5n4F/Z+nLw9qPXMQ +wZbpqQLbPeZFzVJ92z1wvVLvTanbDigDIFK8YxxJ58XBvyhNSTJ11LISZflrh7vXj02 lyr28Y72+sd3YGdzTy6JuRVtJp2yjYutDq/JIGJq31xemdJA7l2LJNM8onZN9AgOUR+A ZLHwzudlUu/CHXVQhAB/6v+64m/hYm8EWq00EcyokkhC/Pd5+O9h7E/xfMIrlpoGIHye gPVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879819; x=1777484619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RPB74rjHmioiPv8T6HjThisH0Pt4yN6/d8eSpZWAlsw=; b=Z8tP+B1J848q+QyMQyTYPZrhnuqnx5JDhqyxtP5uyB9bGZHDRVoMdH0viHYJaeWPLV Aj1SkyJhsC1LA4tBCS6XZZZxM0D+JDUu+J6tZPY+zDtquUkiVtugaGsDtHdFPaX5ySAt qWbhrE10co/0jldT1vjYgE5X7P4ghKy9cyt+NO0kYgsdIYnvaMkJiMoGLFNPh4k4kOq7 s69GOPsu7wd9MCl0M8CXjNX0XYK2xtop+v5PciWSIjSVJvBxJXfmvIgfaxsJ0A63+zFw h944eyUzgPpVylAb3NLcR9V4AFTrvgm3ISWN97aCJR16ne/BKVDAY3GJH/FhhI7E3n2M NESA== X-Forwarded-Encrypted: i=1; AFNElJ+0JS91G91CoEK+F6O6FLXGArqnTbn4j0Wog7ulKF564fEOLz3XawtPKdBTfHqJKDlxriCU3+jFWOrtS1U=@vger.kernel.org X-Gm-Message-State: AOJu0YyI0KpljZBKqg4+2mVYKHFE3tv2vn8gP3iKdbE4m865g8hTVQmC h9DVm29xXGBfq5kwsSGDxATrG9sbsU+2iX+9BVWM+nTBMMteyh4X0vPPin3nIMHPVsuk4Iyl51j HXTr/JHBavFvVqOkOwDqMft1QbtLOSK5Vj/NbpNZjcU87VpHy1aZKm29HHCwyFE2bVwo= X-Gm-Gg: AeBDies5Dd7g+nqRYwZK4MGY0ioCq51Yj5r45izbCKWEb6Gm2L8sgpEhbaxkL6fFbLS Kirxgw4BBL0yytFzeuQ2KWmPgNi+aodLM+1kneR/O1eYqrcI9v0pUi438zYOrhbZBgFg8SYSTrA rx4cm8hLwrGqKnIHUA+JIJ7LqWGveqiNIYdx/vUlTwuFJk2wIBAFbeNPiga6vOeM9z/j7a/EI7d yyYmYSBIaFluLiZx2Ac2qvjIXctS/+EjYmHD+LbsYWQmMWq9S4+Pk64xvAFlkmcwCHzOxedYh/9 c86FrufBzIOky9SxEXLL/amN1ycIg6qQbqBzGFfgzrASJaqMVs3ntve/FaLlOMUGeEoMbibcqV7 SXaFntEEaL8LiOJ0I4RBTYyPex9GDWlpIiBL/c4v/1Uek0nP8gozDORkV96xN X-Received: by 2002:ac8:7c46:0:b0:50f:bdc1:3bbc with SMTP id d75a77b69052e-50fbdc14892mr80055031cf.45.1776879819043; Wed, 22 Apr 2026 10:43:39 -0700 (PDT) X-Received: by 2002:ac8:7c46:0:b0:50f:bdc1:3bbc with SMTP id d75a77b69052e-50fbdc14892mr80054371cf.45.1776879818424; Wed, 22 Apr 2026 10:43:38 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:36 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, etnaviv@lists.freedesktop.org (moderated list:DRM DRIVERS FOR VIVANTE GPU IP), dri-devel@lists.freedesktop.org (open list:DRM DRIVERS FOR VIVANTE GPU IP) Subject: [PATCH v2 09/12] thermal/of: Introduce cooling device of_index Date: Wed, 22 Apr 2026 19:42:58 +0200 Message-ID: <20260422174305.2899095-10-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: rMjAcRH94HSrnlYvXZO6DACskhYjBZUg X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfX/fymmORrEtPv oy/Ncv37Dlvn70yosdPZ61W7YXRp0tK0xP/d6U8FZ9lLzZUiUTsfCGcbavwwoVEJab+yDwHDv5M oGeCQarlWVP+bAOW+DXgl90TLMtDAxbhKxHzSFOCfbLmNA3P0GjLyxGXQIwyBDkk5fVDz/YGjky 5ZYKpVILjRs2y83RghshkRTPlhf02jKExN9ruZYnILcCfIH3P8KCQtSnEnzDxWdGiRRzhq6WiZ2 PUPk4F4jvf/CctASzv2jhvV081R/sCviQyK2+Nr4TZQ2vM/dcJBs6WvZ47FGt5ZaGlgHzPMfyO1 PsxA1zUnRw3NYRhgTrpHL74kbMEo0MQ1L/ukAZgLRXlAtbQpRrrTA072QTTNmPmuhQLGhNvFp8m 6w6Tii+q8ZO4BJ/caGkk1MQElXgd9jLgkhpX1YQ4uZiwoiDbfEfMF7ZriZQrm0aT1tHDksj67NF cbhS2njayD3xRLrXr7w== X-Authority-Analysis: v=2.4 cv=PsOjqQM3 c=1 sm=1 tr=0 ts=69e908cc cx=c_pps a=mPf7EqFMSY9/WdsSgAYMbA==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=UUaV7nkyxFtcjw1PROYA:9 a=dawVfQjAaf238kedN5IG:22 X-Proofpoint-GUID: rMjAcRH94HSrnlYvXZO6DACskhYjBZUg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" As described in the previous change, the new incoming DT binding will describe a tuple device_node + cooling device id, instead of child nodes. Let's augment thermal_of_cooling_device_register() to receive the cooling device id and propagate the changes to the four remaining drivers using the non-devm version of the cooling device registering function. Add the id in the cooling device structure and store the value when registering it. Signed-off-by: Daniel Lezcano --- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 5 +++-- drivers/thermal/cpufreq_cooling.c | 2 +- drivers/thermal/cpuidle_cooling.c | 2 +- drivers/thermal/devfreq_cooling.c | 2 +- drivers/thermal/thermal_of.c | 6 ++++-- include/linux/thermal.h | 6 ++++-- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnavi= v/etnaviv_gpu.c index a891d4f1f843..552631c3554a 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -1791,8 +1791,9 @@ static int etnaviv_gpu_bind(struct device *dev, struc= t device *master, int ret; =20 if (IS_ENABLED(CONFIG_DRM_ETNAVIV_THERMAL)) { - gpu->cooling =3D thermal_of_cooling_device_register(dev->of_node, - (char *)dev_name(dev), gpu, &cooling_ops); + gpu->cooling =3D thermal_of_cooling_device_register(dev->of_node, 0, + dev_name(dev), + gpu, &cooling_ops); if (IS_ERR(gpu->cooling)) return PTR_ERR(gpu->cooling); } diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_co= oling.c index 32bf5ab44f4a..768859a7aed0 100644 --- a/drivers/thermal/cpufreq_cooling.c +++ b/drivers/thermal/cpufreq_cooling.c @@ -592,7 +592,7 @@ __cpufreq_cooling_register(struct device_node *np, if (!name) goto remove_qos_req; =20 - cdev =3D thermal_of_cooling_device_register(np, name, cpufreq_cdev, + cdev =3D thermal_of_cooling_device_register(np, 0, name, cpufreq_cdev, cooling_ops); kfree(name); =20 diff --git a/drivers/thermal/cpuidle_cooling.c b/drivers/thermal/cpuidle_co= oling.c index 425f596614e8..bbd2e91cf5ab 100644 --- a/drivers/thermal/cpuidle_cooling.c +++ b/drivers/thermal/cpuidle_cooling.c @@ -207,7 +207,7 @@ static int __cpuidle_cooling_register(struct device_nod= e *np, goto out_unregister; } =20 - cdev =3D thermal_of_cooling_device_register(np, name, idle_cdev, + cdev =3D thermal_of_cooling_device_register(np, 0, name, idle_cdev, &cpuidle_cooling_ops); if (IS_ERR(cdev)) { ret =3D PTR_ERR(cdev); diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_co= oling.c index 1c7dffc8d45f..0330a8112832 100644 --- a/drivers/thermal/devfreq_cooling.c +++ b/drivers/thermal/devfreq_cooling.c @@ -454,7 +454,7 @@ of_devfreq_cooling_register_power(struct device_node *n= p, struct devfreq *df, if (!name) goto remove_qos_req; =20 - cdev =3D thermal_of_cooling_device_register(np, name, dfc, ops); + cdev =3D thermal_of_cooling_device_register(np, 0, name, dfc, ops); kfree(name); =20 if (IS_ERR(cdev)) { diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index d06487bb5e67..a9319ff81d1d 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -514,6 +514,7 @@ EXPORT_SYMBOL_GPL(devm_thermal_of_zone_unregister); /** * thermal_of_cooling_device_register() - register an OF thermal cooling d= evice * @np: a pointer to a device tree node. + * @of_index: a cooling device index in the cooling controller * @type: the thermal cooling device type. * @devdata: device private data. * @ops: standard thermal cooling devices callbacks. @@ -527,7 +528,7 @@ EXPORT_SYMBOL_GPL(devm_thermal_of_zone_unregister); * ERR_PTR. Caller must check return value with IS_ERR*() helpers. */ struct thermal_cooling_device * -thermal_of_cooling_device_register(struct device_node *np, +thermal_of_cooling_device_register(struct device_node *np, int of_index, const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { @@ -538,6 +539,7 @@ thermal_of_cooling_device_register(struct device_node *= np, return cdev; =20 cdev->np =3D np; + cdev->of_index =3D of_index; thermal_cooling_device_init_complete(cdev); =20 return cdev; @@ -582,7 +584,7 @@ devm_thermal_of_child_cooling_device_register(struct de= vice *dev, if (!ptr) return ERR_PTR(-ENOMEM); =20 - tcd =3D thermal_of_cooling_device_register(np, type, devdata, ops); + tcd =3D thermal_of_cooling_device_register(np, 0, type, devdata, ops); if (IS_ERR(tcd)) { devres_free(ptr); return tcd; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index b3c448f7d919..070dcf7f77b6 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -134,6 +134,7 @@ struct thermal_cooling_device { struct list_head node; #ifdef CONFIG_THERMAL_OF struct device_node *np; + int of_index; #endif #ifdef CONFIG_THERMAL_DEBUGFS struct thermal_debugfs *debugfs; @@ -201,7 +202,8 @@ struct thermal_zone_device *devm_thermal_of_zone_regist= er(struct device *dev, in void devm_thermal_of_zone_unregister(struct device *dev, struct thermal_zo= ne_device *tz); =20 struct thermal_cooling_device * -thermal_of_cooling_device_register(struct device_node *np, const char *typ= e, void *devdata, +thermal_of_cooling_device_register(struct device_node *np, int of_index, + const char *type, void *data, const struct thermal_cooling_device_ops *ops); =20 struct thermal_cooling_device * @@ -224,7 +226,7 @@ static inline void devm_thermal_of_zone_unregister(stru= ct device *dev, } =20 static inline struct thermal_cooling_device * -thermal_of_cooling_device_register(struct device_node *np, +thermal_of_cooling_device_register(struct device_node *np, int of_index, const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { --=20 2.43.0 From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6527539769E for ; Wed, 22 Apr 2026 17:43:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879825; cv=none; b=EeoCqp/nj4CwlX9Ljs3vyAYBbnlqX+ROPSCTUYM4XQ41YH6L+4uRj4YxccJrUKSQtKcGlILN53BYPQ4bx3QF9KxYGJYWPPxl4R40PSWvUSUuzXYoNqzTSRkpY9aOg2K0BzM1sCy3jF9/NCFQCHnuZU1XNAlMUby/Sriv3EmLfZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879825; c=relaxed/simple; bh=6+530nQoabfGsWxkvdlmkp9P7mXbKYm1O5XyUmoNaFU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fygl2a1ksug6Zw5MrUTO9BxbyD1QD5BJ/Dkqut361SHo8Sj/ciJnQ2uBLEhaVeRkDqZxRDgLX7t9b1vHfdWm2AiQyhHDBPW4fv6T9oq1Ik2E71vrLVHUQz036fK15VBxrlPKJXhe9dHUfA68NVOOjYTUkY2Budcad4P+sGhfRPY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=k/j+CFGN; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Ns998ala; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="k/j+CFGN"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Ns998ala" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MGA0eR3173279 for ; Wed, 22 Apr 2026 17:43:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=OGUq4M68SCq WoWQHmrCQ+DNNSG+TG8OoiJ0JYglko4Q=; b=k/j+CFGNA7kZLpa1+mRgLljNIst yVTQMKMhmezqp/uJHXa4Bs0y0rj/9+l5DxQ8sODnZpOCqUgurmUgiXrlP8mJtwVb /F4xFUmgVFfif/cydI2nzgs6BCmBQeASdK/egVQU+4RtsjRHr9wpjOEQopqnjaE0 B726DjxQy2kAao7Ox9EaCScLRWSsGnESTqZZKycE3G0/9FGvJEgC8UyUmoZvhse7 69azajL/rsUHWZT8nBs9N/XFN3CftsoUPFycWvBaLINAqcZKyUGzf3+pUzhwAiXD Q7W477U2C93S+KoxVzWccKPzhFlrn7qhQgzXxzUhwPGFCeTft8SU5NLqtAw== Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq1m30aqc-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:43 +0000 (GMT) Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-50edf01172bso80355411cf.2 for ; Wed, 22 Apr 2026 10:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879822; x=1777484622; darn=vger.kernel.org; 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=OGUq4M68SCqWoWQHmrCQ+DNNSG+TG8OoiJ0JYglko4Q=; b=Ns998alajfAuiUmvhE+YZSaNAlypByilkRFUPFVPYoNjiTO6XCCrNjcXcdYtQdLMzJ tdlxs09Xq1JXJ3zyGYajU+hMQMoTSTAtWLS4PZ51oPgWXpO2OVm2pi7r5yw20OmyK/Um OmCr+3AtwOjnef332FnFUVMFIFvPxk4FpZrDdE9svAZh96vYFYvyonU2N1l3NThy0zF5 C+1Bzqw2PY5u8u09aoo9L34UbIGSdyf9bRAMnX2AoKgnlCV7jUuaBgJocjaWfhbKvVqb qgeXpHpX7vVZFLYKrIwyF9Ap+AFp4oTQbED0XCccW4/isfMi6qqwvtRCUf7/0lkA0+Hv VOLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879822; x=1777484622; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OGUq4M68SCqWoWQHmrCQ+DNNSG+TG8OoiJ0JYglko4Q=; b=V0dcujSmWElzwYjbirYrJ8rX8slr3fBzBEwcIZ5p7kzRUYPevtjQ8ovCEv09m8bOT9 sYuJEvtAzHNlbEKMY66asxddCMR5GL/rHKw2Wj2Mg9zmCFxkUZy+XndmGlASm5RG+g9I JqE5Ah8a+gn8e87/47IgENB3QOokNVvxO0MPOqsHoBm9vd2XMo8ig9lvE2jyzQEBxGlc eL+O2VM8SOmiz9xK/c1deHRj8oXDvW6T96l280BdTAyvgn8kjryjq+9lqUFZe4rzrB5M AuNbW2P/oFaHSgMtdDgY9g9E/TvskrTA9rMZBFZgRNT/LSRXhjd1HpcEjLzxokWmtuln miYQ== X-Forwarded-Encrypted: i=1; AFNElJ+MN+CQl6EVjP9xD7Bopd9DvhZLEFWcNHaNJMPp2n7CEJq4FusDG2pXRv3HqeI/0sMpsGI0R9jaKHcHrZw=@vger.kernel.org X-Gm-Message-State: AOJu0YwxI7pmTF4G21itKeLiblCmb+tJiHW9cyYUI2mgzjqx71QZcMKy afALERZENWh3+xuRc1As82KssXUphqAXdcKKL3KmvvkElX0vCmVDCWpdHGJ11hrCEoZY6g9Tbjx +Duif95j0iETBT+NtxndPPyBZHzJxmIq22l7FkZThJkiDpZYYeIpzFgkClodyib0U6mg= X-Gm-Gg: AeBDiesBay499gex0/FxfTXZ67VFQpWMqsdEH3Wtx3U1fsQfjCqMFf6cPklacvXPGs4 e3pppPbAGzEPbZk7hHdO570bYJHsxzBOm1PfU9IKxU+iNmz0RwgfAA0NxnVAjaVbdUNZ8RKHv5B gcsJZXklcLljJlmBBocCyX1X7htqRGNP8Jx+kkYZfjYwQSknBT5Y68oPAqlXPeXnyi6eij7Q4OJ rG6DtoOSKjxNQsREntpUzZv3RBGHq1t5k00WrKFFQsf9pCQKWMPwOclq1IZLLO1lSG9cQZhZq1U JMnMXeDiEOoz5jH53tirs2t+XZ/3AMmhFypphtBbDUchONOtD63IQV7t1FdOjMwT/+kuB89HVgp LG4lV51UyO+X+8mpYbdQ36MkqoK9aaAlLlU+se56adnemvqUtYKYhxEMLswQJ X-Received: by 2002:a05:622a:5914:b0:509:f36:496d with SMTP id d75a77b69052e-50e36c0cdf3mr348540181cf.33.1776879822544; Wed, 22 Apr 2026 10:43:42 -0700 (PDT) X-Received: by 2002:a05:622a:5914:b0:509:f36:496d with SMTP id d75a77b69052e-50e36c0cdf3mr348539321cf.33.1776879821892; Wed, 22 Apr 2026 10:43:41 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:39 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v2 10/12] thermal/of: Pass the of_index and add a function to register with an index Date: Wed, 22 Apr 2026 19:42:59 +0200 Message-ID: <20260422174305.2899095-11-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: NtEYjepVbkviqNMdh-vJqug7c5nButBx X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfXz8hqyBCRcQ22 Xx2NWMlfg8+8PPWVwkhgOoX3DghHXKHOqh2LmSWei7T7Ue1vLPN/CZb835nueMvxBkNfMhGTIdF hD38IQPdtrw0F3Bs1HGvMt5vtWQF4P60BxrLFLdw7ZtZ6YWSkmlftCNziF5Cc7TOIMUBlkhlyq7 ljIC1SMia97UA9EJqx0EXwglre6WYG3VR6qSoK67yeI684cwNRUBZBMVbr9E76PrBXNb+gOa6Ms 1QgTT1VLBZcyplgcZqviv9uaz9hWYEa6AsYl+p6C9/qkm4EJnqDBJjhv2aQDU+liG6gaM9QujF7 grMmbEDfMQasroUECymbuJAxf1Vqaj5Z84EfEcuwAZkFcZzUo/UoRgYqyIpdMj/OAmxRBfPCvqg L8uWzTLLuCTyxVcXN6kmS0++yBXTLTKCzVqgf/haxGHGBujMqIRHJ4vt+I/wFL+oMCQ1rFG3Ubw 64VyBBiDJIH5z+Ucnpg== X-Authority-Analysis: v=2.4 cv=PsOjqQM3 c=1 sm=1 tr=0 ts=69e908cf cx=c_pps a=mPf7EqFMSY9/WdsSgAYMbA==:117 a=V4iKOSeYOELjiAWC:21 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=KHKEB8RYcew9Qe18FDUA:9 a=dawVfQjAaf238kedN5IG:22 X-Proofpoint-GUID: NtEYjepVbkviqNMdh-vJqug7c5nButBx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" Introduce a new function devm_thermal_of_cooling_device_register() which will register a cooling device and its id. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_of.c | 70 ++++++++++++++++++++++++++---------- include/linux/thermal.h | 13 +++++++ 2 files changed, 64 insertions(+), 19 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index a9319ff81d1d..d0d6d6b82d5a 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -551,6 +551,56 @@ static void thermal_cooling_device_release(struct devi= ce *dev, void *res) thermal_cooling_device_unregister(*(struct thermal_cooling_device **)res); } =20 +static struct thermal_cooling_device * +__devm_thermal_of_cooling_device_register(struct device *dev, struct devic= e_node *np, + int of_index, const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops) +{ + struct thermal_cooling_device **ptr, *tcd; + + ptr =3D devres_alloc(thermal_cooling_device_release, sizeof(*ptr), + GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + tcd =3D thermal_of_cooling_device_register(np, of_index, type, devdata, o= ps); + if (IS_ERR(tcd)) { + devres_free(ptr); + return tcd; + } + + *ptr =3D tcd; + devres_add(dev, ptr); + + return tcd; +} + +/** + * devm_thermal_of_cooling_device_register() - register an OF thermal cool= ing device + * @dev: a valid struct device pointer of a sensor device. + * @of_index: a cooling device index in the cooling controller + * @type: the thermal cooling device type. + * @devdata: device private data. + * @ops: standard thermal cooling devices callbacks. + * + * This function will register a cooling device with device tree node refe= rence. + * This interface function adds a new thermal cooling device (fan/processo= r/...) + * to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind = itself + * to all the thermal zone devices registered at the same time. + * + * Return: a pointer to the created struct thermal_cooling_device or an + * ERR_PTR. Caller must check return value with IS_ERR*() helpers. + */ +struct thermal_cooling_device * +devm_thermal_of_cooling_device_register(struct device *dev, int of_index, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops) +{ + return __devm_thermal_of_cooling_device_register(dev, dev->of_node, of_in= dex, + type, devdata, ops); +} +EXPORT_SYMBOL_GPL(devm_thermal_of_cooling_device_register); + /** * devm_thermal_of_child_cooling_device_register() - register an OF therma= l cooling * device @@ -577,24 +627,6 @@ devm_thermal_of_child_cooling_device_register(struct d= evice *dev, const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { - struct thermal_cooling_device **ptr, *tcd; - - ptr =3D devres_alloc(thermal_cooling_device_release, sizeof(*ptr), - GFP_KERNEL); - if (!ptr) - return ERR_PTR(-ENOMEM); - - tcd =3D thermal_of_cooling_device_register(np, 0, type, devdata, ops); - if (IS_ERR(tcd)) { - devres_free(ptr); - return tcd; - } - - *ptr =3D tcd; - devres_add(dev, ptr); - - thermal_cooling_device_init_complete(tcd); - - return tcd; + return __devm_thermal_of_cooling_device_register(dev, np, 0, type, devdat= a, ops); } EXPORT_SYMBOL_GPL(devm_thermal_of_child_cooling_device_register); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 070dcf7f77b6..55ac0390da8d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -206,6 +206,11 @@ thermal_of_cooling_device_register(struct device_node = *np, int of_index, const char *type, void *data, const struct thermal_cooling_device_ops *ops); =20 +struct thermal_cooling_device * +devm_thermal_of_cooling_device_register(struct device *dev, int of_index, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops); + struct thermal_cooling_device * devm_thermal_of_child_cooling_device_register(struct device *dev, struct device_node *np, @@ -233,6 +238,14 @@ thermal_of_cooling_device_register(struct device_node = *np, int of_index, return ERR_PTR(-ENODEV); } =20 +static inline struct thermal_cooling_device * +devm_thermal_of_cooling_device_register(struct device *dev, int of_index, + const char *type, void *devdata, + const struct thermal_cooling_device_ops *ops) +{ + return ERR_PTR(-ENODEV); +} + static inline struct thermal_cooling_device * devm_thermal_of_child_cooling_device_register(struct device *dev, struct device_node *np, --=20 2.43.0 From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E88AD397E75 for ; Wed, 22 Apr 2026 17:43:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879830; cv=none; b=fh/0QhzFyxUAJ9XgoZLou4hObYdc+fWWHDGshn8Lzf82zDGa1JxcwH7tEw5j+UAh3PBbhqKXIt/fvXIG7tsESmeGzmQSRpOSDRmpPPzWtiHUdIgM3LfJIgO8nL/cAH+BwRg8QnBjKeRol6pCUOiK0nI1Nwrn0prChxoJ7Ij0IU8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879830; c=relaxed/simple; bh=GRJKqETTYD+0iUNaGVQk7QmrjeC7H3mzki0OTwX5WSE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ezv/DfcCeOdiPCfvowz1074fjFaL/tzq9q3j3DoaRovIDRBg8JH6VfrYo3J+vid8zYXS+MQzn6u4OmEOfCsqz0tRtryDc4q0mmyA1s1ktpmuOsq3DLZ8RsPVjwbzSiLvYScd5W3ykWCVP9mYQp3m6ZWxsIbTXpc2Ountomxiakk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ep8igiT9; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=THqyT0kG; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ep8igiT9"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="THqyT0kG" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MGqac21218441 for ; Wed, 22 Apr 2026 17:43:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=ycCp+qg3sPA C9R8065KdU0CXnIWLAlFwlYKj3ZnmuC4=; b=ep8igiT9pgcI1N+wLuV175BWocv wfHemshB4+0SRwLYHsSSM5tTISeFWjipJFjc4QSRHlu0+kTqE7u4v4tLbQFHaSCI cVW3Su2fuw5EN3C5XwXjKJnQBnjY9cLEU9Lu76egrng9fJJrP88ZgMWt2dtxWfd+ NuAQHIJaolrTLbL7aFFdIDtgQ1lcxyx1FVYkcHJlCrrX7nFciRWxyJg7Ay7jWa5a IGcTyJfbvcPPrN63uLixdTA4wVCif0RCL/hl3mJPsZP8qcRIFZ7nHq+30vjom5Qp KE2X7MN5oUP2DIhOSh8xZTqQnEOXGoYT22ANRiEPOu7hsrQQ0nVmb6HckNQ== Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq282r5ut-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:48 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-50faf575af4so68660741cf.0 for ; Wed, 22 Apr 2026 10:43:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879825; x=1777484625; darn=vger.kernel.org; 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=ycCp+qg3sPAC9R8065KdU0CXnIWLAlFwlYKj3ZnmuC4=; b=THqyT0kGIVj+1naxjnjTPFtw2JeWpRDxvafgA5GK81UCgYa+7T3cpCjZeA1ExmfDUL iXRYegDAfDPJ4Ul3PltJxUusiNRNZBRWm47onOXty0an/SiPPWOUM922ZpDtMSdPZYwM a8dlTD4aRjz70FXSB3xdtfJ+QtyiUpUVPY3dHU/LUWq1aVh9wVfIkOZJJlUOYBk8+/3O dZpgdclyisYvbJXm4Ua5hqFKbB34d3H4IgSNI8RIQITf2U8efB6mbJQbyJc0F2lHgqS+ o5oIxNZG9DSrKLiQD1BHOyw3Uiw0lEoG657AQIAp8c+J4bxAZ8JRU3YA0hECnxcVAgxM tZJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879825; x=1777484625; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ycCp+qg3sPAC9R8065KdU0CXnIWLAlFwlYKj3ZnmuC4=; b=adqIfc9wY/ThQXlvtOwH6OT1Xb/6zJVSf81h1lEwhGJE32Kuu2wS1Ze8O5CY62360m SQ+gYqIPMkD2vFTuN9+uLPUBwLIoapD5ZcpvAKHXPCSWE+hwEd4cfrZIpFYQPMZLS8tG W+GGgUIhMjM5ort7R6JE1pNrq+zNoDMlG2VVNdk+C36zMOI7ORxE3ZnpoHWG+zThWqgL notOP6+ExbfBTs79f10nRJBNYF03j/1p38pbZFhzKZT02u9GwWQIeTeRdJc5lDSJmtFy iGJKMAZihmj32rPBi/MVYylkXY8/jKt/Zx5nbExi0ksPM3HKORIaaLSAEa809TOQXfAo e/8g== X-Forwarded-Encrypted: i=1; AFNElJ8oybEaR1CLqEOgJbS7t/3boXGuLRUm+J7WYKXN7J9fRTj1s8xOR/8qxzQFIbb6cSoGuxSDxlyJIREGm8U=@vger.kernel.org X-Gm-Message-State: AOJu0YxEREd6wxTwKHI0NkcYpo32Hrk2DLV7ykvUndYpR04AlDDnvRVy WfSKM9v+wCF+irhQR8lDUrVy0DasDaj6Ok5ozCrfB5QD0JpTojemG2j7Mzg34Hcg212BBzEa8XN CyNGyHxIjQusN0yA5mCzMexeZfGK7Kd4956CHWW9kLZBy7RwRza6fm+j9FsPPV7r2x7k= X-Gm-Gg: AeBDieubbW29D0IBZcQ9Iya/lknvvmN8Gt6c/HT16+jPgqFA/zJ3lA28rhjq09fQSCF 0pS99HH66Z+QCYKQ3ujhLGhhsIEK1iKm4FoXtQpfqx6pX1l+VckMx5U3HwGtvLQW6nDeKS2wEN4 pCs7lkakUpXw7OSp8jqpgLFqUgnJPUR2f94fhLXPFy6upGpTrSSQVCpl4E8apHdNmwg0LHhzwEv sVp53+ZPdtbj4yk4t8ifSQxLPn/EaO9VFafVm82OP5p1d+oX3u6ioYuFA0FjjpSqv8wFCFLZhHB 9W/uXNdf41KVEdLwWASzPQnidu5NbD0vUUagVwNe3SM8rM83jHmy1MsIENym7mgeu0p8DsU0kbj S5KMQM2+YTqWzEJJFWhcO1i0zWwgDIey3W1+NK6omI2/TLv4G7DoX+RHgSOcM X-Received: by 2002:a05:622a:7281:b0:50e:601a:217f with SMTP id d75a77b69052e-50e601a2509mr134414691cf.25.1776879825098; Wed, 22 Apr 2026 10:43:45 -0700 (PDT) X-Received: by 2002:a05:622a:7281:b0:50e:601a:217f with SMTP id d75a77b69052e-50e601a2509mr134414041cf.25.1776879824631; Wed, 22 Apr 2026 10:43:44 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:43 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v2 11/12] thermal/of: Process cooling device index in cooling-spec Date: Wed, 22 Apr 2026 19:43:00 +0200 Message-ID: <20260422174305.2899095-12-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfX8pRLFxMVCwmG 8ZvswTPtuyt3gw9PMbqbZ/6S6kfuF0J6aG+XGlZX3DHDo7H+8wTzFu4m4F6AFn524OPjnHsNJMZ Ple35p2otrnEVDl28b21lJAvX9EbkqO8QA2mnH/6aVRK8+516JpZrFNW0uCno7F3gIZuSnRdRd6 hIzCO3SzEYoahrYyqCekIinTE0WKoiyChcI2soUbjuJe15mMR3GFCYBXARP9/oef94gGLNWyfqY kV1G0f89Pf+xnjWSuk9fRoJXUCuzaDieEivJRy541/pQZxLWxH/p5M4DnTl2DvIyqUSWJLZWx9d uIkY1v2KT3ivv/TL8gpI/nOpmTxYLLZxzY+i2q6rziC5kaRO9FERVjlhg85//XSwPQJueyLrKe7 J0FMSTMWK1nd6M+z5N1mghKMOLzbJwbEbTxdYj7KJCohHuroCzFGcuw/LOR0TwW3Vk2TO+HdwLR XanKJ2utnMEcINSDIdQ== X-Authority-Analysis: v=2.4 cv=Zond7d7G c=1 sm=1 tr=0 ts=69e908d4 cx=c_pps a=EVbN6Ke/fEF3bsl7X48z0g==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=s4Kp2nOrnj-iCWvMcIQA:9 a=a_PwQJl-kcHnX1M80qC6:22 X-Proofpoint-GUID: ikKOFH4J3p_5g2b4W1KONFsEzSNJuSk8 X-Proofpoint-ORIG-GUID: ikKOFH4J3p_5g2b4W1KONFsEzSNJuSk8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 suspectscore=0 clxscore=1015 impostorscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" The new DT bindings format describes a cooling device spec with the cooling device node, the id and the mitigation limits. Depending on the version of the DT bindings, in order to bind, check with the device node pointer only or, in addition, the cooling device id. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_of.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index d0d6d6b82d5a..f4628300972e 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -259,16 +259,34 @@ static bool thermal_of_get_cooling_spec(struct device= _node *map_np, int index, =20 of_node_put(cooling_spec.np); =20 - if (cooling_spec.args_count < 2) { - pr_err("wrong reference to cooling device, missing limits\n"); + /* + * There are two formats: + * - Legacy format : <&cdev lower upper> + * - New format : <&cdev of_index lower upper> + * + * With the new format, along with the device node pointer, + * the of_index must match with the cooling device of_index in + * order to bind + */ + if (cooling_spec.args_count < 2 || cooling_spec.args_count > 3) { + pr_err("Invalid number of cooling device parameters\n"); return false; } =20 + if (cooling_spec.args_count =3D=3D 3 && + cooling_spec.args[0] !=3D cdev->of_index) + return false; + if (cooling_spec.np !=3D cdev->np) return false; =20 - c->lower =3D cooling_spec.args[0]; - c->upper =3D cooling_spec.args[1]; + if (cooling_spec.args_count !=3D 3) { + c->lower =3D cooling_spec.args[0]; + c->upper =3D cooling_spec.args[1]; + } else { + c->lower =3D cooling_spec.args[1]; + c->upper =3D cooling_spec.args[2]; + } c->weight =3D weight; =20 return true; --=20 2.43.0 From nobody Wed Jun 17 05:11:04 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FB7239A064 for ; Wed, 22 Apr 2026 17:43:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879831; cv=none; b=gEjngCrIFPThLIrck5sxrjiqzvbN3+oA34Q3I7o5Z0lipb132qHmbi65A0i8i7Ef6UypXA7n8DN1Ii4k1a1gcbyimMYCpM1JXP26Z0RfQd26PqSGkxjQoUAOav2Rcnvea7EThLKbOsOwVREiFUaIMXI6/uKqY4gSveoC15voZGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776879831; c=relaxed/simple; bh=dm5uSfZjDOFedpZSNeguOS6u06pJ3ye7oJgRqKLiuCU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f45R7h0yfI3me15qsHwAzNM7Z6n5OqbFaTktZn6wdVxzxHEHxOo904DSgZffmryX5QlW5ulAy468m3OwaNZMbf5rUz90SNDV9VWCyd7TC38yr66ZWrtqmGGha5BWcV7txhmC/cTjbuPylv1fleDd5gVQwTSlGNInhTBWDRtRW7M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=TU01v89I; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=XGiY2FSN; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="TU01v89I"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="XGiY2FSN" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63MG3vPV122546 for ; Wed, 22 Apr 2026 17:43:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=Fwn1gPn1dWg exJELw0pYUIt7mZC6V4jRPi84i0yHT1w=; b=TU01v89IQIabdiSY5iA1uoB9Czk tZs1gHp7BPuNH27VG1i95qUUPrmNi5byDdwajUk7Y7gX0Y/DWC9XtGFlQ2w8B6l9 9FAPzABojzxLEGVACSfNPAY3lNRLQM717cKNkAJS111fYH3Dj/kH/nxJle0rcwoA FJV3xP4E7oy65WdxhkCCwEr8CbOf2x6ae58LZoNk+t96T/iCIxmIweZrDHUxffFG WyC0MU5UucslyL+EqconSBCeBLoIOxK3rWhTIXIHWMxJW9r/IXNl0EQqUfAXu+uZ IpA/azVOeqZ9yc8R0XIK9R5anVm/A1oSs7kcpRjcZXPqgzv6aQXRPye3MqQ== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dq1h80b8b-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Apr 2026 17:43:48 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-50fb007bc36so71060751cf.3 for ; Wed, 22 Apr 2026 10:43:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776879828; x=1777484628; darn=vger.kernel.org; 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=Fwn1gPn1dWgexJELw0pYUIt7mZC6V4jRPi84i0yHT1w=; b=XGiY2FSNuIC6E8H0rmVyEL9VkCaAyx0jExDFHT2sKP1WGp4S2P87HEwDNqUEaiGgbz z+8Kezcm7oC8j0P0KhHg8CWJyM15jHST0J3W61hXXtEB2bQZ/fNpLxtPxBnD2LxYGtmF oVQjwFKO076KPCsBexTQ3JjFQ53jjrvk+/DVDYzXrahl6EMPW7bFpx/XM7lZVzcKvDoZ bLnU7GFid9PlUHmuNzwTOSCwcqtULRkC1kyH1iCxp1RKsSr5AGp4kW8nGG1yP+NJBiLF uqequShoi2LfzdQtnp8Zn1pNilU/hT5CoMCUu4oquEolkKZDAcNFqH2RTIkLi27ztAWb o7+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776879828; x=1777484628; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Fwn1gPn1dWgexJELw0pYUIt7mZC6V4jRPi84i0yHT1w=; b=U614DiyDkuJS4Er+GV9D5g9a8AKnbE7koNYApYywSLA6/BkGbh5h0knh0s6ntEbhzZ VEH2aBVdTF26NGdv7DhB731G3Rj/z390Vr7HNm0vNqmSaJNWj0xhekcH7xLwkvFZwEzw KezjzSiTdKD5EfgUXWsOfJdgSOHFs3gtPCXyn84EPzjUkZLGl/z3h9AJmRuHKN4hbWrT yRHJmT2DiwVL0y9K6MDExLh0ak/ku7aBXu6ZOcWqgAIYUxElfSNbBLkqJ5MWnA8dycLP 2MH79KZ13E0PWkhxFwlescTq/gjoDCC6d2Mu3k0z2F2pmWaC6dJ/FWD67VvUQNwOPiYW yEAA== X-Forwarded-Encrypted: i=1; AFNElJ+3CjGH9NEcbdfzAiwvS3kfgsdwz0UQ92OWBDWziPfzBRuCgCkwbqv75aJ3AmQxo7aFQ8MaebKJNOAJ9Fs=@vger.kernel.org X-Gm-Message-State: AOJu0YxkLMd41CeR/uUrsNLPOKKMZrtAow53dMnnmHZYCFjeLPv35WVt D7YEOCJDWH/DsG++3QXtLJR8ZvAxJasqoN8NyyHYO6ANrt9Qfg5oazXKmRCTLsEWXlQbsvLrfWY PbpH+zOUOicyMU+F4ak8EUklx5Gnuo9L8HB9l5kVifPxOuTTfdN5sxIhKDOLy3Eh7CnU= X-Gm-Gg: AeBDietNHBxCtB2Ravb6jPfjKDsyrowKk84Y0nV91ANOrl26jfyGALOt3+iQtyw5Xil bq88rMstUj+y4TCDiH3iTtzO5D133N6O8l7iZLIu7Ic1LbR+TwOKhojKKSBQ4WPOF4PB8U8Bu91 ytP4h3fG5+H2vBhus0gi+HEyUpcl+QKiJMR7hgWZmh7wFPXec+qiPaOhkNcupK0UfwymVkb/A99 eakjv3Ebs6TIlCf4npIpnMcB6lM9tdFJ1wxTwsZg4/7Q12XKRvHdp54a6yr6tAVAZ3E/xtwJrfU jc8GY6IwpFcqd5X8YePxWsA7J4qYBAM1HxuykcMyKwzvG9X1E8ntqOsuDsEpu1+s+0IjQI+4kda 44AU2V+DyvvAeDprTZKMTbT+20OWkulV9w0VFlkUxLrFu5NkdMSf3vibtOL1W X-Received: by 2002:ac8:7f4e:0:b0:50f:9c32:509d with SMTP id d75a77b69052e-50f9c3258b7mr167401691cf.60.1776879827658; Wed, 22 Apr 2026 10:43:47 -0700 (PDT) X-Received: by 2002:ac8:7f4e:0:b0:50f:9c32:509d with SMTP id d75a77b69052e-50f9c3258b7mr167401231cf.60.1776879827142; Wed, 22 Apr 2026 10:43:47 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:ae20:597c:99b8:d161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb7a051dsm142511965e9.18.2026.04.22.10.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 10:43:46 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@kernel.org Cc: gaurav.kohli@oss.qualcomm.com, Zhang Rui , Lukasz Luba , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Simona Vetter , Guenter Roeck , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Benson Leung , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Avi Fishman , Tomer Maimon , Tali Perry , Patrick Venture , Nancy Yuen , Benjamin Fair , Heiko Stuebner , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Konrad Dybcio , Amit Daniel Kachhap , Viresh Kumar , Neil Armstrong , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS) Subject: [PATCH v2 12/12] dt-bindings: thermal: cooling-devices: Update support for 3 cells cooling device Date: Wed, 22 Apr 2026 19:43:01 +0200 Message-ID: <20260422174305.2899095-13-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> References: <20260422174305.2899095-1-daniel.lezcano@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIyMDE3MSBTYWx0ZWRfX71Osweh68q3q XlokOqelGFXU6KTsUcalI4RjBPgTNHGENfTXlv1q6zgxpKeDT1EIX5o4FRx+vf3CNqEhZJIkpRy dYROEJIhfQZuXuX0JrZ2Ou1PvDNNQA/CKf0K2fJaFsAPYYIweKFpwGjBPeJz/m3NMkyidu3FcZn EEZXXz+wRNmfH/Qqj2HrvkaD9WpEwuulEGLuNCWefixirkt9UJMhamb0xjViqV+jBFuN/4sTTlD tJXwxmxa7be4cPOCZVUffWZWB1/4LK5KuNjgwdZC9t5QVr3EY0ChKpbxy8mtHiJUVsw0e9qEdaq piTls61ffJCChoQ9ZgXHvpWHNNohkMTbgTHQZcrqlUJeCBxnSRQpgmT/8kZlULnuAPd+phwT5ZF Pf9ZD33+RtAiAKS0n09X0oJV7Nuhn9NGK63VgbgAY4zS4I8gVQf13ugHocciCVRr4yl4BsrtRN7 zQzzDtwDxkgh2oWACag== X-Proofpoint-GUID: aVdPnzpG8C_s9wI3TAmGjTmfQBW5_Y70 X-Authority-Analysis: v=2.4 cv=RaKgzVtv c=1 sm=1 tr=0 ts=69e908d4 cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=xqWC_Br6kY4A:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=WTFSsL86A86x8GNmHn4A:9 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-ORIG-GUID: aVdPnzpG8C_s9wI3TAmGjTmfQBW5_Y70 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-22_02,2026-04-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 priorityscore=1501 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604220171 Content-Type: text/plain; charset="utf-8" From: Gaurav Kohli Extend the thermal cooling device binding to support a 3 cells specifier along with the 2 cells format. Update #cooling-cells property to enum to support both 2 and 3 arguments. Fix pwm-fan.yaml to restrict the number of cells to 'const: 2' Signed-off-by: Gaurav Kohli Signed-off-by: Daniel Lezcano Reviewed-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/hwmon/pwm-fan.yaml | 3 ++- .../bindings/thermal/thermal-cooling-devices.yaml | 8 ++++++-- .../devicetree/bindings/thermal/thermal-zones.yaml | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml b/Documen= tation/devicetree/bindings/hwmon/pwm-fan.yaml index a84cc3a4cfdc..6a24851fd80d 100644 --- a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml +++ b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml @@ -63,7 +63,8 @@ properties: description: The PWM that is used to control the fan. maxItems: 1 =20 - "#cooling-cells": true + "#cooling-cells": + const: 2 =20 required: - compatible diff --git a/Documentation/devicetree/bindings/thermal/thermal-cooling-devi= ces.yaml b/Documentation/devicetree/bindings/thermal/thermal-cooling-device= s.yaml index b9022f1613d8..28f5818f1e60 100644 --- a/Documentation/devicetree/bindings/thermal/thermal-cooling-devices.yaml +++ b/Documentation/devicetree/bindings/thermal/thermal-cooling-devices.yaml @@ -44,10 +44,14 @@ select: true properties: "#cooling-cells": description: - Must be 2, in order to specify minimum and maximum cooling state use= d in + Must be 2 or 3. If 2, specifies minimum and maximum cooling state us= ed in the cooling-maps reference. The first cell is the minimum cooling st= ate and the second cell is the maximum cooling state requested. - const: 2 + If 3, the first cell specifies the thermal mitigation device specifi= er + index for devices that support multiple thermal mitigation mechanism= s. + The two other cells are respectively the minimum cooling state and t= he + maximum cooling state. + enum: [2, 3] =20 additionalProperties: true =20 diff --git a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml b= /Documentation/devicetree/bindings/thermal/thermal-zones.yaml index 0de0a9757ccc..1261ba0e802e 100644 --- a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml +++ b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml @@ -214,7 +214,8 @@ patternProperties: device. Using the THERMAL_NO_LIMIT (-1UL) constant in the cooling-device phandle limit specifier lets the framework use the minimum and maximum cooling state for that cooli= ng - device automatically. + device automatically. If three arguments are specified, + the first argument is the cooling device specifier. =20 contribution: $ref: /schemas/types.yaml#/definitions/uint32 --=20 2.43.0