Skip to content

Commit e49c8ed

Browse files
dlezcanorafaeljw
authored andcommitted
thermal/drivers/int340x: Do not check the thermal zone state
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> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 12ad93a commit e49c8ed

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -503,32 +503,28 @@ static int int3400_thermal_change_mode(struct thermal_zone_device *thermal,
503503
{
504504
struct int3400_thermal_priv *priv = thermal_zone_device_priv(thermal);
505505
int result = 0;
506+
int enabled;
506507

507508
if (!priv)
508509
return -EINVAL;
509510

510-
if (mode != thermal->mode) {
511-
int enabled;
511+
enabled = mode == THERMAL_DEVICE_ENABLED;
512512

513-
enabled = mode == THERMAL_DEVICE_ENABLED;
514-
515-
if (priv->os_uuid_mask) {
516-
if (!enabled) {
517-
priv->os_uuid_mask = 0;
518-
result = set_os_uuid_mask(priv, priv->os_uuid_mask);
519-
}
520-
goto eval_odvp;
513+
if (priv->os_uuid_mask) {
514+
if (!enabled) {
515+
priv->os_uuid_mask = 0;
516+
result = set_os_uuid_mask(priv, priv->os_uuid_mask);
521517
}
522-
523-
if (priv->current_uuid_index < 0 ||
524-
priv->current_uuid_index >= INT3400_THERMAL_MAXIMUM_UUID)
525-
return -EINVAL;
526-
527-
result = int3400_thermal_run_osc(priv->adev->handle,
528-
int3400_thermal_uuids[priv->current_uuid_index],
529-
&enabled);
518+
goto eval_odvp;
530519
}
531520

521+
if (priv->current_uuid_index < 0 ||
522+
priv->current_uuid_index >= INT3400_THERMAL_MAXIMUM_UUID)
523+
return -EINVAL;
524+
525+
result = int3400_thermal_run_osc(priv->adev->handle,
526+
int3400_thermal_uuids[priv->current_uuid_index],
527+
&enabled);
532528
eval_odvp:
533529
evaluate_odvp(priv);
534530

0 commit comments

Comments
 (0)