thermal: Apply HAL ABI versioning 98/309998/2
authorYunhee Seo <yuni.seo@samsung.com>
Fri, 19 Apr 2024 04:12:57 +0000 (13:12 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Fri, 19 Apr 2024 04:46:10 +0000 (13:46 +0900)
While applying HAL ABI versioning, hal_backend_[module]_funcs is allocated from hal-api-[module] side.
Thus, allocation is moved to hal-api-device-thermal side.
Also, wrong module name is fixed and hal interface inclusion path is changed.
"thermal" -> "device-thermal"

Change-Id: I89caa12d62873b1fcd7d478699cb201d0f44db21
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
hw/thermal/thermal.c

index 5d6625ede32234666b03b41adc0b1c2c8cb4105f..72628b58c96c1f32254c2aa8ef14efeb40b0923d 100644 (file)
@@ -23,7 +23,7 @@
 #include <errno.h>
 #include <glib.h>
 
-#include <hal/hal-thermal-interface.h>
+#include <hal/hal-device-thermal-interface.h>
 #include <hal/hal-common-interface.h>
 
 #include </hal/include/device/hal-backend-common.h>
 #define AP_PATH                "/sys/class/thermal/thermal_zone0/temp"
 
 static struct event_data {
-       ThermalUpdated updated_cb;
+       hal_device_thermal_updated_cb updated_cb;
        void *data;
 } edata = { 0, };
 
 static guint timer;
 
-static int thermal_get_info(hal_device_thermal_e type, struct thermal_info *info)
+static int thermal_get_info(hal_device_thermal_e type, hal_device_thermal_info_s *info)
 {
        FILE *fp;
        char buf[32];
@@ -69,7 +69,7 @@ static int thermal_get_info(hal_device_thermal_e type, struct thermal_info *info
 
 static gboolean thermal_timeout(gpointer data)
 {
-       struct thermal_info info;
+       hal_device_thermal_info_s info;
        int ret;
 
        ret = thermal_get_info(HAL_DEVICE_THERMAL_AP, &info);
@@ -84,7 +84,7 @@ static gboolean thermal_timeout(gpointer data)
        return G_SOURCE_CONTINUE;
 }
 
-static int thermal_register_changed_event(ThermalUpdated updated_cb, void *data)
+static int thermal_register_changed_event(hal_device_thermal_updated_cb updated_cb, void *data)
 {
        if (timer)
                g_source_remove(timer);
@@ -101,7 +101,7 @@ static int thermal_register_changed_event(ThermalUpdated updated_cb, void *data)
        return 0;
 }
 
-static int thermal_unregister_changed_event(ThermalUpdated updated_cb)
+static int thermal_unregister_changed_event(hal_device_thermal_updated_cb updated_cb)
 {
        if (timer) {
                g_source_remove(timer);
@@ -116,17 +116,20 @@ static int thermal_unregister_changed_event(ThermalUpdated updated_cb)
 
 static int thermal_init(void **data)
 {
-       hal_backend_thermal_funcs *thermal_funcs;
+       hal_backend_device_thermal_funcs *device_thermal_funcs;
 
-       thermal_funcs = calloc(1, sizeof(hal_backend_thermal_funcs));
-       if (!thermal_funcs)
-               return -ENOMEM;
+       if (!data) {
+               _E("Invalid parameter");
+               return -EINVAL;
+       }
 
-       thermal_funcs->get_info = thermal_get_info;
-       thermal_funcs->register_changed_event = thermal_register_changed_event;
-       thermal_funcs->unregister_changed_event = thermal_unregister_changed_event;
+       device_thermal_funcs = *(hal_backend_device_thermal_funcs **) data;
+       if (!device_thermal_funcs)
+               return -EINVAL;
 
-       *data = (void *)thermal_funcs;
+       device_thermal_funcs->get_info = thermal_get_info;
+       device_thermal_funcs->register_changed_event = thermal_register_changed_event;
+       device_thermal_funcs->unregister_changed_event = thermal_unregister_changed_event;
 
        return 0;
 }