[RFC][PATCH 2/5] thermal: Add notification for zone creation and deletion

From: Srinivas Pandruvada
Date: Mon May 04 2020 - 14:17:01 EST


Whenever thermal_zone_device_register() is called and zone is created
successfully, send a notification "THERMAL_ZONE_CREATE".
Similarly send "THERMAL_ZONE_DELETE" when thermal_zone_device_unregister
is called.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
---
drivers/thermal/thermal_core.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 9a321dc548c8..14770d882d42 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1350,6 +1350,8 @@ thermal_zone_device_register(const char *type, int trips, int mask,
if (atomic_cmpxchg(&tz->need_update, 1, 0))
thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);

+ thermal_dev_send_event(tz->id, THERMAL_ZONE_CREATE, 0);
+
return tz;

unregister:
@@ -1379,6 +1381,8 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
if (!tz)
return;

+ thermal_dev_send_event(tz->id, THERMAL_ZONE_DELETE, 0);
+
tzp = tz->tzp;

mutex_lock(&thermal_list_lock);
--
2.25.4