From: Youngjae Cho Date: Tue, 31 May 2022 00:36:29 +0000 (+0900) Subject: power: rename typedef of callback X-Git-Tag: accepted/tizen/unified/20220601.141615~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b660609f30ff82224e35d95244249af5a1b20600;p=platform%2Fcore%2Fapi%2Fdevice.git power: rename typedef of callback - change_state_callback -> change_state_wait_callback Change-Id: I7a21f4e716af474e6de4236bc92718c52d767527 Signed-off-by: Youngjae Cho --- diff --git a/include/power-internal.h b/include/power-internal.h index 8d06164..0393310 100644 --- a/include/power-internal.h +++ b/include/power-internal.h @@ -79,7 +79,7 @@ struct device_change_state_info { /** * Callback function that delivers information about a state transition. */ -typedef void (*change_state_callback) (const struct device_change_state_info *info, void *user_data); +typedef void (*change_state_wait_callback) (const struct device_change_state_info *info, void *user_data); /** * Add callback for states to be transitioned. @@ -88,7 +88,7 @@ typedef void (*change_state_callback) (const struct device_change_state_info *in * change_state_wait_callback cb: For every state transition to the state_bit, the cb will be invoked. * void *user_data: user data for the callback. */ -int device_power_add_change_state_wait_callback(uint64_t state_bits, change_state_callback cb, void *user_data); +int device_power_add_change_state_wait_callback(uint64_t state_bits, change_state_wait_callback cb, void *user_data); /** * Notify the deviced that it is ready to transition state. diff --git a/src/power-internal.c b/src/power-internal.c index f913325..8cb5029 100644 --- a/src/power-internal.c +++ b/src/power-internal.c @@ -9,19 +9,11 @@ #define DBUS_METHOD_SYNC_CALL_TIMEOUT_MS 10000 /* 10 second */ struct userdata { - change_state_callback callback; + change_state_wait_callback callback; void *data; }; static int change_state_signal_id[POWER_STATE_MAX_INDEX]; -static const char *signame[POWER_STATE_MAX_INDEX] = { - [POWER_STATE_START_INDEX] = SIGNAME_CHANGE_STATE_TO_START, - [POWER_STATE_NORMAL_INDEX] = SIGNAME_CHANGE_STATE_TO_NORMAL, - [POWER_STATE_SLEEP_INDEX] = SIGNAME_CHANGE_STATE_TO_SLEEP, - [POWER_STATE_POWEROFF_INDEX] = SIGNAME_CHANGE_STATE_TO_POWEROFF, - [POWER_STATE_REBOOT_INDEX] = SIGNAME_CHANGE_STATE_TO_REBOOT, - [POWER_STATE_EXIT_INDEX] = SIGNAME_CHANGE_STATE_TO_EXIT, -}; static void signal_unsubscribed_callback(void *data) { @@ -52,8 +44,16 @@ static void signal_callback(GDBusConnection *connection, } static int __device_power_add_change_state_wait_callback(GDBusConnection *connection, - int index, change_state_callback cb, void *data) + int index, change_state_wait_callback cb, void *data) { + static const char *signame[POWER_STATE_MAX_INDEX] = { + [POWER_STATE_START_INDEX] = SIGNAME_CHANGE_STATE_TO_START, + [POWER_STATE_NORMAL_INDEX] = SIGNAME_CHANGE_STATE_TO_NORMAL, + [POWER_STATE_SLEEP_INDEX] = SIGNAME_CHANGE_STATE_TO_SLEEP, + [POWER_STATE_POWEROFF_INDEX] = SIGNAME_CHANGE_STATE_TO_POWEROFF, + [POWER_STATE_REBOOT_INDEX] = SIGNAME_CHANGE_STATE_TO_REBOOT, + [POWER_STATE_EXIT_INDEX] = SIGNAME_CHANGE_STATE_TO_EXIT, + }; struct userdata *ud; if (change_state_signal_id[index] > 0) @@ -82,7 +82,7 @@ static int __device_power_add_change_state_wait_callback(GDBusConnection *connec return DEVICE_ERROR_NONE; } -int device_power_add_change_state_wait_callback(uint64_t state_bits, change_state_callback cb, void *data) +int device_power_add_change_state_wait_callback(uint64_t state_bits, change_state_wait_callback cb, void *data) { GDBusConnection *connection; GVariant *retgv = NULL;