display: Apply HAL ABI versioning 88/309388/1
authorYunhee Seo <yuni.seo@samsung.com>
Tue, 9 Apr 2024 08:29:45 +0000 (17:29 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Tue, 9 Apr 2024 08:29:45 +0000 (17:29 +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-display side.

Change-Id: I1226a6de4f05b899a338e852caed0db30fd2e140
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
hw/display/display.c

index c61a2ab982df19f85411800d776e06206fc6775d..1ef296f9f744bb2e7bdfab16dda5bd736a66f4f0 100644 (file)
@@ -110,16 +110,19 @@ static int display_init(void **data)
 {
        hal_backend_device_display_funcs *device_display_funcs;
 
-       device_display_funcs = calloc(1, sizeof(hal_backend_device_display_funcs));
+       if (!data) {
+               _E("Invalid parameter");
+               return -EINVAL;
+       }
+
+       device_display_funcs = *(hal_backend_device_display_funcs **) data;
        if (!device_display_funcs)
-               return -ENOMEM;
+               return -EINVAL;
 
        device_display_funcs->get_max_brightness = display_get_max_brightness;
        device_display_funcs->get_brightness = display_get_brightness;
        device_display_funcs->set_brightness = display_set_brightness;
 
-       *data = (void *)device_display_funcs;
-
        return 0;
 }
 
@@ -138,4 +141,6 @@ hal_backend EXPORT hal_backend_device_display_data = {
        .abi_version = HAL_ABI_VERSION_TIZEN_7_0,
        .init = display_init,
        .exit = display_exit,
+       .major_version = 1,
+       .minor_version = 0,
 };