Skip to content

Commit 45ec836

Browse files
committed
thermal: core: Drop thermal_zone_device_is_enabled()
JIRA: https://issues.redhat.com/browse/RHEL-61357 commit 54fccad Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Date: Mon Aug 26 18:37:16 2024 +0200 thermal: core: Drop thermal_zone_device_is_enabled() There are only two callers of thermal_zone_device_is_enabled() and one of them call is under the zone lock and the other one uses lockdep_assert_held() on that lock. Thus the lockdep_assert_held() in thermal_zone_device_is_enabled() is redundant and it could be dropped, but then the function would merely become a wrapper around a simple tz->mode check that is more convenient to do directly. Accordingly, drop thermal_zone_device_is_enabled() altogether and update its callers to check tz->mode directly as appropriate. While at it, combine the tz->mode and tz->suspended checks in __thermal_zone_device_update() because they are of a similar category and if any of them evaluates to "true", the outcome is the same. No intentinal functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/9353673.CDJkKcVGEf@rjwysocki.net Signed-off-by: David Arcari <darcari@redhat.com>
1 parent b6c59cd commit 45ec836

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

drivers/thermal/thermal_core.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,7 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
547547
int low = -INT_MAX, high = INT_MAX;
548548
int temp, ret;
549549

550-
if (tz->suspended)
551-
return;
552-
553-
if (!thermal_zone_device_is_enabled(tz))
550+
if (tz->suspended || tz->mode != THERMAL_DEVICE_ENABLED)
554551
return;
555552

556553
ret = __thermal_zone_get_temp(tz, &temp);
@@ -652,13 +649,6 @@ int thermal_zone_device_disable(struct thermal_zone_device *tz)
652649
}
653650
EXPORT_SYMBOL_GPL(thermal_zone_device_disable);
654651

655-
int thermal_zone_device_is_enabled(struct thermal_zone_device *tz)
656-
{
657-
lockdep_assert_held(&tz->lock);
658-
659-
return tz->mode == THERMAL_DEVICE_ENABLED;
660-
}
661-
662652
static bool thermal_zone_is_present(struct thermal_zone_device *tz)
663653
{
664654
return !list_empty(&tz->node);

drivers/thermal/thermal_core.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,4 @@ thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev,
287287
unsigned long new_state) {}
288288
#endif /* CONFIG_THERMAL_STATISTICS */
289289

290-
/* device tree support */
291-
int thermal_zone_device_is_enabled(struct thermal_zone_device *tz);
292-
293290
#endif /* __THERMAL_CORE_H__ */

drivers/thermal/thermal_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ mode_show(struct device *dev, struct device_attribute *attr, char *buf)
5353
int enabled;
5454

5555
mutex_lock(&tz->lock);
56-
enabled = thermal_zone_device_is_enabled(tz);
56+
enabled = tz->mode == THERMAL_DEVICE_ENABLED;
5757
mutex_unlock(&tz->lock);
5858

5959
return sprintf(buf, "%s\n", enabled ? "enabled" : "disabled");

0 commit comments

Comments
 (0)