@@ -1036,6 +1036,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
10361036 if (!result ) {
10371037 list_add_tail (& dev -> tz_node , & tz -> thermal_instances );
10381038 list_add_tail (& dev -> cdev_node , & cdev -> thermal_instances );
1039+ atomic_set (& tz -> need_update , 1 );
10391040 }
10401041 mutex_unlock (& cdev -> lock );
10411042 mutex_unlock (& tz -> lock );
@@ -1142,6 +1143,7 @@ __thermal_cooling_device_register(struct device_node *np,
11421143 const struct thermal_cooling_device_ops * ops )
11431144{
11441145 struct thermal_cooling_device * cdev ;
1146+ struct thermal_zone_device * pos = NULL ;
11451147 int result ;
11461148
11471149 if (type && strlen (type ) >= THERMAL_NAME_LENGTH )
@@ -1186,6 +1188,12 @@ __thermal_cooling_device_register(struct device_node *np,
11861188 /* Update binding information for 'this' new cdev */
11871189 bind_cdev (cdev );
11881190
1191+ mutex_lock (& thermal_list_lock );
1192+ list_for_each_entry (pos , & thermal_tz_list , node )
1193+ if (atomic_cmpxchg (& pos -> need_update , 1 , 0 ))
1194+ thermal_zone_device_update (pos );
1195+ mutex_unlock (& thermal_list_lock );
1196+
11891197 return cdev ;
11901198}
11911199
@@ -1516,6 +1524,8 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
15161524 tz -> trips = trips ;
15171525 tz -> passive_delay = passive_delay ;
15181526 tz -> polling_delay = polling_delay ;
1527+ /* A new thermal zone needs to be updated anyway. */
1528+ atomic_set (& tz -> need_update , 1 );
15191529
15201530 dev_set_name (& tz -> device , "thermal_zone%d" , tz -> id );
15211531 result = device_register (& tz -> device );
@@ -1597,7 +1607,9 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
15971607 thermal_zone_device_set_polling (tz , 0 );
15981608
15991609 thermal_zone_device_reset (tz );
1600- thermal_zone_device_update (tz );
1610+ /* Update the new thermal zone and mark it as already updated. */
1611+ if (atomic_cmpxchg (& tz -> need_update , 1 , 0 ))
1612+ thermal_zone_device_update (tz );
16011613
16021614 return tz ;
16031615
0 commit comments