===================================================================
@@ -190,7 +190,7 @@ static int acpi_thermal_get_polling_freq
return 0;
}
-static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
+static void __acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
{
acpi_status status;
unsigned long long tmp;
@@ -398,17 +398,28 @@ static int acpi_thermal_trips_update(str
ACPI_THERMAL_TRIPS_EXCEPTION(flag, tz, "device");
}
}
+}
- return 0;
+static void acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
+{
+ /*
+ * The locking is needed here to protect thermal_get_trend() from using
+ * a stale passive trip temperature and to synchronize with the trip
+ * temperature updates in acpi_thermal_check_fn().
+ */
+ thermal_zone_device_lock(tz->thermal_zone);
+
+ __acpi_thermal_trips_update(tz, flag);
+
+ thermal_zone_device_unlock(tz->thermal_zone);
}
static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
{
- int i, ret = acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT);
bool valid;
+ int i;
- if (ret)
- return ret;
+ __acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT);
valid = tz->trips.critical.valid |
tz->trips.hot.valid |