thermal: update the documentation
[GitHub/LineageOS/android_kernel_samsung_universal7580.git] / drivers / acpi / thermal.c
index c4e00ac8ea855ac980b05b5e6bf60b8e52b5016b..5e9641c93fcd515076aea5a03a95f5661c7c9ddc 100644 (file)
@@ -1012,6 +1012,18 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
        return -EINVAL;
 }
 
+static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
+                               unsigned long *temperature) {
+       struct acpi_thermal *tz = thermal->devdata;
+
+       if (tz->trips.critical.flags.valid) {
+               *temperature = KELVIN_TO_MILLICELSIUS(
+                               tz->trips.critical.temperature);
+               return 0;
+       } else
+               return -EINVAL;
+}
+
 typedef int (*cb)(struct thermal_zone_device *, int,
                  struct thermal_cooling_device *);
 static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
@@ -1103,6 +1115,7 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = {
        .set_mode = thermal_set_mode,
        .get_trip_type = thermal_get_trip_type,
        .get_trip_temp = thermal_get_trip_temp,
+       .get_crit_temp = thermal_get_crit_temp,
 };
 
 static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
@@ -1123,9 +1136,9 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
 
        for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
                        tz->trips.active[i].flags.valid; i++, trips++);
-       tz->thermal_zone = thermal_zone_device_register("ACPI thermal zone",
+       tz->thermal_zone = thermal_zone_device_register("acpitz",
                                        trips, tz, &acpi_thermal_zone_ops);
-       if (!tz->thermal_zone)
+       if (IS_ERR(tz->thermal_zone))
                return -ENODEV;
 
        result = sysfs_create_link(&tz->device->dev.kobj,
@@ -1710,7 +1723,6 @@ static int acpi_thermal_resume(struct acpi_device *device)
        return AE_OK;
 }
 
-#ifdef CONFIG_DMI
 static int thermal_act(const struct dmi_system_id *d) {
 
        if (act == 0) {
@@ -1785,7 +1797,6 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = {
        },
        {}
 };
-#endif /* CONFIG_DMI */
 
 static int __init acpi_thermal_init(void)
 {