From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: daniel.lezcano@linaro.org, rafael@kernel.org
Cc: linux-pm@vger.kernel.org, thierry.reding@gmail.com,
linux-kernel@vger.kernel.org,
srinivas.pandruvada@linux.intel.com,
Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
Dhruva Gole <d-gole@ti.com>, Heiko Stuebner <heiko@sntech.de>,
"Lee, Chun-Yi" <joeyli.kernel@gmail.com>,
ye xingchen <ye.xingchen@zte.com.cn>
Subject: [PATCH v2 4/4] thermal/drivers/int340x: Do not check the thermal zone state
Date: Fri, 7 Jul 2023 22:37:31 +0200 [thread overview]
Message-ID: <20230707203731.848188-5-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <20230707203731.848188-1-daniel.lezcano@linaro.org>
The driver is accessing the thermal zone state to ensure the state is
different from the one we want to set.
We don't want the driver to access the thermal zone device internals.
Actually, the thermal core code already checks if the thermal zone's
state is different before calling this function, thus this check is
duplicate.
Remove it.
Acked-by: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
.../intel/int340x_thermal/int3400_thermal.c | 32 ++++++++-----------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index 72a6e28ded2e..c40b03d6c29f 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -503,32 +503,28 @@ static int int3400_thermal_change_mode(struct thermal_zone_device *thermal,
{
struct int3400_thermal_priv *priv = thermal_zone_device_priv(thermal);
int result = 0;
+ int enabled;
if (!priv)
return -EINVAL;
- if (mode != thermal->mode) {
- int enabled;
+ enabled = mode == THERMAL_DEVICE_ENABLED;
- enabled = mode == THERMAL_DEVICE_ENABLED;
-
- if (priv->os_uuid_mask) {
- if (!enabled) {
- priv->os_uuid_mask = 0;
- result = set_os_uuid_mask(priv, priv->os_uuid_mask);
- }
- goto eval_odvp;
+ if (priv->os_uuid_mask) {
+ if (!enabled) {
+ priv->os_uuid_mask = 0;
+ result = set_os_uuid_mask(priv, priv->os_uuid_mask);
}
-
- if (priv->current_uuid_index < 0 ||
- priv->current_uuid_index >= INT3400_THERMAL_MAXIMUM_UUID)
- return -EINVAL;
-
- result = int3400_thermal_run_osc(priv->adev->handle,
- int3400_thermal_uuids[priv->current_uuid_index],
- &enabled);
+ goto eval_odvp;
}
+ if (priv->current_uuid_index < 0 ||
+ priv->current_uuid_index >= INT3400_THERMAL_MAXIMUM_UUID)
+ return -EINVAL;
+
+ result = int3400_thermal_run_osc(priv->adev->handle,
+ int3400_thermal_uuids[priv->current_uuid_index],
+ &enabled);
eval_odvp:
evaluate_odvp(priv);
--
2.34.1
next prev parent reply other threads:[~2023-07-07 20:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 20:37 [PATCH v2 0/4] One more step to the thermal zone structure encapsulation Daniel Lezcano
2023-07-07 20:37 ` [PATCH v2 1/4] thermal/core: Hardening the self-encapsulation Daniel Lezcano
2023-07-07 20:37 ` [PATCH v2 2/4] thermal/core: Reorder the headers inclusion Daniel Lezcano
2023-07-07 20:37 ` [PATCH v2 3/4] thermal/drivers/int3400: Use thermal zone device wrappers Daniel Lezcano
2023-07-07 20:37 ` Daniel Lezcano [this message]
2023-07-13 9:33 ` [PATCH v2 0/4] One more step to the thermal zone structure encapsulation Daniel Lezcano
2023-07-13 11:30 ` Rafael J. Wysocki
2023-07-13 12:24 ` Daniel Lezcano
2023-07-13 13:02 ` Rafael J. Wysocki
2023-07-13 14:15 ` 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=20230707203731.848188-5-daniel.lezcano@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amitk@kernel.org \
--cc=d-gole@ti.com \
--cc=heiko@sntech.de \
--cc=joeyli.kernel@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=thierry.reding@gmail.com \
--cc=ye.xingchen@zte.com.cn \
/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;
as well as URLs for NNTP newsgroup(s).