public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: rafael@kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Amit Kucheria" <amitk@kernel.org>,
	"Zhang Rui" <rui.zhang@intel.com>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	"open list:TEGRA ARCHITECTURE SUPPORT"
	<linux-tegra@vger.kernel.org>
Subject: Re: [PATCH v4 17/19] thermal/tegra: Do not enable the thermal zone, it is already enabled
Date: Wed, 1 Mar 2023 15:29:56 +0100	[thread overview]
Message-ID: <Y/9hZFfRWLNHMbxe@orome> (raw)
In-Reply-To: <20230228112238.2312273-18-daniel.lezcano@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]

On Tue, Feb 28, 2023 at 12:22:36PM +0100, Daniel Lezcano wrote:
> The code enables the thermal zone after setting it up. But the thermal
> zone is already enabled by thermal_of_zone_register() function.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/thermal/tegra/tegra30-tsensor.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c
> index 3506c3f3c474..e38902abf207 100644
> --- a/drivers/thermal/tegra/tegra30-tsensor.c
> +++ b/drivers/thermal/tegra/tegra30-tsensor.c
> @@ -346,7 +346,7 @@ static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts,
>  {
>  	const struct tegra_tsensor_channel *tsc = &ts->ch[id];
>  	struct thermal_zone_device *tzd = tsc->tzd;
> -	int err, hot_trip = 0, crit_trip = 0;
> +	int hot_trip = 0, crit_trip = 0;
>  	u32 val;
>  
>  	if (!tzd) {
> @@ -401,12 +401,6 @@ static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts,
>  	val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG0_INTR_THERMAL_RST_EN, 1);
>  	writel_relaxed(val, tsc->regs + TSENSOR_SENSOR0_CONFIG0);
>  
> -	err = thermal_zone_device_enable(tzd);
> -	if (err) {
> -		dev_err(ts->dev, "ch%u: failed to enable zone: %d\n", id, err);
> -		return err;
> -	}
> -
>  	return 0;
>  }

This function is called in tegra_tsensor_resume() and balances out the
tegra_tsensor_hw_channel() calls from tegra_tsensor_suspend(). If we
remove the call from here, we'll likely end up with the zones disabled
after a resume.

This ends up calling thermal_zone_device_set_mode(), which is a no-op,
basically, if the mode is unchanged, so this seems harmless.

If you need this to change anyway, I suppose we could move the calls to
thermal_zone_device_enable() and move them into suspend/resume instead.
That's a bit tricky to undo in the error recovery paths, but should be
doable.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-03-01 14:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28 11:22 [PATCH v4 00/19] Self-encapsulate the thermal zone device structure Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 01/19] thermal/core: Add a thermal zone 'devdata' accessor Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 02/19] thermal/core: Use the thermal zone 'devdata' accessor in thermal located drivers Daniel Lezcano
2023-03-01 16:20   ` Gole, Dhruva
2023-02-28 11:22 ` [PATCH v4 03/19] thermal/core: Use the thermal zone 'devdata' accessor in hwmon " Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 04/19] thermal/core: Use the thermal zone 'devdata' accessor in remaining drivers Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 05/19] thermal/core: Show a debug message when get_temp() fails Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 06/19] thermal: Remove debug or error messages in get_temp() ops Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 07/19] thermal/hwmon: Do not set no_hwmon before calling thermal_add_hwmon_sysfs() Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 08/19] thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs() Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 09/19] thermal: Don't use 'device' internal thermal zone structure field Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 10/19] thermal/core: Add thermal_zone_device structure 'type' accessor Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 11/19] thermal/drivers/spear: Don't use tz->device but pdev->dev Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 12/19] thermal: Add a thermal zone id accessor Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 13/19] thermal: Use thermal_zone_device_type() accessor Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 14/19] thermal/drivers/da9062: Don't access the thermal zone device fields Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 15/19] thermal/hwmon: Use the thermal_core.h header Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 16/19] thermal/drivers/tegra: Remove unneeded lock when setting a trip point Daniel Lezcano
2023-03-01 14:18   ` Thierry Reding
2023-03-01 14:35     ` Daniel Lezcano
2023-03-02  9:45       ` Thierry Reding
2023-03-02 10:11         ` Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 17/19] thermal/tegra: Do not enable the thermal zone, it is already enabled Daniel Lezcano
2023-03-01 14:29   ` Thierry Reding [this message]
2023-03-01 14:44     ` Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 18/19] thermal/drivers/acerhdf: Make interval setting only at module load time Daniel Lezcano
2023-02-28 11:22 ` [PATCH v4 19/19] thermal/drivers/acerhdf: Remove pointless governor test Daniel Lezcano

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=Y/9hZFfRWLNHMbxe@orome \
    --to=thierry.reding@gmail.com \
    --cc=amitk@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=f.fainelli@gmail.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.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