From mboxrd@z Thu Jan 1 00:00:00 1970 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 1F93E32548B for ; Mon, 5 Jan 2026 05:18:14 +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=1767590297; cv=none; b=C2nGoaSU7FpdRQrYntkRNRR54r3RUkxvQgexYBpkH/wLVDHe59NsCNN3vsrgiaggquKQgSU809L6vp8v5CWHA8gz0H6qsxxBZvlqlioP1C8A1h6j0wSxr8peN0kVwaO7S5O/RoBDjsWiZUqrN0N32CMZkQTMDTm9lcNSsmXv6lQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767590297; c=relaxed/simple; bh=ocaou5uR6eFyLDCEvk/W+9q8FiFR/tuh4+NiSKUdqrk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=oP7Rl0x5TV1Srwa2fBRFlXcfANlcfuBiLRqp4fgeGN+ok2Jinnq+RaKQyKfSFHvnqcWNj5I46UzN1yhWYYttn/yZLgrU2/FB1UpHyPuFKW9k5DBwv4jztP1LfgtsJSarmVcqrB8++Bv85Wrcc8qV/6h1+/skZiwyAE5Rc1vw+Fg= 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=W64Vhf15; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=QlrI/Zpb; 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="W64Vhf15"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="QlrI/Zpb" 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 604M01M63747048 for ; Mon, 5 Jan 2026 05:18:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ySWYYDA7v/+DqDVTbnsFBC4H3eWDLGY6h0cEy/G1fDw=; b=W64Vhf15Gvwh6U/R Nz4Iu7uxUo1A3rHLvrlP27g1ZF+zaksSFpgpBBBWQFwVAFMKOeeaP7Vxo+jX8U4Q jh0fj9KQ8qjq3xgNSJr9ryRRnUARCCctUnfEK9XkHvAPZDeiBtBIWCeOcpjyp4tU GIsCesLphflilRp/EJKi3c2TF/74xjrkfT1FGd/Mx4HdiwQ7bmvhcn95n2oAc/t0 I1mHY8yDqwmBt3NEY7M/CtNrXT129lg3D7Q/aBGE6AShZQg1lBBfVxcZpGgjMLj5 BpJU+TsHRgmZBd6EcCRcBKEOSX1x+rIzSLMPdtipCvIPstCniiwkxUA2tUmKxdQd TVqLeQ== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4beuvd37rk-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 05 Jan 2026 05:18:14 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-7b4933bc4aeso13068423b3a.2 for ; Sun, 04 Jan 2026 21:18:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1767590294; x=1768195094; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ySWYYDA7v/+DqDVTbnsFBC4H3eWDLGY6h0cEy/G1fDw=; b=QlrI/ZpbwFgnehkQk7dQ9W2RDJfFm9oFZrUXkjsSzd0qnCmAQMtdMKBaZUibGtLZQA bKH2GY9OC7CzusdzyqdBhNkpdvfaYfMkPygZdvADn1JKga1YbbvjyAKJZEyQ8yXsKdqI 5KgvjL0Iaa3qm5J/O19deuungMXqDtZbuvkbTST6oQBwENTMfkckBtl5Xq73A77cwYvH N2cfi8mVHRrF4+zMsPGLwvgcrOfFslC8olpo+9QOzjHgrTfJscBT73Nyjp0aOjT2zEzD IkMSOanoCXkkda7hiLECxkTkXHRRHfyrXK8lC0MzV3fM9PiOEb5XsfippCL5SCIbZzkW 5KGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767590294; x=1768195094; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ySWYYDA7v/+DqDVTbnsFBC4H3eWDLGY6h0cEy/G1fDw=; b=NlKrlBfSs1Oo3Msznt4Nk9qRGXHhq9s3O57bcW/9/SL9XOXZonJgqe4NcvOxc1MtH5 LYTp1cmEJTWqc51nD7W3GYB7wRLE5jU3kJTYtX/ihL19TlrZCQgobW2gXHtQZa+dnnoF 252Doj9sttCp6hwxgeOQt4AT8W/QfPgaliry9nJXZT8Vz3KDfY4yE2hB+hyngHmp8MAf IzzCjo6Bib7ZhoMNVF8uEUMIqTjqgUvLmBIY7UcZqta59TYqs0repJBpIjrIXsjG246S GVhtISmJOz08MQ70jmPU9lrtyxOn8MnA+42QkmT15enR9bq+6ebj7qECc2aNgbP7HP+6 Fmig== X-Forwarded-Encrypted: i=1; AJvYcCV2C4z1GvmbXGVYp9totPVLxkHPJYWImLabP2/9KXIkh34+vt7NeCO6C+ObMD89ueucLxZEp30tke3d/+E=@vger.kernel.org X-Gm-Message-State: AOJu0Yyl9AitmLVdJNgLoCTCePP05KQ4zD1Lsjljo4fFkGSb8QB9tn4h N2YSnOQ8cz1zORbgfS1Rx+a1KXd1keZM5uUcVo8R5TGYoMROOmSwfEpY85piW4j1TNmka9uVQHs O2pfGsL26Rgus7FqvNHRukaYpfx1ECZAjaSSek7aFZm6JBY3gQqLIoibEQ2aw/koBImQ= X-Gm-Gg: AY/fxX60VmXQXnChy8x8ZwlSJ68PbYuTfRIAddtB0HS6GTvSyq3YwiQ9MqHVJnbP3TG RFQHL4/jkDtMPd7tdkYI50cVo+fzmPeQU7znwo3rSuGw2VyAESA+Oq97PMUYryumh3zoB4AJPUb bA1mfa6hQe1agtGoRHO4cSHNVE20aC91sXpoYmiYKbumUcKYNEb311ZsbQNLjIUreYu4VaCpeCu 9eC6zJtDSAL9BC3h+STZoYT0SviQp9OXoxeUpaqR/25/JjUrIqknvTpRWK7a9OjkxdQ8AJRS609 ZcrseiLRYID/VURazlxFpnyDorvTBSeklhx/KRXbeemy6QzCi9KS8ClyoZ7w7Qhd5tHTCgxiNuP t1SIv3HmIRUIe7K63qmQrqKPJlNEm57IRu63IzJg= X-Received: by 2002:a05:6a00:1f14:b0:7b7:90de:e191 with SMTP id d2e1a72fcca58-7ff654b812amr42406337b3a.23.1767590291744; Sun, 04 Jan 2026 21:18:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDvDRzL24Mlqqr/cKwCquOpoKNcLxSMnfZt+iAz84l0KGwgDEtrHlB770xXA5wUiUtm3pZyQ== X-Received: by 2002:a05:6a00:1f14:b0:7b7:90de:e191 with SMTP id d2e1a72fcca58-7ff654b812amr42406323b3a.23.1767590291190; Sun, 04 Jan 2026 21:18:11 -0800 (PST) Received: from [10.218.27.120] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7ff7e48f26asm45872005b3a.52.2026.01.04.21.18.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Jan 2026 21:18:10 -0800 (PST) Message-ID: Date: Mon, 5 Jan 2026 10:48:04 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/8] thermal: Add Remote Proc cooling driver To: Bjorn Andersson Cc: mathieu.poirier@linaro.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, rafael@kernel.org, daniel.lezcano@linaro.org, rui.zhang@intel.com, lukasz.luba@arm.com, konradybcio@kernel.org, amitk@kernel.org, mani@kernel.org, casey.connolly@linaro.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Amit Kucheria References: <20251223123227.1317244-1-gaurav.kohli@oss.qualcomm.com> <20251223123227.1317244-2-gaurav.kohli@oss.qualcomm.com> Content-Language: en-US From: Gaurav Kohli In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: UtqynZF-E1NX5CXqvW012XTQtbGMDNuk X-Proofpoint-GUID: UtqynZF-E1NX5CXqvW012XTQtbGMDNuk X-Authority-Analysis: v=2.4 cv=OuhCCi/t c=1 sm=1 tr=0 ts=695b4996 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=7CQSdrXTAAAA:8 a=evdxb9anZX7H7y_a-x0A:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 a=a-qgeE7W1pNrGK8U0ZQC:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTA1MDA0NyBTYWx0ZWRfX4BmKRYHMyMlP P4O1WWjxftkeCF3at7e6QFb68BMVexJvcXoXRxhb4KYCORbQ2ZbJRYmTzEBGSPpgouCPyahmxY8 ejoHbN1T9UrcyNzAUIAJGk5tHVmJ2eDBK6s5PZDOc8uvZCKOST8jG5Qqsvcce1NBNGZ7SCwTQsr iJsWYl2lxDzT8ZHyDTf/Y8wwNTwFpZSr6+vOfnsBI3akadVNNPFjoZibF4OwN1dw9fhe7Nz8+r2 tIynzsXOdIFTg2OJRmAwbf/YNdf7TfS+T9cceJBVocIG3gRsB48hLpAKuTmsCGYq+5aYwx1qsNw RoFDBfXTT0cgdRxNtiWu8K4KjVu6lUuQtBGjP/6srQpYWq8y0CESWTWMBXXswJebQPdUalqdFgg 7vsQE04/NVsXBv74dbBwMi3WvVXOhpsnX2H3ngArgInSleeFXHAqfixkjqnvevhHUIkC3I7jBxW 97nDw/lTphTi9VrtTug== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-04_07,2025-12-31_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 impostorscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 suspectscore=0 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2601050047 On 1/3/2026 8:35 PM, Bjorn Andersson wrote: > On Tue, Dec 23, 2025 at 06:02:20PM +0530, Gaurav Kohli wrote: >> Add a new generic driver for thermal cooling devices that control >> remote processors (modem, DSP, etc.) through various communication >> channels. >> >> This driver provides an abstraction layer between the thermal >> subsystem and vendor-specific remote processor communication >> mechanisms. >> >> Suggested-by: Amit Kucheria >> Signed-off-by: Gaurav Kohli >> --- >> MAINTAINERS | 8 ++ >> drivers/thermal/Kconfig | 11 ++ >> drivers/thermal/Makefile | 2 + >> drivers/thermal/remoteproc_cooling.c | 154 +++++++++++++++++++++++++++ >> include/linux/remoteproc_cooling.h | 52 +++++++++ >> 5 files changed, 227 insertions(+) >> create mode 100644 drivers/thermal/remoteproc_cooling.c >> create mode 100644 include/linux/remoteproc_cooling.h >> >> diff --git a/MAINTAINERS b/MAINTAINERS >> index 679e5f11e672..c1ba87315cdf 100644 >> --- a/MAINTAINERS >> +++ b/MAINTAINERS >> @@ -25935,6 +25935,14 @@ F: drivers/thermal/cpufreq_cooling.c >> F: drivers/thermal/cpuidle_cooling.c >> F: include/linux/cpu_cooling.h >> >> +THERMAL/REMOTEPROC_COOLING >> +M: Gaurav Kohli >> +L: linux-pm@vger.kernel.org >> +S: Supported >> +F: drivers/thermal/remoteproc_cooling.c >> +F: include/linux/remoteproc_cooling.h >> + >> + > Two empty lines here... thanks, will fix. > >> THERMAL/POWER_ALLOCATOR >> M: Lukasz Luba >> L: linux-pm@vger.kernel.org >> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig >> index b10080d61860..31e92be34387 100644 >> --- a/drivers/thermal/Kconfig >> +++ b/drivers/thermal/Kconfig >> @@ -229,6 +229,17 @@ config PCIE_THERMAL >> >> If you want this support, you should say Y here. >> >> + > And two here... > >> +config REMOTEPROC_THERMAL >> + bool "Remote processor cooling support" >> + help >> + This implements a generic cooling mechanism for remote processors >> + (modem, DSP, etc.) that allows vendor-specific implementations to >> + register thermal cooling devices and provide callbacks for thermal >> + mitigation. >> + >> + If you want this support, you should say Y here. >> + >> config THERMAL_EMULATION >> bool "Thermal emulation mode support" >> help >> diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile >> index bb21e7ea7fc6..ae747dde54fe 100644 >> --- a/drivers/thermal/Makefile >> +++ b/drivers/thermal/Makefile >> @@ -34,6 +34,8 @@ thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o >> >> thermal_sys-$(CONFIG_PCIE_THERMAL) += pcie_cooling.o >> >> +thermal_sys-$(CONFIG_REMOTEPROC_THERMAL) += remoteproc_cooling.o >> + >> obj-$(CONFIG_K3_THERMAL) += k3_bandgap.o k3_j72xx_bandgap.o >> # platform thermal drivers >> obj-y += broadcom/ >> diff --git a/drivers/thermal/remoteproc_cooling.c b/drivers/thermal/remoteproc_cooling.c >> new file mode 100644 >> index 000000000000..a1f948cbde0f >> --- /dev/null >> +++ b/drivers/thermal/remoteproc_cooling.c >> @@ -0,0 +1,154 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * Remote Processor Cooling Device >> + * >> + * Copyright (c) 2025, Qualcomm Innovation Center, Inc. All rights reserved. > No, that's not the right one. will update this. > >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#define REMOTEPROC_PREFIX "rproc_" >> + >> +struct remoteproc_cooling_ops { >> + int (*get_max_level)(void *devdata, unsigned long *level); >> + int (*get_cur_level)(void *devdata, unsigned long *level); >> + int (*set_cur_level)(void *devdata, unsigned long level); >> +}; >> + >> +/** >> + * struct remoteproc_cdev - Remote processor cooling device >> + * @cdev: Thermal cooling device handle >> + * @ops: Vendor-specific operation callbacks >> + * @devdata: Private data for vendor implementation >> + * @np: Device tree node associated with this cooling device >> + * @lock: Mutex to protect cooling device operations >> + */ >> +struct remoteproc_cdev { >> + struct thermal_cooling_device *cdev; >> + const struct remoteproc_cooling_ops *ops; >> + void *devdata; >> + struct device_node *np; > This is a local variable in remoteproc_cooling_register(). > >> + struct mutex lock; >> +}; >> + >> + >> +/* Thermal cooling device callbacks */ >> + >> +static int remoteproc_get_max_state(struct thermal_cooling_device *cdev, >> + unsigned long *state) >> +{ >> + struct remoteproc_cdev *rproc_cdev = cdev->devdata; >> + int ret; >> + >> + if (!rproc_cdev || !rproc_cdev->ops) > How is this possible? Is there some race condition or something that you > need to guard against? Ideally this can be controlled from the calling driver only, so i can remove this. > >> + return -EINVAL; >> + >> + mutex_lock(&rproc_cdev->lock); >> + ret = rproc_cdev->ops->get_max_level(rproc_cdev->devdata, state); >> + mutex_unlock(&rproc_cdev->lock); >> + >> + return ret; >> +} >> + >> +static int remoteproc_get_cur_state(struct thermal_cooling_device *cdev, >> + unsigned long *state) >> +{ >> + struct remoteproc_cdev *rproc_cdev = cdev->devdata; >> + int ret; >> + >> + if (!rproc_cdev || !rproc_cdev->ops) >> + return -EINVAL; >> + >> + mutex_lock(&rproc_cdev->lock); >> + ret = rproc_cdev->ops->get_cur_level(rproc_cdev->devdata, state); >> + mutex_unlock(&rproc_cdev->lock); >> + >> + return ret; >> +} >> + >> +static int remoteproc_set_cur_state(struct thermal_cooling_device *cdev, >> + unsigned long state) >> +{ >> + struct remoteproc_cdev *rproc_cdev = cdev->devdata; >> + int ret; >> + >> + if (!rproc_cdev || !rproc_cdev->ops) >> + return -EINVAL; >> + >> + mutex_lock(&rproc_cdev->lock); >> + ret = rproc_cdev->ops->set_cur_level(rproc_cdev->devdata, state); >> + mutex_unlock(&rproc_cdev->lock); >> + >> + return ret; >> +} >> + >> +static const struct thermal_cooling_device_ops remoteproc_cooling_ops = { >> + .get_max_state = remoteproc_get_max_state, >> + .get_cur_state = remoteproc_get_cur_state, >> + .set_cur_state = remoteproc_set_cur_state, >> +}; >> + >> +struct remoteproc_cdev * >> +remoteproc_cooling_register(struct device_node *np, >> + const char *name, const struct remoteproc_cooling_ops *ops, >> + void *devdata) >> +{ >> + struct remoteproc_cdev *rproc_cdev; >> + struct thermal_cooling_device *cdev; >> + int ret; >> + >> + if (!name || !ops) { >> + return ERR_PTR(-EINVAL); >> + } >> + >> + rproc_cdev = kzalloc(sizeof(*rproc_cdev), GFP_KERNEL); >> + if (!rproc_cdev) >> + return ERR_PTR(-ENOMEM); >> + >> + rproc_cdev->ops = ops; >> + rproc_cdev->devdata = devdata; >> + rproc_cdev->np = np; >> + mutex_init(&rproc_cdev->lock); >> + >> + char *rproc_name __free(kfree) = >> + kasprintf(GFP_KERNEL, REMOTEPROC_PREFIX "%s", name); >> + /* Register with thermal framework */ > Technically it's "Optionally register with thermal framework" but that's > immediately understood by the name of the function you're calling. What > isn't clear, and where a comment would be beneficial would be to > document why it's optional (or rather conditional on np). Sure will add comment. > >> + if (np) { >> + cdev = thermal_of_cooling_device_register(np, rproc_name, rproc_cdev, >> + &remoteproc_cooling_ops); >> + } >> + >> + if (IS_ERR(cdev)) { >> + ret = PTR_ERR(cdev); >> + goto free_rproc_cdev; >> + } >> + >> + rproc_cdev->cdev = cdev; >> + >> + return rproc_cdev; >> + >> +free_rproc_cdev: >> + kfree(rproc_cdev); >> + return ERR_PTR(ret); >> +} >> +EXPORT_SYMBOL_GPL(remoteproc_cooling_register); >> + >> +void remoteproc_cooling_unregister(struct remoteproc_cdev *rproc_cdev) >> +{ >> + if (!rproc_cdev) >> + return; >> + >> + thermal_cooling_device_unregister(rproc_cdev->cdev); >> + mutex_destroy(&rproc_cdev->lock); >> + kfree(rproc_cdev); >> +} >> +EXPORT_SYMBOL_GPL(remoteproc_cooling_unregister); >> + >> +MODULE_LICENSE("GPL"); >> +MODULE_DESCRIPTION("Remote Processor Cooling Device"); >> diff --git a/include/linux/remoteproc_cooling.h b/include/linux/remoteproc_cooling.h >> new file mode 100644 >> index 000000000000..ef94019d220d >> --- /dev/null >> +++ b/include/linux/remoteproc_cooling.h >> @@ -0,0 +1,52 @@ >> +/* SPDX-License-Identifier: GPL-2.0 */ >> +/* >> + * Remote Processor Cooling Device >> + * >> + * Copyright (c) 2025, Qualcomm Innovation Center > That was never the right one. > >> + */ >> + >> +#ifndef __REMOTEPROC_COOLING_H__ >> +#define __REMOTEPROC_COOLING_H__ >> + >> +#include >> + >> +struct device; >> +struct device_node; >> + >> +struct remoteproc_cooling_ops { >> + int (*get_max_level)(void *devdata, unsigned long *level); >> + int (*get_cur_level)(void *devdata, unsigned long *level); >> + int (*set_cur_level)(void *devdata, unsigned long level); >> +}; >> + >> +struct remoteproc_cdev; >> + >> +#ifdef CONFIG_REMOTEPROC_THERMAL >> + >> +struct remoteproc_cdev * >> +remoteproc_cooling_register(struct device_node *np, >> + const char *name, >> + const struct remoteproc_cooling_ops *ops, >> + void *devdata); >> + >> +void remoteproc_cooling_unregister(struct remoteproc_cdev *rproc_cdev); >> + >> +#else /* !CONFIG_REMOTEPROC_THERMAL */ >> + >> +static inline struct remoteproc_cdev * >> +remoteproc_cooling_register(struct device_node *np, >> + const char *name, >> + const struct remoteproc_cooling_ops *ops, >> + void *devdata) >> +{ >> + return ERR_PTR(-EINVAL); > This means that if I build my kernel with CONFIG_REMOTEPROC_THERMAL=n it > will not just disable remoteproc thermal management, but my remoteproc > driver will stop probing. > > The remoteproc thermal feature isn't critical to the remtoeproc, so > wouldn't it make more sense to return 0 here and let the remoteproc > continue to operate in such configuration? Yes it will work, as probe of this child node won't impact the remote proc probe, as we are not returning error condition there during of_platform_populate. But yes, this should not block remote proc probe in any condition, so return 0 is more better option. will update this. > > Regards, > Bjorn > >> +} >> + >> +static inline void >> +remoteproc_cooling_unregister(struct remoteproc_cdev *rproc_cdev) >> +{ >> +} >> + >> +#endif /* CONFIG_REMOTEPROC_THERMAL */ >> + >> +#endif /* __REMOTEPROC_COOLING_H__ */ >> -- >> 2.34.1 >>