Change prefix of list definition 72/250972/2 accepted/tizen/unified/20210111.125510 submit/tizen/20210108.041937
authorYunmi Ha <yunmi.ha@samsung.com>
Wed, 6 Jan 2021 07:46:23 +0000 (16:46 +0900)
committerYunmi Ha <yunmi.ha@samsung.com>
Wed, 6 Jan 2021 10:16:44 +0000 (19:16 +0900)
- list to SYS_G_LIST

Change-Id: I44114cdf425e5d232f0414018c5a3698b881d17c
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
src/auto-test/test.c
src/driver/emulator.c
src/driver/gpio_haptic.c
src/driver/haptic.c
src/driver/haptic.h
src/driver/standard.c

index da61f0e..f78bb16 100644 (file)
 #include <libsyscommon/list.h>
 #include "test.h"
 
-static list *dd_head;
+static GList *dd_head;
 
 void add_test(const struct test_ops *d)
 {
        if (d->priority == TEST_PRIORITY_HIGH)
-               LIST_PREPEND(dd_head, d);
+               SYS_G_LIST_PREPEND(dd_head, d);
        else
-               LIST_APPEND(dd_head, d);
+               SYS_G_LIST_APPEND(dd_head, d);
 }
 
 void remove_test(const struct test_ops *d)
 {
-       LIST_REMOVE(dd_head, d);
+       SYS_G_LIST_REMOVE(dd_head, d);
 }
 
 const struct test_ops *find_test(const char *name)
 {
-       list *elem;
+       GList *elem;
        const struct test_ops *d;
 
-       LIST_FOREACH(dd_head, elem, d) {
+       SYS_G_LIST_FOREACH(dd_head, elem, d) {
                if (!strcasecmp(d->name, name))
                        return d;
        }
@@ -49,11 +49,11 @@ const struct test_ops *find_test(const char *name)
 
 void test_init(void *data)
 {
-       list *elem;
+       GList *elem;
        const struct test_ops *d;
 
-       _D("Test module count(%d)", LIST_LENGTH(dd_head));
-       LIST_FOREACH(dd_head, elem, d) {
+       _D("Test module count(%d)", SYS_G_LIST_LENGTH(dd_head));
+       SYS_G_LIST_FOREACH(dd_head, elem, d) {
                _D("'%s' initialize", d->name);
                if (d->init)
                        d->init(data);
@@ -62,10 +62,10 @@ void test_init(void *data)
 
 void test_exit(void *data)
 {
-       list *elem;
+       GList *elem;
        const struct test_ops *d;
 
-       LIST_FOREACH(dd_head, elem, d) {
+       SYS_G_LIST_FOREACH(dd_head, elem, d) {
                _D("'%s' deinitialize", d->name);
                if (d->exit)
                        d->exit(data);
index b2eb229..bca8790 100644 (file)
@@ -25,7 +25,7 @@
 #include "shared/log.h"
 #include "haptic-dev.h"
 
-static list *handle_list;
+static GList *handle_list;
 static int unique_number = 0;
 
 /* START: Haptic Module APIs */
@@ -39,7 +39,7 @@ static int get_device_count(int *count)
 
 static int open_device(int device_index, int *device_handle)
 {
-       list *elem;
+       GList *elem;
        int handle;
        bool found = false;
 
@@ -48,12 +48,12 @@ static int open_device(int device_index, int *device_handle)
 
        while (found != true) {
                ++unique_number;
-               elem = LIST_FIND(handle_list, (gpointer)(long)unique_number);
+               elem = SYS_G_LIST_FIND(handle_list, (gpointer)(long)unique_number);
                if (!elem)
                        found = true;
        }
        handle = unique_number;
-       LIST_APPEND(handle_list, (gpointer)(long)handle);
+       SYS_G_LIST_APPEND(handle_list, (gpointer)(long)handle);
 
        if (device_handle)
                *device_handle = handle;
@@ -63,16 +63,16 @@ static int open_device(int device_index, int *device_handle)
 
 static int close_device(int device_handle)
 {
-       LIST_REMOVE(handle_list, (gpointer)(long)device_handle);
+       SYS_G_LIST_REMOVE(handle_list, (gpointer)(long)device_handle);
 
        return 0;
 }
 
 static int vibrate_monotone(int device_handle, int duration, int frequency, int overdrive, int level, int intensity, int priority)
 {
-       list *elem;
+       GList *elem;
 
-       elem = LIST_FIND(handle_list, (gpointer)(long)device_handle);
+       elem = SYS_G_LIST_FIND(handle_list, (gpointer)(long)device_handle);
        if (!elem)
                return -EINVAL;
 
@@ -81,9 +81,9 @@ static int vibrate_monotone(int device_handle, int duration, int frequency, int
 
 static int stop_device(int device_handle)
 {
-       list *elem;
+       GList *elem;
 
-       elem = LIST_FIND(handle_list, (gpointer)(long)device_handle);
+       elem = SYS_G_LIST_FIND(handle_list, (gpointer)(long)device_handle);
        if (!elem)
                return -EINVAL;
 
index 38dba02..fb175cd 100644 (file)
@@ -74,7 +74,7 @@
 
 static peripheral_i2c_h device_handle = NULL;
 
-static list *handle_list;
+static GList *handle_list;
 static int unique_number;
 
 static bool state = false;
@@ -85,9 +85,9 @@ static int gpio_haptic_stop_device(int handle);
 
 static bool find_from_list(int handle)
 {
-       list *elem;
+       GList *elem;
 
-       elem = LIST_FIND(handle_list, (gpointer)(long)handle);
+       elem = SYS_G_LIST_FIND(handle_list, (gpointer)(long)handle);
        if (elem)
                return true;
 
@@ -137,13 +137,13 @@ static int gpio_haptic_open_device(int device_index, int *handle)
 {
        int n;
        bool found = false;
-       list *elem;
+       GList *elem;
 
        if (!handle)
                return -EINVAL;
 
        /* if it is the first element */
-       n = LIST_LENGTH(handle_list);
+       n = SYS_G_LIST_LENGTH(handle_list);
        if (n == 0) {
                _I("Peripheral Device Open.");
                if (device_handle == NULL) {
@@ -159,13 +159,13 @@ static int gpio_haptic_open_device(int device_index, int *handle)
 
        while (found != true) {
                ++unique_number;
-               elem = LIST_FIND(handle_list, (gpointer)(long)unique_number);
+               elem = SYS_G_LIST_FIND(handle_list, (gpointer)(long)unique_number);
                if (!elem)
                        found = true;
        }
 
        /* add info to local list */
-       LIST_APPEND(handle_list, (gpointer)(long)unique_number);
+       SYS_G_LIST_APPEND(handle_list, (gpointer)(long)unique_number);
 
        *handle = unique_number;
        return 0;
@@ -193,10 +193,10 @@ static int gpio_haptic_close_device(int handle)
                _I("Already stopped or failed to stop effect: %d", r);
 
        _D("Handle(%d) is closed and timer deleted.", handle);
-       LIST_REMOVE(handle_list, (gpointer)(long)handle);
+       SYS_G_LIST_REMOVE(handle_list, (gpointer)(long)handle);
 
        /* if it is the last element */
-       n = LIST_LENGTH(handle_list);
+       n = SYS_G_LIST_LENGTH(handle_list);
        if (n == 0) {
                _I("Peripheral Device Close.");
                if (device_handle != NULL) {
index 3de4aae..19c4145 100644 (file)
@@ -80,7 +80,7 @@
 struct vibration_config {
        char *pattern; /* pattern name */
        char *standard; /* assigned standard pattern name */
-       list *data; /* duration_data list */
+       GList *data; /* duration_data list */
        unsigned int pattern_duration;
        int unlimit;
 };
@@ -102,7 +102,7 @@ enum poweroff_type {
 
 struct haptic_info {
        char *sender;
-       list *handle_list;
+       GList *handle_list;
        guint id_watch;
 };
 
@@ -125,12 +125,12 @@ struct vibrate_monotone_info {
 static int g_handle;
 
 /* pattern configuration list */
-static list *vib_conf_list;
+static GList *vib_conf_list;
 
 static guint duration_timer;
 
 /* haptic operation variable */
-static list *haptic_handle_list;
+static GList *haptic_handle_list;
 
 static bool haptic_disabled;
 
@@ -148,7 +148,7 @@ static int remove_haptic_info(struct haptic_info *info);
 
 struct haptic_data cur_h_data;
 
-static int insert_conf_data(list **conf_data, struct duration_data *update)
+static int insert_conf_data(GList **conf_data, struct duration_data *update)
 {
        struct duration_data *data;
 
@@ -161,7 +161,7 @@ static int insert_conf_data(list **conf_data, struct duration_data *update)
        /* insert vibration pattern data */
        // to debug :
        // _D("%dD%dI%dF%dO%dW", data->duration, data->intensity, data->frequency, data->overdrive, data->wait);
-       LIST_APPEND(*conf_data, data);
+       SYS_G_LIST_APPEND(*conf_data, data);
        return 0;
 }
 
@@ -189,7 +189,7 @@ static void get_pattern_property(char **iter, char property, int *value)
 }
 
 /* [A]xxxDxxxIxxxFxxxOxxxW format */
-static int insert_raw_data_format(list **conf_data, char *value)
+static int insert_raw_data_format(GList **conf_data, char *value)
 {
        struct duration_data update = {0, };
        char *iter;
@@ -372,7 +372,7 @@ static int load_standard_format(const char *pattern)
                }
        }
        close(fd);
-       LIST_APPEND(vib_conf_list, conf);
+       SYS_G_LIST_APPEND(vib_conf_list, conf);
        return ret;
 
 error_out:
@@ -423,7 +423,7 @@ static int vibration_load_config(struct parse_result *result, void *user_data)
        if (len == 0) {
                if (insert_raw_data_format(&conf->data, NULL) < 0)
                        goto error_out;
-               LIST_APPEND(vib_conf_list, conf);
+               SYS_G_LIST_APPEND(vib_conf_list, conf);
                return 0;
        }
 
@@ -439,7 +439,7 @@ static int vibration_load_config(struct parse_result *result, void *user_data)
                        _E("Failed to copy standard name.");
                        goto error_out;
                }
-               LIST_APPEND(vib_conf_list, conf);
+               SYS_G_LIST_APPEND(vib_conf_list, conf);
                return 0;
        }
 
@@ -461,7 +461,7 @@ static int vibration_load_config(struct parse_result *result, void *user_data)
                goto error_out;
        } else
                conf->pattern_duration = duration;
-       LIST_APPEND(vib_conf_list, conf);
+       SYS_G_LIST_APPEND(vib_conf_list, conf);
 
        return 0;
 
@@ -577,7 +577,7 @@ void haptic_name_owner_changed(GDBusConnection *connection,
        const gchar     *name,
        gpointer         user_data)
 {
-       list *n;
+       GList *n;
        struct haptic_info *info = user_data;
        int handle;
 
@@ -611,7 +611,7 @@ static struct haptic_info *add_haptic_info(const char *sender)
                return NULL;
        }
 
-       LIST_APPEND(haptic_handle_list, info);
+       SYS_G_LIST_APPEND(haptic_handle_list, info);
 
        info->id_watch = dbus_handle_watch_name(sender, NULL, haptic_name_owner_changed, info, NULL);
 
@@ -624,8 +624,8 @@ static int remove_haptic_info(struct haptic_info *info)
 
        dbus_handle_unwatch_name(info->id_watch);
 
-       LIST_REMOVE(haptic_handle_list, info);
-       LIST_FREE_LIST(info->handle_list);
+       SYS_G_LIST_REMOVE(haptic_handle_list, info);
+       SYS_G_LIST_FREE_LIST(info->handle_list);
        if (info->sender) {
                free(info->sender);
        }
@@ -636,14 +636,14 @@ static int remove_haptic_info(struct haptic_info *info)
 
 static struct haptic_info *get_matched_haptic_info(const char *sender)
 {
-       list *n;
+       GList *n;
        struct haptic_info *info;
        int len;
 
        assert(sender);
 
        len = strlen(sender) + 1;
-       LIST_FOREACH(haptic_handle_list, n, info) {
+       SYS_G_LIST_FOREACH(haptic_handle_list, n, info) {
                if (!strncmp(info->sender, sender, len))
                        return info;
        }
@@ -688,7 +688,7 @@ GVariant *hdbus_open_device(GDBusConnection *conn,
                }
        }
 
-       LIST_APPEND(info->handle_list, (gpointer)(long)handle);
+       SYS_G_LIST_APPEND(info->handle_list, (gpointer)(long)handle);
 
        ret = handle;
 
@@ -745,8 +745,8 @@ GVariant *hdbus_close_device(GDBusConnection *conn,
                goto exit;
        }
 
-       LIST_REMOVE(info->handle_list, (gpointer)(long)handle);
-       cnt = LIST_LENGTH(info->handle_list);
+       SYS_G_LIST_REMOVE(info->handle_list, (gpointer)(long)handle);
+       cnt = SYS_G_LIST_LENGTH(info->handle_list);
        if (cnt == 0)
                remove_haptic_info(info);
 
@@ -868,7 +868,7 @@ exit:
 
 static gboolean haptic_duration_play(void *data)
 {
-       list *head, *n, *next;
+       GList *head, *n, *next;
        struct duration_data *node;
        int ret = 0;
 
@@ -886,7 +886,7 @@ static gboolean haptic_duration_play(void *data)
                        goto out;
                }
        } else
-               head = (list *)data;
+               head = (GList *)data;
 
        if (cur_h_data.stop) {
                _I("Stop currunt vibration.");
@@ -896,7 +896,7 @@ static gboolean haptic_duration_play(void *data)
                goto out;
        }
 
-       LIST_FOREACH_SAFE(head, n, next, node) {
+       SYS_G_LIST_FOREACH_SAFE(head, n, next, node) {
                _I("Handle(%d) play=%dms and Wait=%dms %s type. (level=%d, intensity=%d, frequency=%d)",
                        cur_h_data.handle, node->duration, node->wait,
                        cur_h_data.unlimit ? "Unlimit" : "Once", cur_h_data.level, node->intensity, node->frequency);
@@ -928,7 +928,7 @@ out:
 static void vibrate_pattern_idler_cb(void *data)
 {
        struct vibrate_pattern_info *vibrate_info;
-       list *elem;
+       GList *elem;
        struct vibration_config *conf;
        char pattern[PATH_MAX];
        int ret;
@@ -951,7 +951,7 @@ static void vibrate_pattern_idler_cb(void *data)
        }
 
        snprintf(pattern, sizeof(pattern), "%s", vibrate_info->pattern);
-       LIST_FOREACH(vib_conf_list, elem, conf) {
+       SYS_G_LIST_FOREACH(vib_conf_list, elem, conf) {
                if (!conf->pattern)
                        continue;
                if (strcmp(conf->pattern, pattern))
@@ -1080,12 +1080,12 @@ GVariant *hdbus_show_handle_list(GDBusConnection *conn,
        const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
        GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
 {
-       list *n;
-       list *elem;
+       GList *n;
+       GList *elem;
        struct haptic_info *info;
 
        _D("Sender Handle");
-       LIST_FOREACH(haptic_handle_list, n, info) {
+       SYS_G_LIST_FOREACH(haptic_handle_list, n, info) {
                for (elem = info->handle_list; elem; elem = elem->next)
                        _D("%s %d", info->sender, (int)(long)elem->data);
        }
@@ -1095,7 +1095,7 @@ GVariant *hdbus_show_handle_list(GDBusConnection *conn,
 
 int pattern_is_supported(const char *pattern)
 {
-       list *elem;
+       GList *elem;
        struct vibration_config *conf;
        int ret;
 
@@ -1103,7 +1103,7 @@ int pattern_is_supported(const char *pattern)
                return -EINVAL;
 
        ret = 0;
-       LIST_FOREACH(vib_conf_list, elem, conf) {
+       SYS_G_LIST_FOREACH(vib_conf_list, elem, conf) {
                if (!conf->pattern)
                        continue;
                if (!strcmp(conf->pattern, pattern)) {
index 7251c8d..54b92d5 100644 (file)
@@ -21,8 +21,8 @@
 #define __FEEDBACKD_HAPTIC_H__
 
 #include <stdbool.h>
+#include <glib.h>
 #include <device/power.h>
-#include <libsyscommon/list.h>
 #include "shared/common.h"
 
 enum priority_level {
@@ -33,7 +33,7 @@ enum priority_level {
 };
 
 struct haptic_data {
-       list *vibration_data;
+       GList *vibration_data;
        unsigned int handle;
        int level;
        int priority;
index 2ac1271..310bd3e 100644 (file)
@@ -73,8 +73,8 @@ struct ff_info {
 };
 
 static int ff_fd;
-static list *ff_list;
-static list *handle_list;
+static GList *ff_list;
+static GList *handle_list;
 static char ff_path[PATH_MAX];
 static int unique_number;
 static int current_effect_id = -1;
@@ -84,9 +84,9 @@ static int stop_device(int device_handle);
 struct ff_info *read_from_list(int handle)
 {
        struct ff_info *temp;
-       list *elem;
+       GList *elem;
 
-       LIST_FOREACH(ff_list, elem, temp) {
+       SYS_G_LIST_FOREACH(ff_list, elem, temp) {
                if (temp->handle == handle)
                        return temp;
        }
@@ -96,9 +96,9 @@ struct ff_info *read_from_list(int handle)
 static bool check_valid_handle(struct ff_info *info)
 {
        struct ff_info *temp;
-       list *elem;
+       GList *elem;
 
-       LIST_FOREACH(ff_list, elem, temp) {
+       SYS_G_LIST_FOREACH(ff_list, elem, temp) {
                if (temp == info)
                        break;
        }
@@ -336,13 +336,13 @@ static int open_device(int device_index, int *device_handle)
        struct ff_info *info;
        int n;
        bool found = false;
-       list *elem;
+       GList *elem;
 
        if (!device_handle)
                return -EINVAL;
 
        /* if it is the first element */
-       n = LIST_LENGTH(ff_list);
+       n = SYS_G_LIST_LENGTH(ff_list);
        if (n == 0 && !ff_fd) {
                _I("First element: open ff driver");
                /* open ff driver */
@@ -368,7 +368,7 @@ static int open_device(int device_index, int *device_handle)
 
        while (found != true) {
                ++unique_number;
-               elem = LIST_FIND(handle_list, (gpointer)(long)unique_number);
+               elem = SYS_G_LIST_FIND(handle_list, (gpointer)(long)unique_number);
                if (!elem)
                        found = true;
        }
@@ -376,8 +376,8 @@ static int open_device(int device_index, int *device_handle)
        info->handle = unique_number;
 
        /* add info to local list */
-       LIST_APPEND(ff_list, info);
-       LIST_APPEND(handle_list, (gpointer)(long)info->handle);
+       SYS_G_LIST_APPEND(ff_list, info);
+       SYS_G_LIST_APPEND(handle_list, (gpointer)(long)info->handle);
 
        *device_handle = info->handle;
        return 0;
@@ -407,15 +407,15 @@ static int close_device(int device_handle)
        /* stop vibration */
        stop_device(device_handle);
 
-       LIST_REMOVE(handle_list, (gpointer)(long)info->handle);
+       SYS_G_LIST_REMOVE(handle_list, (gpointer)(long)info->handle);
 
        safe_free(info->ffinfobuffer);
        /* remove info from local list */
-       LIST_REMOVE(ff_list, info);
+       SYS_G_LIST_REMOVE(ff_list, info);
        safe_free(info);
 
        /* if it is the last element */
-       n = LIST_LENGTH(ff_list);
+       n = SYS_G_LIST_LENGTH(ff_list);
        if (n == 0 && ff_fd) {
                _I("Last element: close ff driver");
                /* close ff driver */