===================================================================
@@ -1318,6 +1318,14 @@ static void thermal_zone_add_to_list(str
list_add_tail(&tz->node, &thermal_tz_list);
}
+static void thermal_zone_init_complete(struct thermal_zone_device *tz)
+{
+ guard(thermal_zone)(tz);
+
+ tz->state &= ~TZ_STATE_FLAG_INIT;
+ __thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
+}
+
/**
* thermal_zone_device_register_with_trips() - register a new thermal zone device
* @type: the thermal zone device type
@@ -1435,6 +1443,8 @@ thermal_zone_device_register_with_trips(
tz->passive_delay_jiffies = msecs_to_jiffies(passive_delay);
tz->recheck_delay_jiffies = THERMAL_RECHECK_DELAY;
+ tz->state = TZ_STATE_FLAG_INIT;
+
/* sys I/F */
/* Add nodes that are always present via .groups */
result = thermal_zone_create_device_groups(tz);
@@ -1486,9 +1496,7 @@ thermal_zone_device_register_with_trips(
mutex_unlock(&thermal_list_lock);
- /* Update the new thermal zone and mark it as already updated. */
- if (atomic_cmpxchg(&tz->need_update, 1, 0))
- thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
+ thermal_zone_init_complete(tz);
thermal_notify_tz_create(tz);
===================================================================
@@ -64,6 +64,7 @@ struct thermal_governor {
#define TZ_STATE_FLAG_SUSPENDED BIT(0)
#define TZ_STATE_FLAG_RESUMING BIT(1)
+#define TZ_STATE_FLAG_INIT BIT(2)
#define TZ_STATE_READY 0