pmqos: Rename exported function name and removes unneeded prefix
authorChanwoo Choi <cw00.choi@samsung.com>
Thu, 2 Feb 2017 01:58:11 +0000 (10:58 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 2 Feb 2017 23:43:19 +0000 (08:43 +0900)
This renames the expoerted function name of pmqos as following:
- get_pmqos_table -> pmqos_get_scenario()
- release_pmqos_table() -> pmqos_put_scenario()

And this patch removes the unneeded prefix ('cpu') because
the scenario does not depend on the specific h/w resource.
The scenario name indicate ths specific situation or status
of user-space.

Change-Id: Iaabab609f00206a5d879a3f41475f97a99534b3c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pmqos/pmqos-parser.c
src/pmqos/pmqos.c
src/pmqos/pmqos.h

index e13e01a75157ff3f04a26f8f9360303dc76a9c16..10302c578294f6bc2bdb26a8167784cdc4cc1317 100644 (file)
@@ -127,7 +127,7 @@ out:
        return 0;
 }
 
-int release_pmqos_table(struct pmqos_scenario *scenarios)
+int pmqos_put_scenario(struct pmqos_scenario *scenarios)
 {
        if (!scenarios)
                return -EINVAL;
@@ -138,7 +138,7 @@ int release_pmqos_table(struct pmqos_scenario *scenarios)
        return 0;
 }
 
-int get_pmqos_table(const char *path, struct pmqos_scenario *scenarios)
+int pmqos_get_scenario(const char *path, struct pmqos_scenario *scenarios)
 {
        int ret;
 
@@ -146,7 +146,7 @@ int get_pmqos_table(const char *path, struct pmqos_scenario *scenarios)
        ret = config_parse(path, pmqos_load_config, scenarios);
        if (ret < 0) {
                _E("failed to load conficuration file(%s) : %d", path, ret);
-               release_pmqos_table(scenarios);
+               pmqos_put_scenario(scenarios);
                return ret;
        }
 
index 72042d018b7c0f55b60ec6596410110c283335a7..da2b61f30a0aa70e864c187568d0c1cbec5e9607 100644 (file)
@@ -37,7 +37,7 @@
 #define MILLISECONDS(tv)       ((tv.tv_sec)*1000 + (tv.tv_nsec)/1000000)
 #define DELTA(a, b)            (MILLISECONDS(a) - MILLISECONDS(b))
 
-static Eina_Bool pmqos_cpu_timer(void *data);
+static Eina_Bool pmqos_timer(void *data);
 
 struct pmqos_cpu {
        char name[NAME_MAX];
@@ -50,7 +50,7 @@ static struct timespec unlock_timer_start_st;
 static struct timespec unlock_timer_end_st;
 static struct pmqos_cpu unlock_timer_owner = {"NULL", 0};
 
-int set_cpu_pmqos(const char *name, int val)
+int set_pmqos(const char *name, int val)
 {
        char scenario[100];
 
@@ -83,7 +83,7 @@ static void pmqos_unlock_timeout_update(void)
                if (cpu->timeout > 0)
                        continue;
                /* Set cpu unlock */
-               set_cpu_pmqos(cpu->name, false);
+               set_pmqos(cpu->name, false);
                /* Delete previous request */
        }
 
@@ -117,7 +117,7 @@ static int pmqos_unlock_timer_start(void)
                memcpy(&unlock_timer_owner, cpu, sizeof(struct pmqos_cpu));
                clock_gettime(CLOCK_REALTIME, &unlock_timer_start_st);
                unlock_timer = ecore_timer_add(((unlock_timer_owner.timeout)/1000.f),
-                       pmqos_cpu_timer, NULL);
+                       pmqos_timer, NULL);
                if (unlock_timer)
                        break;
                _E("fail init pmqos unlock %s %d", cpu->name, cpu->timeout);
@@ -126,7 +126,7 @@ static int pmqos_unlock_timer_start(void)
        return 0;
 }
 
-static int pmqos_cpu_cancel(const char *name)
+static int pmqos_cancel(const char *name)
 {
        dd_list *elem;
        struct pmqos_cpu *cpu;
@@ -141,7 +141,7 @@ static int pmqos_cpu_cancel(const char *name)
                return 0;
 
        /* unlock cpu */
-       set_cpu_pmqos(cpu->name, false);
+       set_pmqos(cpu->name, false);
        /* delete cpu */
        DD_LIST_REMOVE(pmqos_head, cpu);
        free(cpu);
@@ -155,11 +155,11 @@ out:
        return 0;
 }
 
-static Eina_Bool pmqos_cpu_timer(void *data)
+static Eina_Bool pmqos_timer(void *data)
 {
        int ret;
 
-       ret = pmqos_cpu_cancel(unlock_timer_owner.name);
+       ret = pmqos_cancel(unlock_timer_owner.name);
        if (ret < 0)
                _E("Can not find %s request", unlock_timer_owner.name);
 
@@ -183,7 +183,7 @@ static int compare_timeout(const void *a, const void *b)
        return 0;
 }
 
-static int pmqos_cpu_request(const char *name, int val)
+static int pmqos_request(const char *name, int val)
 {
        dd_list *elem;
        struct pmqos_cpu *cpu;
@@ -220,7 +220,7 @@ static int pmqos_cpu_request(const char *name, int val)
        if (ret < 0)
                return ret;
        /* Set cpu lock */
-       set_cpu_pmqos(cpu->name, true);
+       set_pmqos(cpu->name, true);
        return 0;
 }
 
@@ -246,9 +246,9 @@ static DBusMessage *dbus_pmqos_handler(E_DBus_Object *obj, DBusMessage *msg)
        member = dbus_message_get_member(msg);
 
        if (val)
-               ret = pmqos_cpu_request(member, val);
+               ret = pmqos_request(member, val);
        else
-               ret = pmqos_cpu_cancel(member);
+               ret = pmqos_cancel(member);
 
 error:
        reply = dbus_message_new_method_return(msg);
@@ -284,9 +284,9 @@ static DBusMessage *dbus_wifi_pmqos_handler(E_DBus_Object *obj, DBusMessage *msg
        snprintf(name, sizeof(name), "%s%d", member, bps);
 
        if (val)
-               ret = pmqos_cpu_request(name, val);
+               ret = pmqos_request(name, val);
        else
-               ret = pmqos_cpu_cancel(name);
+               ret = pmqos_cancel(name);
 
 error:
        reply = dbus_message_new_method_return(msg);
@@ -316,10 +316,9 @@ static int get_methods_from_conf(const char *path, struct edbus_method **edbus_m
        int i, ret;
 
        /* get pmqos table from conf */
-       ret = get_pmqos_table(path, &scenarios);
+       ret = pmqos_get_scenario(path, &scenarios);
        if (ret < 0) {
-               /* release scenarios memory */
-               release_pmqos_table(&scenarios);
+               pmqos_put_scenario(&scenarios);
                return ret;
        }
 
@@ -335,8 +334,7 @@ static int get_methods_from_conf(const char *path, struct edbus_method **edbus_m
        methods = calloc(scenarios.num, sizeof(struct edbus_method));
        if (!methods) {
                _E("failed to allocate methods memory : %s", strerror(errno));
-               /* release scenarios memory */
-               release_pmqos_table(&scenarios);
+               pmqos_put_scenario(&scenarios);
                return -errno;
        }
 
@@ -456,6 +454,7 @@ static void pmqos_init(void *data)
 
 static void pmqos_exit(void *data)
 {
+       unregister_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done);
 }
 
 static const struct device_ops pmqos_device_ops = {
index 9de6b1d37761460ce9827894a44891e40fa71516..8a4d3818012b91cac591a4550c39fa277c11b083 100644 (file)
@@ -32,7 +32,7 @@ struct pmqos_scenario {
        bool support;
 };
 
-int get_pmqos_table(const char *path, struct pmqos_scenario *scenarios);
-int release_pmqos_table(struct pmqos_scenario *scenarios);
+int pmqos_get_scenario(const char *path, struct pmqos_scenario *scenarios);
+int pmqos_put_scenario(struct pmqos_scenario *scenarios);
 
 #endif /* __PMQOS_H__ */