Skip to content

Commit 53389ed

Browse files
committed
Merge branch 'thermal-core'
Merge additional thermal core and ACPI thermal changes for 6.4-rc1: - Clean up the step-wise thermal governor (Zhang Rui). - Introduce thermal_zone_device() for accessing the device field of struct thermal_zone_device and two drivers use it (Daniel Lezcano). - Clean up the ACPI thermal driver a bit (Daniel Lezcano). - Delete the thermal driver for Intel Menlow platforms that is not expected to have any users (Rafael Wysocki). * thermal-core: thermal: intel: menlow: Get rid of this driver ACPI: thermal: Move to dedicated function sysfs extra attr creation ACPI: thermal: Use thermal_zone_device() thermal: intel: pch_thermal: Use thermal driver device to write a trace thermal: core: Encapsulate tz->device field thermal: gov_step_wise: Adjust code logic to match comment thermal: gov_step_wise: Delete obsolete comment
2 parents dd23583 + 2b6a740 commit 53389ed

8 files changed

Lines changed: 46 additions & 568 deletions

File tree

drivers/acpi/thermal.c

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,32 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = {
787787
.critical = acpi_thermal_zone_device_critical,
788788
};
789789

790+
static int acpi_thermal_zone_sysfs_add(struct acpi_thermal *tz)
791+
{
792+
struct device *tzdev = thermal_zone_device(tz->thermal_zone);
793+
int ret;
794+
795+
ret = sysfs_create_link(&tz->device->dev.kobj,
796+
&tzdev->kobj, "thermal_zone");
797+
if (ret)
798+
return ret;
799+
800+
ret = sysfs_create_link(&tzdev->kobj,
801+
&tz->device->dev.kobj, "device");
802+
if (ret)
803+
sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
804+
805+
return ret;
806+
}
807+
808+
static void acpi_thermal_zone_sysfs_remove(struct acpi_thermal *tz)
809+
{
810+
struct device *tzdev = thermal_zone_device(tz->thermal_zone);
811+
812+
sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
813+
sysfs_remove_link(&tzdev->kobj, "device");
814+
}
815+
790816
static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
791817
{
792818
int trips = 0;
@@ -820,21 +846,15 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
820846
if (IS_ERR(tz->thermal_zone))
821847
return -ENODEV;
822848

823-
result = sysfs_create_link(&tz->device->dev.kobj,
824-
&tz->thermal_zone->device.kobj, "thermal_zone");
849+
result = acpi_thermal_zone_sysfs_add(tz);
825850
if (result)
826851
goto unregister_tzd;
827852

828-
result = sysfs_create_link(&tz->thermal_zone->device.kobj,
829-
&tz->device->dev.kobj, "device");
830-
if (result)
831-
goto remove_tz_link;
832-
833853
status = acpi_bus_attach_private_data(tz->device->handle,
834854
tz->thermal_zone);
835855
if (ACPI_FAILURE(status)) {
836856
result = -ENODEV;
837-
goto remove_dev_link;
857+
goto remove_links;
838858
}
839859

840860
result = thermal_zone_device_enable(tz->thermal_zone);
@@ -848,10 +868,8 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
848868

849869
acpi_bus_detach:
850870
acpi_bus_detach_private_data(tz->device->handle);
851-
remove_dev_link:
852-
sysfs_remove_link(&tz->thermal_zone->device.kobj, "device");
853-
remove_tz_link:
854-
sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
871+
remove_links:
872+
acpi_thermal_zone_sysfs_remove(tz);
855873
unregister_tzd:
856874
thermal_zone_device_unregister(tz->thermal_zone);
857875

@@ -860,8 +878,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
860878

861879
static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)
862880
{
863-
sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
864-
sysfs_remove_link(&tz->thermal_zone->device.kobj, "device");
881+
acpi_thermal_zone_sysfs_remove(tz);
865882
thermal_zone_device_unregister(tz->thermal_zone);
866883
tz->thermal_zone = NULL;
867884
acpi_bus_detach_private_data(tz->device->handle);

drivers/thermal/gov_step_wise.c

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,11 @@
2121
* a. if the trend is THERMAL_TREND_RAISING, use higher cooling
2222
* state for this trip point
2323
* b. if the trend is THERMAL_TREND_DROPPING, do nothing
24-
* c. if the trend is THERMAL_TREND_RAISE_FULL, use upper limit
25-
* for this trip point
26-
* d. if the trend is THERMAL_TREND_DROP_FULL, use lower limit
27-
* for this trip point
2824
* If the temperature is lower than a trip point,
2925
* a. if the trend is THERMAL_TREND_RAISING, do nothing
3026
* b. if the trend is THERMAL_TREND_DROPPING, use lower cooling
3127
* state for this trip point, if the cooling state already
3228
* equals lower limit, deactivate the thermal instance
33-
* c. if the trend is THERMAL_TREND_RAISE_FULL, do nothing
34-
* d. if the trend is THERMAL_TREND_DROP_FULL, use lower limit,
35-
* if the cooling state already equals lower limit,
36-
* deactivate the thermal instance
3729
*/
3830
static unsigned long get_target_state(struct thermal_instance *instance,
3931
enum thermal_trend trend, bool throttle)
@@ -61,24 +53,16 @@ static unsigned long get_target_state(struct thermal_instance *instance,
6153
return next_target;
6254
}
6355

64-
switch (trend) {
65-
case THERMAL_TREND_RAISING:
66-
if (throttle) {
56+
if (throttle) {
57+
if (trend == THERMAL_TREND_RAISING)
6758
next_target = clamp((cur_state + 1), instance->lower, instance->upper);
68-
}
69-
break;
70-
case THERMAL_TREND_DROPPING:
71-
if (cur_state <= instance->lower) {
72-
if (!throttle)
59+
} else {
60+
if (trend == THERMAL_TREND_DROPPING) {
61+
if (cur_state <= instance->lower)
7362
next_target = THERMAL_NO_TARGET;
74-
} else {
75-
if (!throttle) {
63+
else
7664
next_target = clamp((cur_state - 1), instance->lower, instance->upper);
77-
}
7865
}
79-
break;
80-
default:
81-
break;
8266
}
8367

8468
return next_target;

drivers/thermal/intel/Kconfig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,6 @@ config INTEL_TCC_COOLING
103103
on how fast the setting takes effect, and how much the CPU frequency
104104
is reduced.
105105

106-
config INTEL_MENLOW
107-
tristate "Thermal Management driver for Intel menlow platform"
108-
depends on ACPI_THERMAL
109-
help
110-
ACPI thermal management enhancement driver on
111-
Intel Menlow platform.
112-
113-
If unsure, say N.
114-
115106
config INTEL_HFI_THERMAL
116107
bool "Intel Hardware Feedback Interface"
117108
depends on NET

drivers/thermal/intel/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ obj-$(CONFIG_INTEL_BXT_PMIC_THERMAL) += intel_bxt_pmic_thermal.o
1313
obj-$(CONFIG_INTEL_PCH_THERMAL) += intel_pch_thermal.o
1414
obj-$(CONFIG_INTEL_TCC_COOLING) += intel_tcc_cooling.o
1515
obj-$(CONFIG_X86_THERMAL_VECTOR) += therm_throt.o
16-
obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o
1716
obj-$(CONFIG_INTEL_HFI_THERMAL) += intel_hfi.o

0 commit comments

Comments
 (0)