diff options
author | Yunhee Seo <yuni.seo@samsung.com> | 2024-04-19 16:35:59 +0900 |
---|---|---|
committer | Yunhee Seo <yuni.seo@samsung.com> | 2024-04-19 16:35:59 +0900 |
commit | 5e81ed18e90a969a35ea7f6d463cf7079b33a33f (patch) | |
tree | 4c3a4c7802931d201484198c540dead30fe81e21 | |
parent | 4fd1fd627ac26b7073e44530168bcd4cd54d4fa1 (diff) | |
download | device-rpi-5e81ed18e90a969a35ea7f6d463cf7079b33a33f.tar.gz device-rpi-5e81ed18e90a969a35ea7f6d463cf7079b33a33f.tar.bz2 device-rpi-5e81ed18e90a969a35ea7f6d463cf7079b33a33f.zip |
touchscreen: Apply HAL ABI versioning
While applying HAL ABI versioning, hal_backend_[module]_funcs is allocated from hal-api-[module] side.
Thus, allocation is moved to hal-api-device-touchscreen side.
Also, wrong module name is fixed and hal interface inclusion path is changed.
"touchscreen" -> "device-touchscreen"
Change-Id: I6776398dcfa8c36c5749e284ba673e0da08b70d9
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
-rw-r--r-- | hw/touchscreen/touchscreen.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/hw/touchscreen/touchscreen.c b/hw/touchscreen/touchscreen.c index 27cb139..3d718e2 100644 --- a/hw/touchscreen/touchscreen.c +++ b/hw/touchscreen/touchscreen.c @@ -25,7 +25,7 @@ #include <linux/limits.h> #include <dirent.h> -#include <hal/hal-touchscreen-interface.h> +#include <hal/hal-device-touchscreen-interface.h> #include <hal/hal-common-interface.h> #include <libsyscommon/file.h> @@ -36,7 +36,7 @@ #define TURNON_TOUCHSCREEN 1 #define TURNOFF_TOUCHSCREEN 0 -static int touchscreen_get_state(enum touchscreen_state *state) +static int touchscreen_get_state(hal_device_touchscreen_state_e *state) { int ret; int val; @@ -56,10 +56,10 @@ static int touchscreen_get_state(enum touchscreen_state *state) switch (val) { case TURNOFF_TOUCHSCREEN: - *state = TOUCHSCREEN_OFF; + *state = HAL_DEVICE_TOUCHSCREEN_OFF; break; case TURNON_TOUCHSCREEN: - *state = TOUCHSCREEN_ON; + *state = HAL_DEVICE_TOUCHSCREEN_ON; break; default: _E("Failed to get touchscreen state (%d)", val); @@ -69,7 +69,7 @@ static int touchscreen_get_state(enum touchscreen_state *state) return 0; } -static int touchscreen_set_state(enum touchscreen_state state) +static int touchscreen_set_state(hal_device_touchscreen_state_e state) { int ret; int val; @@ -79,10 +79,10 @@ static int touchscreen_set_state(enum touchscreen_state state) return -ENODEV; switch (state) { - case TOUCHSCREEN_OFF: + case HAL_DEVICE_TOUCHSCREEN_OFF: val = TURNOFF_TOUCHSCREEN; break; - case TOUCHSCREEN_ON: + case HAL_DEVICE_TOUCHSCREEN_ON: val = TURNON_TOUCHSCREEN; break; default: @@ -99,16 +99,19 @@ static int touchscreen_set_state(enum touchscreen_state state) static int touchscreen_init(void **data) { - hal_backend_touchscreen_funcs *touchscreen_funcs; + hal_backend_device_touchscreen_funcs *device_touchscreen_funcs; - touchscreen_funcs = calloc(1, sizeof(hal_backend_touchscreen_funcs)); - if (!touchscreen_funcs) - return -ENOMEM; + if (!data) { + _E("Invalid parameter"); + return -EINVAL; + } - touchscreen_funcs->get_state = touchscreen_get_state; - touchscreen_funcs->set_state = touchscreen_set_state; + device_touchscreen_funcs = *(hal_backend_device_touchscreen_funcs **) data; + if (!device_touchscreen_funcs) + return -EINVAL; - *data = (void *)touchscreen_funcs; + device_touchscreen_funcs->get_state = touchscreen_get_state; + device_touchscreen_funcs->set_state = touchscreen_set_state; return 0; } |