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:46:45 +0900
commit89d956bdd6e57c902a72bd69205a3302f659b5a2 (patch)
treeef8e280834dfe7f270adc15f59c8ad295e1edeef
parentb82a82c5ce63fa35b53f5e9cb4e7558f804b2b85 (diff)
downloaddevice-rpi-89d956bdd6e57c902a72bd69205a3302f659b5a2.tar.gz
device-rpi-89d956bdd6e57c902a72bd69205a3302f659b5a2.tar.bz2
device-rpi-89d956bdd6e57c902a72bd69205a3302f659b5a2.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 c98b665..49dd858 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;
}