summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunhee Seo <yuni.seo@samsung.com>2024-04-09 11:35:55 +0900
committerYunhee Seo <yuni.seo@samsung.com>2024-04-09 15:32:28 +0900
commit4960c48c4a77ce0008ea5db394eb11923593c9f8 (patch)
treeca634f3ebe7046361c5e16d0cfaa2111a5105e47
parent40944855fe48964bec141f67de03b754ea93d041 (diff)
downloaddevice-rpi-4960c48c4a77ce0008ea5db394eb11923593c9f8.tar.gz
device-rpi-4960c48c4a77ce0008ea5db394eb11923593c9f8.tar.bz2
device-rpi-4960c48c4a77ce0008ea5db394eb11923593c9f8.zip
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: Iac7f8f2b96b4bcd31c3fcbf7bb493580bf1b4fbf Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
-rw-r--r--hw/haptic/gpio.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/hw/haptic/gpio.c b/hw/haptic/gpio.c
index 4ce96d3..e619c23 100644
--- a/hw/haptic/gpio.c
+++ b/hw/haptic/gpio.c
@@ -228,7 +228,7 @@ static int gpio_haptic_vibrate_monotone(int handle, int duration, int frequency,
}
/* Zero(0) is the infinitely vibration value */
- if (duration == HAPTIC_MODULE_DURATION_UNLIMITED)
+ if (duration == HAL_DEVICE_HAPTIC_MODULE_DURATION_UNLIMITED)
duration = 0;
if (stop_timer)
@@ -317,9 +317,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 = gpio_haptic_get_device_count;
device_haptic_funcs->open_device = gpio_haptic_open_device;
@@ -328,8 +333,6 @@ static int haptic_init(void **data)
device_haptic_funcs->stop_device = gpio_haptic_stop_device;
device_haptic_funcs->is_valid = is_valid;
- *data = (void *)device_haptic_funcs;
-
return 0;
}
@@ -349,4 +352,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,
};