From: Yunhee Seo Date: Tue, 9 Apr 2024 11:16:05 +0000 (+0900) Subject: haptic: Apply HAL ABI versioning X-Git-Tag: accepted/tizen/unified/20240614.085013~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7dbf8b6ca210d5ad0de3d48f110a1618e38b815b;p=platform%2Fhal%2Fbackend%2Femulator%2Fdevice-emulator.git 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 --- 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, };