From: Yunhee Seo Date: Fri, 19 Apr 2024 07:35:59 +0000 (+0900) Subject: touchscreen: Apply HAL ABI versioning X-Git-Tag: accepted/tizen/unified/20240614.085003~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71126b3934a73ecdd36d18409dc799baf78780be;p=platform%2Fhal%2Fbackend%2Fvim3%2Fdevice-vim3.git 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 --- diff --git a/hw/touchscreen/touchscreen.c b/hw/touchscreen/touchscreen.c index 5c190b9..c86bc32 100644 --- a/hw/touchscreen/touchscreen.c +++ b/hw/touchscreen/touchscreen.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -35,7 +35,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; @@ -51,10 +51,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); @@ -64,16 +64,16 @@ 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; 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: @@ -90,16 +90,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; }