summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunhee Seo <yuni.seo@samsung.com>2024-04-18 18:02:44 +0900
committerYunhee Seo <yuni.seo@samsung.com>2024-04-18 18:02:44 +0900
commitff614a17d29e052335bd4d75e08c86a37070591d (patch)
tree65588add7077ae36dc4b7118183ca09b95a4e233
parentbf15aeee60c82691d6484b3aa42453ea6961e83c (diff)
downloaddevice-emulator-ff614a17d29e052335bd4d75e08c86a37070591d.tar.gz
device-emulator-ff614a17d29e052335bd4d75e08c86a37070591d.tar.bz2
device-emulator-ff614a17d29e052335bd4d75e08c86a37070591d.zip
external_connection: Apply HAL ABI versioning
To support OS upgrade feature, hal-backend and hal-api module needs HAL ABI versioning. So, major/minor version is added to hal_backend structure. While applying HAL ABI versioning, hal_backend_[module]_funcs is allocated from hal-api-[module] side. Thus, allocation is moved to hal-api-device-external_connection side. Change-Id: I335aa6954d4a8862b5c74b5a8768de7b5fcdd784 Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
-rw-r--r--hw/external_connection/external_connection.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/hw/external_connection/external_connection.c b/hw/external_connection/external_connection.c
index b995865..3a7bd62 100644
--- a/hw/external_connection/external_connection.c
+++ b/hw/external_connection/external_connection.c
@@ -25,7 +25,7 @@
#include <linux/limits.h>
#include <dirent.h>
-#include <hal/hal-external_connection-interface.h>
+#include <hal/hal-device-external_connection-interface.h>
#include <hal/hal-common-interface.h>
#include <libsyscommon/file.h>
@@ -60,7 +60,7 @@ struct extcon_device {
static guint signal_id; /* signal handler id */
static struct signal_data {
- ConnectionUpdated updated_cb;
+ hal_device_external_connection_updated_cb updated_cb;
void *data;
} sdata = { 0, };
@@ -72,7 +72,7 @@ static void signal_delivered(GDBusConnection *conn,
GVariant *parameters,
gpointer user_data)
{
- struct connection_info info;
+ hal_device_external_connection_info_s info;
char *sig, *name, *state;
char st[32];
int num, i;
@@ -114,7 +114,7 @@ out:
}
static int external_connection_register_changed_event(
- ConnectionUpdated updated_cb, void *data)
+ hal_device_external_connection_updated_cb updated_cb, void *data)
{
if (sdata.updated_cb) {
_E("update callback is already registered");
@@ -136,7 +136,7 @@ static int external_connection_register_changed_event(
}
static void external_connection_unregister_changed_event(
- ConnectionUpdated updated_cb)
+ hal_device_external_connection_updated_cb updated_cb)
{
if (signal_id > 0) {
gdbus_signal_unsubscribe(NULL, signal_id);
@@ -147,10 +147,10 @@ static void external_connection_unregister_changed_event(
}
static int external_connection_get_current_state(
- ConnectionUpdated updated_cb, void *data)
+ hal_device_external_connection_updated_cb updated_cb, void *data)
{
int ret, i, val;
- struct connection_info info;
+ hal_device_external_connection_info_s info;
char buf[8];
if (!updated_cb)
@@ -176,17 +176,20 @@ static int external_connection_get_current_state(
static int external_connection_init(void **data)
{
- hal_backend_external_connection_funcs *external_connection_funcs;
+ hal_backend_device_external_connection_funcs *device_external_connection_funcs;
- external_connection_funcs = calloc(1, sizeof(hal_backend_external_connection_funcs));
- if (!external_connection_funcs)
- return -ENOMEM;
+ if (!data) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
- external_connection_funcs->register_changed_event = external_connection_register_changed_event;
- external_connection_funcs->unregister_changed_event = external_connection_unregister_changed_event;
- external_connection_funcs->get_current_state = external_connection_get_current_state;
+ device_external_connection_funcs = *(hal_backend_device_external_connection_funcs **) data;
+ if (!device_external_connection_funcs)
+ return -EINVAL;
- *data = (void *)external_connection_funcs;
+ device_external_connection_funcs->register_changed_event = external_connection_register_changed_event;
+ device_external_connection_funcs->unregister_changed_event = external_connection_unregister_changed_event;
+ device_external_connection_funcs->get_current_state = external_connection_get_current_state;
return 0;
}