From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7EDF606A330 for ; Thu, 3 Dec 2026 19:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=lfXc0LzM; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ghpP824O DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=+2jxU/susRha6D02Jue2RywiPxywMzAve1gF9E7lXgs=; b=lfXc0LzMUy5Wnx 67PNlZedHyuU0+xk+at1+HSWf/p3l6ZWX168WLHi1V/6XanSXfdoF7q3MlV+F7FF4f3IIoRZtwsMB ZdlMDemkGjomQ+IsRNnGjgkcOmS+QGWogq8D0mIw0sAy4aCOTVouiuyUCuG09am7zFlGSEcuZNug+ LIiC4Xe+rjhxRaiyhlJRPM5itDEJXkHIZwdvaCFmkg1FC/Tbou0q5l/WyZc82eS+sVLl8grvNxUqU 8p3oIK5LSPyAHEVLUL1LDSmjVFVLoFzPiFzf3fiz9orx8Q9xt7wpl27Iz+nCyfhsmeV1CWaI7tBLe 3IdHpVluB8dVQ3OKuTug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZCuv-0000000FsEQ-2P8D; Thu, 03 Dec 2026 19:56:33 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZCuu-0000000FsEJ-2EPf for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 19:56:32 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id B36E0600CE; Thu, 3 Dec 2026 19:56:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0BAE1F0092C; Thu, 3 Dec 2026 19:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796327791; bh=+2jxU/susRha6D02Jue2RywiPxywMzAve1gF9E7lXgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ghpP824OCmxGVOlwQ6blAOjU+FrN3fL7qKtZEMatc9K1affqakHAujxoNYsldPg6l Ad/TSSTklydOhY4ZY6xDnIsrFU9wwSUu7yRlIhtIV4uwV0nwEKceKeLf+85eFQ7JeU Az8uloGejH/L8CaDySmlYfzATJT803w9SkbbKtuUKvtM2N0iOKpI5kedyp5iQgr29w pjPugUj7rJsy7wNZvgKrQ5a15weYhxgRbuan+SwyBtbxbX1xS/fR6Gxo19+ZjQyCKe 3gs8tZyj4uqk6LqU6aYlmiRZOWrck2C/pCMa2kFBVH+/hmDGshd4YMXeCCUEi0ctvn S7aYlub0NbE8A== From: Lee Jones To: lee@kernel.org, "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Peng Fan , Pengfei Li , linux-pm@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 07/10] thermal/drivers/imx91: Acquire runtime PM reference in imx91_tmu_get_temp() Date: Thu, 3 Dec 2026 19:54:18 +0000 Message-ID: <20261203195529.3063246-8-lee@kernel.org> X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog In-Reply-To: <20261203195529.3063246-1-lee@kernel.org> References: <20261203195529.3063246-1-lee@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The thermal core allows get_temp() to be called via sysfs even when the thermal zone has been disabled and imx91_tmu_change_mode() has dropped the runtime PM reference, gating the TMU clock. Reading IMX91_TMU_DATA0 in imx91_tmu_get_temp() while the clock is disabled causes an unclocked register access. Wrap the register read in imx91_tmu_get_temp() with pm_runtime_resume_and_get() and pm_runtime_put(). Fixes: c411d8bf0699 ("thermal/drivers/imx91: Add support for i.MX91 thermal monitoring unit") Closes: https://sashiko.dev/#/bug/linux-366503cb-0dfd-43b0-9c97-f75af5382e66 Cc: stable@vger.kernel.org Signed-off-by: Lee Jones --- drivers/thermal/imx91_thermal.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/thermal/imx91_thermal.c b/drivers/thermal/imx91_thermal.c index 6d0aba992244..c3a72df665a8 100644 --- a/drivers/thermal/imx91_thermal.c +++ b/drivers/thermal/imx91_thermal.c @@ -110,11 +110,18 @@ static int imx91_tmu_get_temp(struct thermal_zone_device *tz, int *temp) { struct imx91_tmu *tmu = thermal_zone_device_priv(tz); s16 data; + int ret; + + ret = pm_runtime_resume_and_get(tmu->dev); + if (ret < 0) + return ret; /* DATA0 is 16bit signed number */ data = readw_relaxed(tmu->base + IMX91_TMU_DATA0); *temp = imx91_tmu_to_mcelsius(data); + pm_runtime_put(tmu->dev); + return 0; } -- 2.56.1.911.g883d8bcb20-goog