summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunhee Seo <yuni.seo@samsung.com>2024-04-09 20:16:05 +0900
committerYunhee Seo <yuni.seo@samsung.com>2024-04-09 20:16:05 +0900
commit7dbf8b6ca210d5ad0de3d48f110a1618e38b815b (patch)
tree40f5be1513c2c2445cd8645d49ed2eee5795284e
parentb2404ae8209ec0f5ecba93d74d439a739a1f71d3 (diff)
downloaddevice-emulator-7dbf8b6ca210d5ad0de3d48f110a1618e38b815b.tar.gz
device-emulator-7dbf8b6ca210d5ad0de3d48f110a1618e38b815b.tar.bz2
device-emulator-7dbf8b6ca210d5ad0de3d48f110a1618e38b815b.zip
haptic: 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-haptic side. Change-Id: If1accb11e605c76698790111c3ec56cf1d8f6868 Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
-rw-r--r--hw/haptic/emulator.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/hw/haptic/emulator.c b/hw/haptic/emulator.c
index 441cdad..09f4af7 100644
--- a/hw/haptic/emulator.c
+++ b/hw/haptic/emulator.c
@@ -131,9 +131,14 @@ static int haptic_init(void **data)
{
hal_backend_device_haptic_funcs *device_haptic_funcs;
- device_haptic_funcs = calloc(1, sizeof(hal_backend_device_haptic_funcs));
- if (!device_haptic_funcs)
- return -ENOMEM;
+ if (!data) {
+ _E("Invalid parameter");
+ return -EINVAL;
+ }
+
+ device_haptic_funcs = *(hal_backend_device_haptic_funcs **) data;
+ if (!device_haptic_funcs)
+ return -EINVAL;
device_haptic_funcs->get_device_count = get_device_count;
device_haptic_funcs->open_device = open_device;
@@ -142,8 +147,6 @@ static int haptic_init(void **data)
device_haptic_funcs->stop_device = stop_device;
device_haptic_funcs->is_valid = is_valid;
- *data = (void *)device_haptic_funcs;
-
return 0;
}
@@ -162,4 +165,6 @@ hal_backend EXPORT hal_backend_device_haptic_data = {
.abi_version = HAL_ABI_VERSION_TIZEN_7_0,
.init = haptic_init,
.exit = haptic_exit,
+ .major_version = 1,
+ .minor_version = 0,
};