diff options
author | SangYoun Kwak <sy.kwak@samsung.com> | 2024-07-03 16:35:20 +0900 |
---|---|---|
committer | SangYoun Kwak <sy.kwak@samsung.com> | 2024-07-03 16:35:20 +0900 |
commit | 964d4c8d2a536df226f072641bd5d2206d05447f (patch) | |
tree | 176c91934f5e3e4a655eef48490052673dc4fac2 | |
parent | 58c04b0723cf609f0ce8743716cc90cc0a879831 (diff) | |
download | sensor-emulator-tizen_9.0.tar.gz sensor-emulator-tizen_9.0.tar.bz2 sensor-emulator-tizen_9.0.zip |
Modify to use hal_backend_sensor_funcs allocated from callertizen_9.0_m2_releaseaccepted/tizen/unified/dev/20240708.001614accepted/tizen/unified/20240704.075651accepted/tizen/9.0/unified/20241030.233628tizen_9.0tizenaccepted/tizen_unified_devaccepted/tizen_unifiedaccepted/tizen_9.0_unified
With HAL ABI versioning, the hal_backend_sensor_funcs, which is a
container of sensor backend functions is allocated from hal-api-sensor.
Thus, it is modified to use hal_backend_sensor_funcs allocated from the
caller(hal-api-sensor).
Change-Id: I6ad5c106f6848d8a2064ede8d90bfb5eb11e4adf
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
-rw-r--r-- | src/hal-backend-sensor.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/hal-backend-sensor.cpp b/src/hal-backend-sensor.cpp index a522172..2a721a2 100644 --- a/src/hal-backend-sensor.cpp +++ b/src/hal-backend-sensor.cpp @@ -66,23 +66,25 @@ static int sensor_emulator_create(sensor_device_t **devices) { static int sensor_emulator_init(void **data) { _I("init hal backend sensor"); - hal_backend_sensor_funcs *funcs; + hal_backend_sensor_funcs *funcs = NULL; - funcs = - (hal_backend_sensor_funcs *)calloc(1, sizeof(hal_backend_sensor_funcs)); - if (!funcs) return -ENOMEM; + if (!data) { + _E("Invalid parameter"); + return -EINVAL; + } - funcs->create = sensor_emulator_create; + funcs = *((hal_backend_sensor_funcs **)data); + if (!funcs) { + _E("Invalid parameter"); + return -EINVAL; + } - *data = (void *)funcs; + funcs->create = sensor_emulator_create; return 0; } static int sensor_emulator_exit(void *data) { - if (!data) return -EINVAL; - free(data); - return 0; } |