From: Chanwoo Choi Date: Thu, 17 Aug 2023 10:55:25 +0000 (+0900) Subject: power: Covnert to struct syscommon_plugin_deviced_power_trans_info X-Git-Tag: accepted/tizen/unified/20230821.162310~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b52631719db09f52ce0f4e88ca9a2c8d34d467f;p=platform%2Fcore%2Fsystem%2Fdeviced.git power: Covnert to struct syscommon_plugin_deviced_power_trans_info struct trans_info is used on both deviced and deviced-plugin-backend. So that move it to plugin-api-deviced in libsyscommon and then covert from trans_info to syscommon_plugin_deviced_power_trans_info. Change-Id: I990f9f94dc3452e59d9c9f6b0d02a2c95e7b44ce Signed-off-by: Chanwoo Choi --- diff --git a/plugins/iot-headless/input/input-config.c b/plugins/iot-headless/input/input-config.c index 2e7f753..d5ddf44 100644 --- a/plugins/iot-headless/input/input-config.c +++ b/plugins/iot-headless/input/input-config.c @@ -30,7 +30,6 @@ #include #include "input-config.h" -#include "power/power.h" #define INPUT_CONF_PATH "/etc/deviced/input.conf" @@ -127,10 +126,10 @@ static void parse_condition_vconf(struct input_event_unit *ieu, const char *str) static void add_action_transition_info(struct input_event_unit *ieu, char *curr, char *next) { - struct trans_info *ti = NULL; + struct syscommon_plugin_deviced_power_trans_info *ti = NULL; GList **action_list = (GList **) &(ieu->user_data); - ti = calloc(1, sizeof(struct trans_info)); + ti = calloc(1, sizeof(struct syscommon_plugin_deviced_power_trans_info)); if (!ti) return; diff --git a/src/power/power-boot.c b/src/power/power-boot.c index c59edd4..7e80dd7 100644 --- a/src/power/power-boot.c +++ b/src/power/power-boot.c @@ -42,7 +42,7 @@ #define INIT_CONF_PATH "/etc/deviced/init.conf" -static struct trans_info init_ti = { +static struct syscommon_plugin_deviced_power_trans_info init_ti = { .reason = -1, .curr = 0, .next = 0, diff --git a/src/power/power.c b/src/power/power.c index b854035..94a05c2 100644 --- a/src/power/power.c +++ b/src/power/power.c @@ -50,7 +50,7 @@ static GQueue *transition_queue; static struct { uint64_t id; int ongoing; - struct trans_info ti; + struct syscommon_plugin_deviced_power_trans_info ti; GList *waitings; int transient_step; int max_wait_timer; @@ -106,7 +106,7 @@ static const struct { }; static int transition_request_callback(void *data); -static void prepare_transition(const struct trans_info *ti); +static void prepare_transition(const struct syscommon_plugin_deviced_power_trans_info *ti); static void action_transition(void); static uint64_t get_next_state(void); @@ -371,7 +371,7 @@ int is_there_pending_transition(void) static uint64_t available_starting_state(void) { - struct trans_info *ti = NULL; + struct syscommon_plugin_deviced_power_trans_info *ti = NULL; // If there is pending transition, // the available state is the last state of pendiong transitions. @@ -386,9 +386,9 @@ static uint64_t available_starting_state(void) return transition_context.ongoing ? transition_context.ti.next : current; } -static int dequeue_transition(struct trans_info *ti) +static int dequeue_transition(struct syscommon_plugin_deviced_power_trans_info *ti) { - struct trans_info *tail = NULL; + struct syscommon_plugin_deviced_power_trans_info *tail = NULL; tail = g_queue_pop_tail(transition_queue); if (!tail) @@ -402,20 +402,20 @@ static int dequeue_transition(struct trans_info *ti) return 0; } -static void enqueue_transition(const struct trans_info *ti) +static void enqueue_transition(const struct syscommon_plugin_deviced_power_trans_info *ti) { - struct trans_info *ti_new = NULL; + struct syscommon_plugin_deviced_power_trans_info *ti_new = NULL; if (!ti) return; - ti_new = calloc(1, sizeof(struct trans_info)); + ti_new = calloc(1, sizeof(struct syscommon_plugin_deviced_power_trans_info)); if (!ti_new) return; - memcpy(ti_new, ti, sizeof(struct trans_info)); + memcpy(ti_new, ti, sizeof(struct syscommon_plugin_deviced_power_trans_info)); - g_queue_push_head(transition_queue, memcpy(ti_new, ti, sizeof(struct trans_info))); + g_queue_push_head(transition_queue, memcpy(ti_new, ti, sizeof(struct syscommon_plugin_deviced_power_trans_info))); } // intermediate state of ongoing transition @@ -593,10 +593,10 @@ static void trigger_transition(void) static void cancel_transition(void) { - struct trans_info *ti = NULL; + struct syscommon_plugin_deviced_power_trans_info *ti = NULL; - struct trans_info poweroff = { .next = DEVICED_POWER_STATE_UNDEFINED }; - struct trans_info undo = { + struct syscommon_plugin_deviced_power_trans_info poweroff = { .next = DEVICED_POWER_STATE_UNDEFINED }; + struct syscommon_plugin_deviced_power_trans_info undo = { .curr = transition_context.ti.next, .next = transition_context.ti.curr, /** @@ -643,7 +643,7 @@ static void cancel_transition(void) static void action_transition(void) { uint64_t state = get_next_state(); - struct trans_info ti = { 0 , }; + struct syscommon_plugin_deviced_power_trans_info ti = { 0 , }; int retval; int index; @@ -688,13 +688,13 @@ trigger_next: } } -static void prepare_transition(const struct trans_info *ti) +static void prepare_transition(const struct syscommon_plugin_deviced_power_trans_info *ti) { assert(transition_context.waitings == NULL); assert(transition_context.max_wait_timer == 0); if (ti) { - transition_context.ti = (struct trans_info) { + transition_context.ti = (struct syscommon_plugin_deviced_power_trans_info) { .curr = ti->curr, .next = ti->next, .reason = ti->reason, @@ -711,7 +711,7 @@ static void prepare_transition(const struct trans_info *ti) static gint find_ti_by_state(gconstpointer data, gconstpointer udata) { - const struct trans_info *ti = (const struct trans_info *) data; + const struct syscommon_plugin_deviced_power_trans_info *ti = (const struct trans_info *) data; const uint64_t state = *(const uint64_t *) udata; if (ti->curr & state) @@ -723,8 +723,8 @@ static gint find_ti_by_state(gconstpointer data, gconstpointer udata) static int transition_request_callback(void *data) { GList *ti_list, *l; - const struct trans_info *t = NULL; - struct trans_info ti = { 0 , }; + const struct syscommon_plugin_deviced_power_trans_info *t = NULL; + struct syscommon_plugin_deviced_power_trans_info ti = { 0 , }; uint64_t available; if (!data) @@ -749,7 +749,7 @@ static int transition_request_callback(void *data) return 0; } - ti = (struct trans_info) { + ti = (struct syscommon_plugin_deviced_power_trans_info) { .curr = available, .next = t->next, .reason = t->reason, @@ -778,7 +778,7 @@ static int transition_request_callback(void *data) static int delayed_init_callback(void *data) { int retval; - struct trans_info ti = { 0 , }; + struct syscommon_plugin_deviced_power_trans_info ti = { 0 , }; delayed_init_done = 1; diff --git a/src/power/power.h b/src/power/power.h index 640ed43..079f8a3 100644 --- a/src/power/power.h +++ b/src/power/power.h @@ -28,13 +28,6 @@ #include "shared/device-notifier.h" -struct trans_info { - uint64_t curr; - uint64_t next; - int reason; - const void *data; -}; - void power_state_manager_init(void *data); static inline const char *state_name(uint64_t state) @@ -76,7 +69,7 @@ static inline int is_poweroff_state(uint64_t state) static inline void power_request_change_state_strict(uint64_t curr, uint64_t next, int reason, const void *udata) { - struct trans_info ti = { curr, next, reason, udata }; + struct syscommon_plugin_deviced_power_trans_info ti = { curr, next, reason, udata }; GList l = { &ti, NULL, NULL }; syscommon_notifier_emit_notify(DEVICED_NOTIFIER_REQUEST_TRANSITION_STATE, &l);