summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunhee Seo <yuni.seo@samsung.com>2024-04-19 13:12:57 +0900
committerYunhee Seo <yuni.seo@samsung.com>2024-04-19 13:45:05 +0900
commit4342f7192e40cabfcbdc26d3eb2c7a76e6ec4100 (patch)
tree9464e7917f7982193b4486cf9883af6a85743c41
parent5c0fa4bc187e4de307fd8fdfa78fba79e3eaa8ab (diff)
downloaddevice-c4-4342f7192e40cabfcbdc26d3eb2c7a76e6ec4100.tar.gz
device-c4-4342f7192e40cabfcbdc26d3eb2c7a76e6ec4100.tar.bz2
device-c4-4342f7192e40cabfcbdc26d3eb2c7a76e6ec4100.zip
thermal: Apply HAL ABI versioning
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>
-rw-r--r--hw/thermal/thermal.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/hw/thermal/thermal.c b/hw/thermal/thermal.c
index 7bb4976..d134b05 100644
--- a/hw/thermal/thermal.c
+++ b/hw/thermal/thermal.c
@@ -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>
@@ -31,13 +31,13 @@
#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;
}