board: Apply HAL ABI versioning 94/309394/1
authorYunhee Seo <yuni.seo@samsung.com>
Tue, 9 Apr 2024 09:05:18 +0000 (18:05 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Tue, 9 Apr 2024 09:05:18 +0000 (18:05 +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-board side.

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

index e26985dc5342c6df5d503b2fbab59de30c3fcb10..55b3ddbb53469836ef1464d39097b4c8bac62055 100644 (file)
@@ -102,14 +102,17 @@ static int board_init(void **data)
 {
        hal_backend_device_board_funcs *device_board_funcs;
 
-       device_board_funcs = calloc(1, sizeof(hal_backend_device_board_funcs));
+       if (!data) {
+               _E("Invalid parameter");
+               return -EINVAL;
+       }
+
+       device_board_funcs = *(hal_backend_device_board_funcs **) data;
        if (!device_board_funcs)
-               return -ENOMEM;
+               return -EINVAL;
 
        device_board_funcs->get_device_serial_number = get_device_serial_number;
 
-       *data = (void *)device_board_funcs;
-
        return 0;
 }
 
@@ -128,4 +131,6 @@ hal_backend EXPORT hal_backend_device_board_data = {
        .abi_version = HAL_ABI_VERSION_TIZEN_7_0,
        .init = board_init,
        .exit = board_exit,
+       .major_version = 1,
+       .minor_version = 0,
 };