haptic: Apply HAL ABI versioning 01/309401/1
authorYunhee Seo <yuni.seo@samsung.com>
Tue, 9 Apr 2024 11:16:05 +0000 (20:16 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Tue, 9 Apr 2024 11:16:05 +0000 (20:16 +0900)
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>
hw/haptic/emulator.c

index 441cdad1bfc6d71db00077aea8418727eb723377..09f4af750053140a2fc191f28070a023363426a7 100644 (file)
@@ -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,
 };