diff mbox series

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

Message ID 20200504181616.175477-3-srinivas.pandruvada@linux.intel.com
State New
Headers show
Series [RFC,1/5] thermal: Add support for /dev/thermal_notify | expand

Commit Message

Srinivas Pandruvada May 4, 2020, 6:16 p.m. UTC
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@linux.intel.com>
---
 drivers/thermal/thermal_core.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

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);