Linux Power Management development
 help / color / mirror / Atom feed
From: Paul Hollinsky <phollinsky@holtechnik.com>
To: Amit Kucheria <amitk@kernel.org>,
	Thara Gopinath <thara.gopinath@gmail.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@kernel.org>
Cc: Paul Hollinsky <phollinsky@holtechnik.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Andy Shevchenko <andy@kernel.org>,
	Hans de Goede <hansg@kernel.org>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH] thermal: qcom-spmi-adc-tm5: fix all temperature reads failing with -EINVAL
Date: Fri,  7 Aug 2026 19:39:37 -0700	[thread overview]
Message-ID: <20260808023938.57146-1-phollinsky@holtechnik.com> (raw)

adc_tm5_get_temp() rejects any iio_read_channel_processed() return value
that is not IIO_VAL_INT. Since commit bb21ee31f575 ("iio: Fix
iio_multiply_value use in iio_read_channel_processed_scale"),
iio_read_channel_processed() returns 0 on success, per its documented
contract, instead of passing through the value type from the underlying
read.

Since IIO_VAL_INT is 1, every successful read now takes the error path,
so get_temp() returns -EINVAL unconditionally and every ADC-TM5 thermal
zone is dead: with no valid temperature readings the core cannot
evaluate trip points. Observed on a SC7180 Trogdor Chromebook (Lenovo
IdeaPad Duet 3 / wormdingler), where the charger and skin-temp zones
report an error on every read.

The check no longer serves its original defensive purpose either: since
commit 05f958d003c9 ("iio: Improve iio_read_channel_processed_scale()
precision"), fractional value types are folded into the integer result
by iio_multiply_value() inside the IIO core, so the return value carries
no information beyond success or failure. Just drop the check and rely
on the ret < 0 test above it.

qcom-spmi-adc-tm5 is the only iio_read_channel_processed() consumer in
tree still testing the return value this way.

Fixes: bb21ee31f575 ("iio: Fix iio_multiply_value use in iio_read_channel_processed_scale")
Cc: stable@vger.kernel.org # 6.18+
Signed-off-by: Paul Hollinsky <phollinsky@holtechnik.com>
---
 drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
index bb6222c8cc5f..af72db6299cd 100644
--- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
+++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
@@ -369,9 +369,6 @@ static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp)
 	if (ret < 0)
 		return ret;
 
-	if (ret != IIO_VAL_INT)
-		return -EINVAL;
-
 	return 0;
 }
 
-- 
2.55.0


                 reply	other threads:[~2026-08-08  2:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260808023938.57146-1-phollinsky@holtechnik.com \
    --to=phollinsky@holtechnik.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=amitk@kernel.org \
    --cc=andy@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=hansg@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=thara.gopinath@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox