public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Luca Weiss <luca.weiss@fairphone.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Daniel Lezcano" <daniel.lezcano@linaro.org>,
	"Zhang Rui" <rui.zhang@intel.com>,
	"Lukasz Luba" <lukasz.luba@arm.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Laxman Dewangan" <ldewangan@nvidia.com>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Hans de Goede" <hansg@kernel.org>,
	"Jens Reidel" <adrian@mainlining.org>,
	"Casey Connolly" <casey.connolly@linaro.org>,
	~postmarketos/upstreaming@lists.sr.ht,
	phone-devel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 3/5] thermal/drivers/generic-adc: Allow probe without TZ registration
Date: Fri, 20 Feb 2026 12:50:14 +0200	[thread overview]
Message-ID: <aZg8ZqckhGbvkdel@smile.fi.intel.com> (raw)
In-Reply-To: <20260220-bat-temp-adc-v2-3-fe34ed4ea851@fairphone.com>

On Fri, Feb 20, 2026 at 10:19:07AM +0100, Luca Weiss wrote:
> If the devicetree node is not referenced in a zone under /thermal-zones,
> devm_thermal_of_zone_register will fail with -ENODEV.

devm_thermal_of_zone_register()

> Since the driver is now also registering as an IIO device[0], allow the
> probe to continue without the thermal zone.

Isn't it dangerous?

> We also can't use gadc_thermal_get_temp anymore because we haven't

gadc_thermal_get_temp()

> necessarily initialized tz_dev.

> [0] commit 3762f5851ac5 ("thermal/drivers/thermal-generic-adc: Add temperature sensor channel")

You can make it a Link tag:

Link: https://git.kernel.org/torvalds/c/3762f5851ac5 [0]

> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>

...

>  	if (IS_ERR(gti->tz_dev)) {
>  		ret = PTR_ERR(gti->tz_dev);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(dev,
> -				"Thermal zone sensor register failed: %d\n",
> -				ret);
> -		return ret;
> -	}
> +		if (ret == -EPROBE_DEFER)
> +			return ret;

I believe it's better to return all possible errors. If you see the
similarities with regulator APIs, then use an explicit check for -ENODEV.

> -	devm_thermal_add_hwmon_sysfs(dev, gti->tz_dev);
> +		dev_info(dev, "Thermal zone sensor register failed: %d\n",
> +			 ret);
> +	} else {
> +		devm_thermal_add_hwmon_sysfs(dev, gti->tz_dev);
> +	}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-02-20 10:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20  9:19 [PATCH v2 0/5] Battery temperature ADC plumbing on Qualcomm platforms Luca Weiss
2026-02-20  9:19 ` [PATCH v2 1/5] iio: adc: qcom-spmi-adc5: Add battery thermal channels Luca Weiss
2026-02-20  9:19 ` [PATCH v2 2/5] dt-bindings: thermal: generic-adc: Document #io-channel-cells Luca Weiss
2026-02-23 18:48   ` Rob Herring
2026-02-24  8:14     ` Luca Weiss
2026-02-20  9:19 ` [PATCH v2 3/5] thermal/drivers/generic-adc: Allow probe without TZ registration Luca Weiss
2026-02-20 10:50   ` Andy Shevchenko [this message]
2026-02-20 11:31     ` Luca Weiss
2026-02-20 13:43       ` Andy Shevchenko
2026-02-20  9:19 ` [PATCH v2 4/5] arm64: dts: qcom: pm7250b: Define battery temperature ADC channels Luca Weiss
2026-02-20  9:57   ` Konrad Dybcio
2026-02-20  9:19 ` [PATCH v2 5/5] arm64: dts: qcom: sm7225-fairphone-fp4: Add battery temperature node Luca Weiss
2026-02-20 10:00   ` Konrad Dybcio
2026-02-20 10:40     ` Luca Weiss
2026-02-20 10:51       ` Konrad Dybcio
2026-02-20 11:26         ` Luca Weiss
2026-02-21  2:49           ` Dmitry Baryshkov
2026-02-23  7:50             ` Luca Weiss
2026-02-23 19:05               ` Dmitry Baryshkov
2026-02-20 11:58 ` [PATCH v2 0/5] Battery temperature ADC plumbing on Qualcomm platforms Hans de Goede

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=aZg8ZqckhGbvkdel@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=adrian@mainlining.org \
    --cc=andersson@kernel.org \
    --cc=andy@kernel.org \
    --cc=casey.connolly@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=hansg@kernel.org \
    --cc=jic23@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=ldewangan@nvidia.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=luca.weiss@fairphone.com \
    --cc=lukasz.luba@arm.com \
    --cc=nuno.sa@analog.com \
    --cc=phone-devel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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